creacion_pedido_screen.dart 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. import 'package:flutter/material.dart';
  2. import 'package:provider/provider.dart';
  3. import 'package:turquessa_mesas_hoster/core/models/producto_model.dart';
  4. import 'package:turquessa_mesas_hoster/mvvm/viewmodels/creacion_pedido_view_model.dart';
  5. import 'package:turquessa_mesas_hoster/utils/widgets/custom_appbar.dart';
  6. import 'package:turquessa_mesas_hoster/utils/widgets/navigation_rail.dart';
  7. class CreacionPedido extends StatefulWidget {
  8. const CreacionPedido({super.key});
  9. @override
  10. State<CreacionPedido> createState() => _CreacionPedidoState();
  11. }
  12. class _CreacionPedidoState extends State<CreacionPedido> {
  13. @override
  14. void initState() {
  15. // TODO: implement initState
  16. super.initState();
  17. }
  18. final _selectedIndex = 0;
  19. @override
  20. Widget build(BuildContext context) {
  21. CreacionPedidoViewModel creacionPedidoViewModel =
  22. Provider.of<CreacionPedidoViewModel>(context, listen: false);
  23. List<Producto> listaPedido = creacionPedidoViewModel.pedidosProvisionales;
  24. return Container(
  25. decoration: const BoxDecoration(
  26. gradient: LinearGradient(
  27. begin: Alignment.bottomRight,
  28. end: Alignment.topLeft,
  29. colors: [
  30. Color(0xFF7FD4D4),
  31. Color.fromARGB(255, 141, 225, 225),
  32. Color.fromARGB(255, 74, 156, 156),
  33. ])),
  34. child: Scaffold(
  35. backgroundColor: Colors.transparent,
  36. appBar: AppBar(
  37. title: const CustomAppbar(),
  38. ),
  39. body: Row(
  40. children: [
  41. CustomNavigationRail(selectedIndex: _selectedIndex),
  42. Expanded(
  43. flex: 5,
  44. child: Container(
  45. decoration: const BoxDecoration(
  46. color: Colors.white,
  47. ),
  48. child: const Column(
  49. children: [
  50. CategoryFilters(),
  51. CategoryGrid(),
  52. ],
  53. ),
  54. ),
  55. ),
  56. Expanded(
  57. flex: 4,
  58. child: Container(
  59. decoration: const BoxDecoration(
  60. color: Colors.white,
  61. ),
  62. child: Padding(
  63. padding: const EdgeInsets.all(8.0),
  64. child: Column(
  65. crossAxisAlignment: CrossAxisAlignment.start,
  66. children: [
  67. const Padding(
  68. padding: EdgeInsets.only(left: 10),
  69. child: Text(
  70. "Mesa 3: Palmeras",
  71. textAlign: TextAlign.start,
  72. style: TextStyle(
  73. fontSize: 40,
  74. fontWeight: FontWeight.bold,
  75. color: Colors.black),
  76. ),
  77. ),
  78. const Divider(),
  79. SingleChildScrollView(
  80. child: DataTable(
  81. columnSpacing: 10,
  82. dataRowMinHeight: 40,
  83. dataRowMaxHeight: 80,
  84. columns: const <DataColumn>[
  85. DataColumn(label: Text('Cant')),
  86. DataColumn(label: Text('Nombre')),
  87. DataColumn(label: Text('SubTotal')),
  88. DataColumn(label: Text('Acciones')),
  89. ],
  90. rows: <DataRow>[
  91. DataRow(selected: true, cells: <DataCell>[
  92. const DataCell(Text('1')),
  93. const DataCell(Text('Mesa 1')),
  94. const DataCell(Text('\$100.00')),
  95. DataCell(IconButton(
  96. icon: const Icon(Icons.pending_sharp),
  97. onPressed: () {}))
  98. ]),
  99. // DataRow(cells: <DataCell>[
  100. // const DataCell(Text('1')),
  101. // const DataCell(Text(
  102. // 'Hamburguesa de Queso y Ahumado sin cebolla ni tomate')),
  103. // const DataCell(Text("\$100.00")),
  104. // DataCell(IconButton(
  105. // icon: const Icon(Icons.pending_sharp),
  106. // onPressed: () {}))
  107. // ]),
  108. // DataRow(cells: <DataCell>[
  109. // const DataCell(Text('1')),
  110. // const DataCell(Text(
  111. // 'Hamburguesa de Queso y Ahumado sin cebolla ni tomate')),
  112. // const DataCell(Text("\$100.00")),
  113. // DataCell(IconButton(
  114. // icon: const Icon(Icons.pending_sharp),
  115. // onPressed: () {}))
  116. // ]),
  117. // DataRow(cells: <DataCell>[
  118. // const DataCell(Text('1')),
  119. // const DataCell(Text(
  120. // 'Hamburguesa de Queso y Ahumado sin cebolla ni tomate')),
  121. // const DataCell(Text("\$100.00")),
  122. // DataCell(IconButton(
  123. // icon: const Icon(Icons.pending_sharp),
  124. // onPressed: () {}))
  125. // ]),
  126. ]),
  127. ),
  128. Expanded(
  129. child: Column(
  130. children: [
  131. const Divider(),
  132. const Row(
  133. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  134. children: [
  135. Text(
  136. "Total",
  137. style: TextStyle(
  138. fontSize: 20,
  139. fontWeight: FontWeight.bold),
  140. ),
  141. Text(
  142. "\$300.00",
  143. style: TextStyle(
  144. fontSize: 20,
  145. fontWeight: FontWeight.bold),
  146. ),
  147. ],
  148. ),
  149. const SizedBox(height: 10),
  150. Row(
  151. children: [
  152. Expanded(
  153. flex: 9,
  154. child: ElevatedButton(
  155. style: const ButtonStyle(
  156. backgroundColor: MaterialStatePropertyAll(
  157. Colors.green),
  158. ),
  159. onPressed: () {},
  160. child: const Text(
  161. "Mandar a Preparacion",
  162. style: TextStyle(color: Colors.white),
  163. ),
  164. ),
  165. ),
  166. Expanded(
  167. flex: 1,
  168. child: IconButton(
  169. style: const ButtonStyle(
  170. backgroundColor:
  171. MaterialStatePropertyAll(
  172. Colors.white),
  173. iconColor: MaterialStatePropertyAll(
  174. Colors.red)),
  175. icon: const Icon(
  176. Icons.delete,
  177. color: Colors.red,
  178. ),
  179. onPressed: () {},
  180. ),
  181. ),
  182. ],
  183. )
  184. ],
  185. ),
  186. )
  187. ],
  188. ),
  189. ),
  190. ),
  191. )
  192. ],
  193. ),
  194. ),
  195. );
  196. }
  197. }
  198. class CategoryGrid extends StatelessWidget {
  199. const CategoryGrid({
  200. super.key,
  201. });
  202. @override
  203. Widget build(BuildContext context) {
  204. return Expanded(
  205. child: Container(
  206. padding: const EdgeInsets.all(8),
  207. child: GridView.builder(
  208. gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
  209. crossAxisCount: 4,
  210. crossAxisSpacing: 10,
  211. mainAxisSpacing: 15,
  212. ),
  213. itemCount: 20,
  214. itemBuilder: (context, index) {
  215. return Card(
  216. shadowColor: Colors.grey.shade700,
  217. surfaceTintColor: Colors.white,
  218. child: Column(children: [
  219. Padding(
  220. padding: const EdgeInsets.all(3),
  221. child: Container(
  222. height: 80,
  223. width: double.infinity,
  224. decoration: BoxDecoration(
  225. color: Colors.white,
  226. image: DecorationImage(
  227. image: NetworkImage(
  228. "https://picsum.photos/200/300?random=$index"),
  229. fit: BoxFit.cover,
  230. ),
  231. ),
  232. ),
  233. ),
  234. Center(
  235. child: Text(
  236. "Producto $index",
  237. style: const TextStyle(
  238. fontWeight: FontWeight.bold,
  239. fontSize: 16,
  240. color: Colors.black),
  241. ),
  242. ),
  243. const Text("Precio: \$50.00")
  244. ]),
  245. );
  246. },
  247. ),
  248. ),
  249. );
  250. }
  251. }
  252. class CategoryFilters extends StatefulWidget {
  253. const CategoryFilters({super.key});
  254. @override
  255. State<CategoryFilters> createState() => CategoryFiltersState();
  256. }
  257. class CategoryFiltersState extends State<CategoryFilters> {
  258. @override
  259. Widget build(BuildContext context) {
  260. return Container(
  261. padding: const EdgeInsets.all(8),
  262. decoration: BoxDecoration(
  263. border: Border(bottom: BorderSide(color: Colors.grey.shade300)),
  264. ),
  265. child: Row(
  266. children: [
  267. // Buscador
  268. Expanded(
  269. child: Container(
  270. height: 40,
  271. padding: const EdgeInsets.symmetric(horizontal: 12),
  272. decoration: BoxDecoration(
  273. color: Colors.grey.shade200,
  274. borderRadius: BorderRadius.circular(20),
  275. ),
  276. child: Row(
  277. children: [
  278. Icon(Icons.search, color: Colors.grey.shade600),
  279. const SizedBox(width: 8),
  280. Text('Buscar', style: TextStyle(color: Colors.grey.shade600)),
  281. ],
  282. ),
  283. ),
  284. ),
  285. const SizedBox(width: 10),
  286. // Botones de filtro
  287. _FilterButtonPLaceHolder('Categoría'),
  288. const SizedBox(width: 10),
  289. _FilterButtonPLaceHolder('Topics'),
  290. const SizedBox(width: 10),
  291. _FilterButtonPLaceHolder('Extras'),
  292. ],
  293. ),
  294. );
  295. }
  296. }
  297. Widget _FilterButtonPLaceHolder(String text) {
  298. return Container(
  299. padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
  300. decoration: BoxDecoration(
  301. color: Colors.grey.shade200,
  302. borderRadius: BorderRadius.circular(4),
  303. ),
  304. child: Text(text, style: const TextStyle(fontSize: 16)),
  305. );
  306. }