carrito_screen.dart 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. import 'package:flutter/material.dart';
  2. class CarritoScreen extends StatefulWidget {
  3. const CarritoScreen({super.key});
  4. @override
  5. State<CarritoScreen> createState() => _CarritoScreenState();
  6. }
  7. class _CarritoScreenState extends State<CarritoScreen> {
  8. int value = 1;
  9. void increment(){
  10. setState(() {
  11. value++;
  12. });
  13. }
  14. void decrement(){
  15. setState(() {
  16. if(value > 1){
  17. value--;
  18. }
  19. });
  20. }
  21. @override
  22. Widget build(BuildContext context) {
  23. return Scaffold(
  24. backgroundColor: Colors.white,
  25. appBar: AppBar(
  26. actions: const [],
  27. title: const Row(
  28. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  29. children: [
  30. Text('Atrás'),
  31. Column(
  32. children: [
  33. Text(
  34. 'Su carrito',
  35. style: TextStyle(fontSize: 17, color: Colors.black54),
  36. ),
  37. Text(
  38. style: TextStyle(fontSize: 20, fontWeight: FontWeight.w800),
  39. 'MXN 69.00',
  40. )
  41. ],
  42. )
  43. ],
  44. ),
  45. ),
  46. bottomNavigationBar: BottomAppBar(
  47. height: 100,
  48. color: Colors.transparent,
  49. child: Padding(
  50. padding: const EdgeInsets.all(10),
  51. child: Row(
  52. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  53. children: [
  54. TextButton(
  55. style: TextButton.styleFrom(
  56. minimumSize: const Size(170, 200),
  57. backgroundColor: Colors.blue,
  58. foregroundColor: Colors.white,
  59. shape: RoundedRectangleBorder(
  60. borderRadius: BorderRadius.circular(10),
  61. ),
  62. ),
  63. onPressed: (){},
  64. child: const Row(
  65. children: [
  66. Padding(
  67. padding: EdgeInsets.only(bottom: 3),
  68. child: Icon(Icons.fastfood_outlined),
  69. ),
  70. Padding(
  71. padding: EdgeInsets.only(left:8),
  72. child: Text('En el local'),
  73. )
  74. ],
  75. ),
  76. ),
  77. TextButton(
  78. style: TextButton.styleFrom(
  79. minimumSize: const Size(170, 200),
  80. backgroundColor: Colors.blue,
  81. foregroundColor: Colors.white,
  82. shape: RoundedRectangleBorder(
  83. borderRadius: BorderRadius.circular(10),
  84. ),
  85. ),
  86. onPressed: (){
  87. Navigator.of(context).pushNamed('Recojer');
  88. },
  89. child: const Row(
  90. children: [
  91. Padding(
  92. padding: EdgeInsets.only(bottom: 3),
  93. child: Icon(Icons.shopping_bag_outlined),
  94. ),
  95. Padding(
  96. padding: EdgeInsets.only(left:8),
  97. child: Text('Para recojer'),
  98. )
  99. ],
  100. ),
  101. )
  102. ],
  103. ),
  104. ),
  105. ),
  106. body:
  107. Padding(
  108. padding: const EdgeInsets.all(8.0),
  109. child: Column(
  110. children: [
  111. const Padding(
  112. padding: EdgeInsets.all(5),
  113. ),
  114. Row(
  115. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  116. children: [
  117. ClipRRect(
  118. borderRadius: BorderRadius.circular(10),
  119. child: Image.network(
  120. 'https://cdn.pixabay.com/photo/2016/03/05/19/02/hamburger-1238246_960_720.jpg',
  121. width: 80,
  122. height: 80,
  123. fit: BoxFit.cover,
  124. )
  125. ),
  126. const Column(
  127. children: [
  128. Text('1.HAMBURGUESA SENCILLA'),
  129. Text(
  130. style: TextStyle(
  131. fontWeight: FontWeight.bold,
  132. ),
  133. 'MXN 115.00'),
  134. ],
  135. ),
  136. Column(
  137. children: [
  138. Row(
  139. children: [
  140. IconButton(
  141. onPressed: increment,
  142. icon: const Icon(Icons.add),
  143. color: Colors.blue
  144. ),
  145. Text(
  146. "$value"
  147. ),
  148. IconButton(
  149. onPressed: decrement,
  150. icon: const Icon(Icons.remove),
  151. color: Colors.blue
  152. ),
  153. ],
  154. )
  155. ],
  156. ),
  157. ],
  158. ),
  159. ],
  160. ),
  161. ),
  162. );
  163. }
  164. }