app_drawer.dart 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. // ignore_for_file: must_be_immutable
  2. import 'package:flutter/material.dart';
  3. import 'package:olivamia_pos/views/descuento/descuento_screen.dart';
  4. import '../models/models.dart';
  5. import '../models/usuario_model.dart';
  6. import 'package:provider/provider.dart';
  7. import '../themes/themes.dart';
  8. import '../views/categoria_producto/categoria_producto_screen.dart';
  9. import '../views/pedido/pedido_screen.dart';
  10. import '../views/producto/producto_screen.dart';
  11. import '../views/variable/variable_screen.dart';
  12. import '../views/venta/venta_screen.dart';
  13. import 'widgets_components.dart';
  14. class AppDrawer extends StatelessWidget {
  15. AppDrawer({super.key});
  16. // Future<bool> _showExitConfirmationDialog(BuildContext context) async {
  17. // bool shouldPop = false;
  18. // await showDialog(
  19. // context: context,
  20. // builder: (context) => AlertDialog(
  21. // surfaceTintColor: AppTheme.secondary,
  22. // title: const Text('¿Cerrar sesión?'),
  23. // content: const Text('¿Estás seguro de que quieres cerrar la sesión?'),
  24. // actions: [
  25. // TextButton(
  26. // onPressed: () => Navigator.of(context).pop(false),
  27. // child: const Text('Cancelar', style: TextStyle(color: Colors.red)),
  28. // ),
  29. // TextButton(
  30. // onPressed: () {
  31. // Navigator.pop(context);
  32. // Navigator.pop(context);
  33. // Provider.of<LoginViewModel>(context, listen: false).logOut();
  34. // Navigator.of(context)
  35. // .pushNamedAndRemoveUntil('main', (route) => false);
  36. // },
  37. // child: const Text('Aceptar'),
  38. // ),
  39. // ],
  40. // ),
  41. // );
  42. // return shouldPop;
  43. // }
  44. @override
  45. Widget build(BuildContext context) {
  46. // String? nombre = Provider.of<LoginViewModel>(context).nombre.toString();
  47. // String? correo = Provider.of<LoginViewModel>(context).correo.toString();
  48. //final avm = Provider.of<AdministracionViewModel>(context);
  49. //List<String> permisos = avm.lospermisos;
  50. return Drawer(
  51. surfaceTintColor: Colors.white,
  52. backgroundColor: Colors.white,
  53. child: Column(
  54. children: [
  55. Container(
  56. width: double.infinity,
  57. decoration: BoxDecoration(
  58. color: AppTheme.primary,
  59. ),
  60. padding: EdgeInsets.only(
  61. top: MediaQuery.of(context).padding.top,
  62. ),
  63. child: const Column(
  64. children: [
  65. Padding(
  66. padding: EdgeInsets.all(8.0),
  67. child: Image(
  68. image: AssetImage('assets/OlivaLogo-WH.png'),
  69. height: 150,
  70. ),
  71. ),
  72. SizedBox(
  73. height: 10,
  74. ),
  75. // Text(
  76. // nombre.toString(),
  77. // style: const TextStyle(
  78. // fontSize: 18,
  79. // fontWeight: FontWeight.bold,
  80. // ),
  81. // ),
  82. // const SizedBox(
  83. // height: 10,
  84. // ),
  85. // Text(
  86. // correo.toString(),
  87. // style: const TextStyle(
  88. // fontSize: 15,
  89. // fontWeight: FontWeight.bold,
  90. // ),
  91. // ),
  92. SizedBox(
  93. height: 10,
  94. ),
  95. ],
  96. ),
  97. ),
  98. //HEADER
  99. Expanded(
  100. child: ListView(children: [
  101. ListTile(
  102. leading: circulo(const Icon(Icons.restaurant_menu)),
  103. title: const Text('Pedidos'),
  104. onTap: () => {
  105. Navigator.pop(context),
  106. Navigator.of(context).push(
  107. MaterialPageRoute(
  108. builder: (context) => const PedidoScreen(),
  109. ),
  110. ),
  111. },
  112. ),
  113. ListTile(
  114. leading: circulo(const Icon(Icons.menu_book_rounded)),
  115. title: const Text('Productos'),
  116. onTap: () => {
  117. Navigator.pop(context),
  118. Navigator.of(context).push(
  119. MaterialPageRoute(
  120. builder: (context) => ProductoScreen(),
  121. ),
  122. ),
  123. },
  124. ),
  125. ListTile(
  126. leading: circulo(const Icon(Icons.format_list_bulleted_rounded)),
  127. title: const Text('Categoría Producto'),
  128. onTap: () => {
  129. Navigator.pop(context),
  130. Navigator.of(context).push(
  131. MaterialPageRoute(
  132. builder: (context) => CategoriaProductoScreen(),
  133. ),
  134. ),
  135. },
  136. ),
  137. ListTile(
  138. leading: circulo(const Icon(Icons.receipt_long_outlined)),
  139. title: const Text('Pedidos Por Día'),
  140. onTap: () => {
  141. Navigator.pop(context),
  142. Navigator.of(context).push(
  143. MaterialPageRoute(
  144. builder: (context) => VentaScreen(),
  145. ),
  146. ),
  147. },
  148. ),
  149. ExpansionTile(
  150. leading: circulo(const Icon(Icons.admin_panel_settings)),
  151. title: const Text('Administración'),
  152. children: [
  153. ListTile(
  154. leading: circulo(const Icon(Icons.discount)),
  155. title: const Text('Descuentos'),
  156. onTap: () => {
  157. Navigator.pop(context),
  158. Navigator.of(context).push(
  159. MaterialPageRoute(
  160. builder: (context) => DescuentoScreen(),
  161. ),
  162. ),
  163. },
  164. ),
  165. ListTile(
  166. leading: circulo(const Icon(Icons.discount)),
  167. title: const Text('Variables'),
  168. onTap: () => {
  169. Navigator.pop(context),
  170. Navigator.of(context).push(
  171. MaterialPageRoute(
  172. builder: (context) => VariablesScreen(),
  173. ),
  174. ),
  175. },
  176. ),
  177. ],
  178. ),
  179. // ListTile(
  180. // leading: const Icon(Icons.logout),
  181. // title: const Text('Cerrar sesión'),
  182. // onTap: () {
  183. // _showExitConfirmationDialog(context);
  184. // },
  185. // ),
  186. ])),
  187. const Padding(
  188. padding: EdgeInsets.only(bottom: 10),
  189. child: Align(
  190. alignment: Alignment.bottomCenter,
  191. child: Text(
  192. 'v1.24.08.16',
  193. style: TextStyle(fontWeight: FontWeight.w300),
  194. ),
  195. ))
  196. ],
  197. ),
  198. );
  199. }
  200. }