浏览代码

Merge remote-tracking branch 'origin/desarrollo' into BaLaDev

BaLa 3 月之前
父节点
当前提交
e143f95ffe
共有 1 个文件被更改,包括 114 次插入119 次删除
  1. 114 119
      lib/mvvm/views/home/carrito/carrito_screen.dart

+ 114 - 119
lib/mvvm/views/home/carrito/carrito_screen.dart

@@ -1,5 +1,22 @@
 import 'package:flutter/material.dart';
 
+const List<Map<String, dynamic>> items = [
+  {
+    'nombre': 'Hamburguesa de res',
+    'descripcion': 'Hamburguesa de res con queso cheddar',
+    'precio': '\$ 120.00',
+    'imageUrl':
+        'https://cdn.pixabay.com/photo/2016/03/05/19/02/hamburger-1238246_960_720.jpg',
+  },
+  {
+    'nombre': 'Hamburguesa de pollo',
+    'descripcion': 'Hamburguesa de pollo con queso cheddar',
+    'precio': '\$ 100.00',
+    'imageUrl':
+        'https://cdn.pixabay.com/photo/2016/03/05/19/02/hamburger-1238246_960_720.jpg',
+  },
+];
+
 class CarritoScreen extends StatefulWidget {
   const CarritoScreen({super.key});
 
@@ -28,150 +45,128 @@ class _CarritoScreenState extends State<CarritoScreen> {
     return Scaffold(
       backgroundColor: Colors.white,
       appBar: AppBar(
-         actions: const [],
         title: const Row(
           mainAxisAlignment: MainAxisAlignment.spaceBetween,
           children: [
             Text('Atrás'),
             Column(
+              crossAxisAlignment: CrossAxisAlignment.start,
               children: [
                 Text(
                   'Su carrito',
-                  style: TextStyle(fontSize: 17, color: Colors.black54),
+                  style: TextStyle(
+                      fontStyle: FontStyle.italic,
+                      fontSize: 16,
+                      color: Colors.black54),
                 ),
                 Text(
-                  style: TextStyle(fontSize: 20, fontWeight: FontWeight.w800),
-                  'MXN 69.00',
-                )
+                  'Total: \$0.00',
+                  style: TextStyle(
+                    fontWeight: FontWeight.bold,
+                    fontSize: 20,
+                  ),
+                ),
               ],
-            )
+            ),
           ],
         ),
       ),
-      bottomNavigationBar: BottomAppBar(
-        height: 100,
-        color: Colors.transparent,
-        child: Padding(
-          padding: const EdgeInsets.all(10),
-          child: Row(
-            mainAxisAlignment: MainAxisAlignment.spaceBetween,
+      body: ListView.builder(
+          itemBuilder: (context, index) {
+            final item = items[index];
+            return _buildInfoItem(item['nombre'], item['descripcion'],
+                item['precio'], item['imageUrl']);
+          },
+          itemCount: items.length),
+    );
+  }
+}
+
+_buildInfoItem(String title, String subtitle, String precio, String imageUrl) {
+  return Container(
+    height: 90,
+    width: double.infinity,
+    color: Colors.white,
+    padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
+    child: Row(
+      children: [
+        // Leading image
+        Container(
+          width: 80,
+          height: 80,
+          child: ClipRRect(
+            borderRadius: BorderRadius.circular(4),
+            child: Image.network(
+              imageUrl,
+              fit: BoxFit.cover,
+            ),
+          ),
+        ),
+        SizedBox(width: 16),
+        // Title and subtitle
+        Expanded(
+          child: Column(
+            crossAxisAlignment: CrossAxisAlignment.start,
+            mainAxisAlignment: MainAxisAlignment.center,
             children: [
-              TextButton(
-                style: TextButton.styleFrom(
-                  minimumSize: const Size(170, 200),
-                  backgroundColor: Colors.blue,
-                  foregroundColor: Colors.white,
-                  shape: RoundedRectangleBorder(
-                  borderRadius: BorderRadius.circular(10),
-                  ),
-                ),
-                onPressed: (){},
-                child: const Row(
-                  children: [
-                    Padding(
-                      padding: EdgeInsets.only(bottom: 3),
-                      child: Icon(Icons.fastfood_outlined),
-                    ),
-                    
-                    Padding(
-                      padding: EdgeInsets.only(left:8),
-                      child: Text('En el local'),
-                    )
-                  ],
+              Text(
+                title,
+                style: TextStyle(
+                  color: Colors.black,
+                  fontSize: 16,
+                  fontWeight: FontWeight.bold,
                 ),
               ),
-              TextButton(
-                style: TextButton.styleFrom(
-                  minimumSize: const Size(170, 200),
-                  backgroundColor: Colors.blue,
-                  foregroundColor: Colors.white,
-                  shape: RoundedRectangleBorder(
-                    borderRadius: BorderRadius.circular(10),
-                  ),
+              SizedBox(height: 4),
+              Text(
+                'MXN $precio',
+                style: TextStyle(
+                  color: Colors.black,
+                  fontSize: 18,
+                  fontWeight: FontWeight.bold,
                 ),
-                onPressed: (){
-                    Navigator.of(context).pushNamed('Recojer');
-
-                },
-                child: const Row(
-                  children: [
-                    Padding(
-                      padding: EdgeInsets.only(bottom: 3),
-                      child: Icon(Icons.shopping_bag_outlined),
-                    ),
-                    
-                    Padding(
-                      padding: EdgeInsets.only(left:8),
-                      child: Text('Para recojer'),
-                    )
-                  ],
-                ),
-              )
+              ),
             ],
           ),
         ),
-      ),
-      body:
-      Padding(
-        padding: const EdgeInsets.all(8.0),
-        child: Column(
+        // Quantity controls
+        Row(
           children: [
-            const Padding(
-              padding: EdgeInsets.all(5),
+            Container(
+              width: 40,
+              height: 40,
+              alignment: Alignment.center,
+              child: Icon(
+                Icons.remove,
+                color: Colors.black,
+                size: 24,
+              ),
             ),
-            Row(
-              mainAxisAlignment: MainAxisAlignment.spaceBetween,
-              children:  [
-                ClipRRect(
-                  borderRadius: BorderRadius.circular(10),
-                  child: Image.network(
-                  'https://cdn.pixabay.com/photo/2016/03/05/19/02/hamburger-1238246_960_720.jpg',
-                  width: 80,
-                  height: 80,
-                  fit: BoxFit.cover,
-                )
-        
-                ),
-              
-                const Column(
-                  children: [
-                    Text('1.HAMBURGUESA SENCILLA'),
-                    Text(
-                        style: TextStyle(
-                          fontWeight: FontWeight.bold,
-                        ),
-                        'MXN 115.00'),
-                  ],
-                ),
-                Column(
-                  children: [
-                    Row(
-                      children: [
-                        IconButton(
-                          onPressed: increment,
-                          icon: const Icon(Icons.add),
-                          color: Colors.blue
-                        ),
-        
-                        Text(
-                          "$value"
-                        ),
-        
-                        IconButton(
-                          onPressed: decrement,
-                          icon: const Icon(Icons.remove),
-                          color: Colors.blue
-                        ),
-                      ],
-                    )
-                  ],
+            Container(
+              width: 40,
+              alignment: Alignment.center,
+              child: Text(
+                subtitle,
+                style: TextStyle(
+                  color: Colors.black,
+                  fontSize: 20,
+                  fontWeight: FontWeight.bold,
                 ),
-                
-              ],
+              ),
+            ),
+            Container(
+              width: 40,
+              height: 40,
+              alignment: Alignment.center,
+              child: Icon(
+                Icons.add,
+                color: Colors.red,
+                size: 24,
+              ),
             ),
           ],
         ),
-      ),
-    );
-  }
+      ],
+    ),
+  );
 }