import 'package:flutter/material.dart';

class CarritoScreen extends StatefulWidget {
  const CarritoScreen({super.key});

  @override
  State<CarritoScreen> createState() => _CarritoScreenState();
}

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: const [],
        title: const Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Text('Atrás'),
            Column(
              children: [
                Text(
                  'Su carrito',
                  style: TextStyle(fontSize: 17, color: Colors.black54),
                ),
                Text(
                  style: TextStyle(fontSize: 20, fontWeight: FontWeight.w800),
                  'MXN 69.00',
                )
              ],
            )
          ],
        ),
      ),
      bottomNavigationBar: BottomAppBar(
        height: 100,
        color: Colors.transparent,
        child: Padding(
          padding: const EdgeInsets.all(10),
          child: Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            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'),
                    )
                  ],
                ),
              ),
              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
                        ),
                      ],
                    )
                  ],
                ),
                
              ],
            ),
          ],
        ),
      ),
    );
  }
}
