Selaa lähdekoodia

se agregaron widgets del carrito

BaLa 1 kuukausi sitten
vanhempi
commit
af4ae8e4f5
1 muutettua tiedostoa jossa 136 lisäystä ja 32 poistoa
  1. 136 32
      lib/mvvm/views/home/carrito/carrito_screen.dart

+ 136 - 32
lib/mvvm/views/home/carrito/carrito_screen.dart

@@ -8,13 +8,28 @@ class CarritoScreen extends StatefulWidget {
 }
 
 class _CarritoScreenState extends State<CarritoScreen> {
+  int value = 1;
+
+  void increment(){
+    setState(() {
+      value++;
+      });
+  }
+
+  void decrement(){
+    setState(() {
+      if(value > 1){
+        value--;
+      }
+    });
+  }
   @override
   Widget build(BuildContext context) {
     return Scaffold(
       backgroundColor: Colors.white,
       appBar: AppBar(
-        actions: [],
-        title: const  Row(
+         actions: const [],
+        title: const Row(
           mainAxisAlignment: MainAxisAlignment.spaceBetween,
           children: [
             Text('Atrás'),
@@ -22,16 +37,10 @@ class _CarritoScreenState extends State<CarritoScreen> {
               children: [
                 Text(
                   'Su carrito',
-                  style:TextStyle(
-                    fontSize: 17,
-                    color: Colors.black54
-                  ),
+                  style: TextStyle(fontSize: 17, color: Colors.black54),
                 ),
                 Text(
-                  style: TextStyle(
-                    fontSize: 20,
-                    fontWeight: FontWeight.w800
-                  ),
+                  style: TextStyle(fontSize: 20, fontWeight: FontWeight.w800),
                   'MXN 69.00',
                 )
               ],
@@ -39,34 +48,129 @@ class _CarritoScreenState extends State<CarritoScreen> {
           ],
         ),
       ),
-      body: Column(
-        children:[ 
-          Row(
+      bottomNavigationBar: BottomAppBar(
+        height: 100,
+        color: Colors.transparent,
+        child: Padding(
+          padding: const EdgeInsets.all(10),
+          child: Row(
             mainAxisAlignment: MainAxisAlignment.spaceBetween,
             children: [
-              Image.network('https://cdn.pixabay.com/photo/2016/03/05/19/02/hamburger-1238246_960_720.jpg',
-              width: 100,
-              height: 100,
-              ),
-              
-             const Column (children: [
-              Text(
-                '1.HAMBURGUESA SENCILLA'
-              ),
-              Text(
-                style: TextStyle(
-                  fontWeight: FontWeight.bold,
+              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'),
+                    )
+                  ],
                 ),
-                'MXN 115.00'
               ),
-          ],),
-              
-              
-              
-              
+              TextButton(
+                style: TextButton.styleFrom(
+                  minimumSize: const Size(170, 200),
+                  backgroundColor: Colors.blue,
+                  foregroundColor: Colors.white,
+                  shape: RoundedRectangleBorder(
+                    borderRadius: BorderRadius.circular(10),
+                  ),
+                ),
+                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(
+          children: [
+            const Padding(
+              padding: EdgeInsets.all(5),
+            ),
+            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
+                        ),
+                      ],
+                    )
+                  ],
+                ),
+                
+              ],
+            ),
+          ],
+        ),
       ),
     );
   }