瀏覽代碼

Arreglo a la pantalla de detalles

c90Beretta 2 月之前
父節點
當前提交
13e1faaf08
共有 2 個文件被更改,包括 146 次插入157 次删除
  1. 60 62
      lib/mvvm/views/home/home_screen.dart
  2. 86 95
      lib/utils/widgets/ordenes_card.dart

+ 60 - 62
lib/mvvm/views/home/home_screen.dart

@@ -102,29 +102,28 @@ class Formulario extends State<HomeScreen> {
           ),
           if (mesaViewModel.selectedMesa != null)
             Expanded(
-                flex: 1,
                 child: Container(
-                  margin: const EdgeInsets.all(10),
-                  decoration: BoxDecoration(
-                    color: Colors.white,
-                    borderRadius: BorderRadius.circular(10),
-                    boxShadow: [
-                      BoxShadow(
-                        color: Colors.grey.withOpacity(0.2),
-                        blurRadius: 5,
-                        spreadRadius: 1,
-                      )
-                    ],
-                  ),
-                  child: TablaDetalles(
-                      status: EstadoPedido.disponible,
-                      table: mesaViewModel.selectedMesa ??
-                          Mesa(
-                              activa: false,
-                              id: 0,
-                              nombre: 'Mesa sin nombre',
-                              estado: EstadoPedido.disponible)),
-                )),
+              margin: const EdgeInsets.all(10),
+              decoration: BoxDecoration(
+                color: Colors.white,
+                borderRadius: BorderRadius.circular(10),
+                boxShadow: [
+                  BoxShadow(
+                    color: Colors.grey.withOpacity(0.2),
+                    blurRadius: 5,
+                    spreadRadius: 1,
+                  )
+                ],
+              ),
+              child: TablaDetalles(
+                  status: EstadoPedido.disponible,
+                  table: mesaViewModel.selectedMesa ??
+                      Mesa(
+                          activa: false,
+                          id: 0,
+                          nombre: 'Mesa sin nombre',
+                          estado: EstadoPedido.disponible)),
+            )),
         ],
       ),
     );
@@ -176,14 +175,21 @@ class TablaDetalles extends StatelessWidget {
   @override
   Widget build(BuildContext context) {
     return Container(
+      margin: const EdgeInsets.all(10),
       decoration: BoxDecoration(
         color: Colors.white,
         borderRadius: BorderRadius.circular(10),
+        boxShadow: [
+          BoxShadow(
+            color: Colors.grey.withOpacity(0.2),
+            blurRadius: 5,
+            spreadRadius: 1,
+          )
+        ],
       ),
       child: Column(
-        crossAxisAlignment: CrossAxisAlignment.start,
         children: [
-          // Encabezado del panel
+          // Header
           Container(
             padding: const EdgeInsets.all(16),
             decoration: BoxDecoration(
@@ -227,46 +233,38 @@ class TablaDetalles extends StatelessWidget {
               ],
             ),
           ),
-          Padding(
-            padding: const EdgeInsets.all(16),
-            child: Column(
-              crossAxisAlignment: CrossAxisAlignment.start,
-              children: [
-                Text(
-                  'ID: ${table.id}',
-                  style: const TextStyle(fontSize: 16),
-                ),
-                const SizedBox(height: 8),
-                SizedBox(
-                  height: 50,
-                  child: Row(
-                    children: [
-                      const Text('Estado: '),
-                      Text(
-                        status.toString().split('.').last,
-                        style: const TextStyle(
-                          fontWeight: FontWeight.bold,
-                          color: Colors.blue,
+          // Contenido scrolleable
+          Expanded(
+            child: SingleChildScrollView(
+              child: Padding(
+                padding: const EdgeInsets.all(16),
+                child: Column(
+                  crossAxisAlignment: CrossAxisAlignment.start,
+                  children: [
+                    Text(
+                      'ID: ${table.id}',
+                      style: const TextStyle(fontSize: 16),
+                    ),
+                    const SizedBox(height: 16),
+                    Row(
+                      children: [
+                        const Text('Estado: '),
+                        Text(
+                          status.toString().split('.').last,
+                          style: const TextStyle(
+                            fontWeight: FontWeight.bold,
+                            color: Colors.blue,
+                          ),
                         ),
-                      ),
-                    ],
-                  ),
+                      ],
+                    ),
+                    const SizedBox(height: 16),
+                    IconDataByStatus(status: status),
+                    const SizedBox(height: 16),
+                    const OrdenesScreen(),
+                  ],
                 ),
-                const SizedBox(height: 8),
-                // Row(
-                //   children: [
-                //     SizedBox(
-                //       height: 80,
-                //       width: 80,
-                //       child: IconDataByStatus(status: status),
-                //     )
-                //   ],
-                // ),
-                // //  OrdenMesaCard(mesaNumero: table.nombre!, ordenNumero: table.posicion!,),
-                // Container(
-                //     // child: OrdenesScreen(),
-                //     )
-              ],
+              ),
             ),
           ),
         ],

+ 86 - 95
lib/utils/widgets/ordenes_card.dart

@@ -1,5 +1,70 @@
 import 'package:flutter/material.dart';
 
+class OrdenItem {
+  final int cantidad;
+  final String nombre;
+  final String descripcion;
+  final String? notas;
+  final bool isListo;
+
+  OrdenItem({
+    required this.cantidad,
+    required this.nombre,
+    required this.descripcion,
+    this.notas,
+    this.isListo = false,
+  });
+}
+
+class OrdenesScreen extends StatelessWidget {
+  const OrdenesScreen({Key? key}) : super(key: key);
+
+  @override
+  Widget build(BuildContext context) {
+    final items = [
+      OrdenItem(
+        cantidad: 1,
+        nombre: 'Chilaquiles Verdes',
+        descripcion: 'Tortillas fritas en salsa verde con pollo',
+        notas: 'Sin cebolla ni tomate',
+      ),
+      OrdenItem(
+        cantidad: 2,
+        nombre: 'Huevos Rancheros',
+        descripcion: 'Huevos fritos sobre tortilla con salsa roja',
+      ),
+    ];
+
+    final items2 = [
+      OrdenItem(
+        cantidad: 1,
+        nombre: 'Club Sandwich',
+        descripcion: 'Sándwich triple con pollo, jamón y tocino',
+        isListo: true,
+      ),
+    ];
+
+    return Column(
+      mainAxisSize: MainAxisSize.min,
+      children: [
+        OrdenMesaCard(
+          mesaNumero: '5',
+          ordenNumero: 'A-123',
+          items: items,
+          onLiberarOrden: () {},
+        ),
+        OrdenMesaCard(
+          mesaNumero: '3',
+          ordenNumero: 'A-124',
+          items: items2,
+          tieneItemsListos: true,
+          onLiberarOrden: () {},
+        ),
+      ],
+    );
+  }
+}
+
 class OrdenMesaCard extends StatelessWidget {
   final String mesaNumero;
   final String ordenNumero;
@@ -21,10 +86,8 @@ class OrdenMesaCard extends StatelessWidget {
     return Card(
       margin: const EdgeInsets.all(8.0),
       child: Column(
-        crossAxisAlignment: CrossAxisAlignment.stretch,
         mainAxisSize: MainAxisSize.min,
         children: [
-          // Encabezado de la mesa
           Padding(
             padding: const EdgeInsets.all(16.0),
             child: Row(
@@ -41,33 +104,28 @@ class OrdenMesaCard extends StatelessWidget {
                   children: [
                     const Icon(Icons.access_time, size: 16),
                     const SizedBox(width: 4),
-                    Text('15:03'),
+                    const Text('15:03'),
                   ],
                 ),
               ],
             ),
           ),
           const Divider(height: 1),
-          // Número de orden
           Padding(
             padding:
                 const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
-            child: Text(
-              'Orden #$ordenNumero',
-              style: TextStyle(
-                color: Colors.grey[600],
-                fontSize: 14,
+            child: Align(
+              alignment: Alignment.centerLeft,
+              child: Text(
+                'Orden #$ordenNumero',
+                style: TextStyle(
+                  color: Colors.grey[600],
+                  fontSize: 14,
+                ),
               ),
             ),
           ),
-          // Lista de items
-          ListView.builder(
-            shrinkWrap: true,
-            physics: const NeverScrollableScrollPhysics(),
-            itemCount: items.length,
-            itemBuilder: (context, index) {
-              final item = items[index];
-              return ListTile(
+          ...items.map((item) => ListTile(
                 contentPadding: const EdgeInsets.symmetric(horizontal: 16.0),
                 leading: Text(
                   '${item.cantidad}x',
@@ -120,10 +178,7 @@ class OrdenMesaCard extends StatelessWidget {
                         ),
                       )
                     : const Icon(Icons.chevron_right),
-              );
-            },
-          ),
-
+              )),
           Padding(
             padding: const EdgeInsets.all(16.0),
             child: ElevatedButton(
@@ -135,12 +190,16 @@ class OrdenMesaCard extends StatelessWidget {
                   borderRadius: BorderRadius.circular(8),
                 ),
               ),
-              child: const Text(
-                'Liberar Orden Completa',
-                style: TextStyle(
-                  color: Colors.white,
-                  fontSize: 16,
-                  fontWeight: FontWeight.w500,
+              child: const SizedBox(
+                width: double.infinity,
+                child: Text(
+                  'Liberar Orden Completa',
+                  textAlign: TextAlign.center,
+                  style: TextStyle(
+                    color: Colors.white,
+                    fontSize: 16,
+                    fontWeight: FontWeight.w500,
+                  ),
                 ),
               ),
             ),
@@ -150,71 +209,3 @@ class OrdenMesaCard extends StatelessWidget {
     );
   }
 }
-
-class OrdenItem {
-  final int cantidad;
-  final String nombre;
-  final String descripcion;
-  final String? notas;
-  final bool isListo;
-
-  OrdenItem({
-    required this.cantidad,
-    required this.nombre,
-    required this.descripcion,
-    this.notas,
-    this.isListo = false,
-  });
-}
-
-class OrdenesScreen extends StatelessWidget {
-  const OrdenesScreen({Key? key}) : super(key: key);
-
-  @override
-  Widget build(BuildContext context) {
-    final items = [
-      OrdenItem(
-        cantidad: 1,
-        nombre: 'Chilaquiles Verdes',
-        descripcion: 'Tortillas fritas en salsa verde con pollo',
-        notas: 'Sin cebolla ni tomate',
-      ),
-      OrdenItem(
-        cantidad: 2,
-        nombre: 'Huevos Rancheros',
-        descripcion: 'Huevos fritos sobre tortilla con salsa roja',
-      ),
-    ];
-
-    final items2 = [
-      OrdenItem(
-        cantidad: 1,
-        nombre: 'Club Sandwich',
-        descripcion: 'Sándwich triple con pollo, jamón y tocino',
-        isListo: true,
-      ),
-    ];
-
-    return ListView(
-      children: [
-        OrdenMesaCard(
-          mesaNumero: '5',
-          ordenNumero: 'A-123',
-          items: items,
-          onLiberarOrden: () {
-            // Implementar lógica para liberar orden
-          },
-        ),
-        OrdenMesaCard(
-          mesaNumero: '3',
-          ordenNumero: 'A-124',
-          items: items2,
-          tieneItemsListos: true,
-          onLiberarOrden: () {
-            // Implementar lógica para liberar orden
-          },
-        ),
-      ],
-    );
-  }
-}