home_screen.dart 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. import 'package:flutter/material.dart';
  2. import 'package:turquessa_mesas_hoster/utils/widgets/custom_appbar.dart';
  3. import 'package:turquessa_mesas_hoster/core/models/mesas_model.dart';
  4. class HomeScreen extends StatefulWidget {
  5. const HomeScreen({super.key});
  6. @override
  7. Formulario createState() => Formulario();
  8. }
  9. class Formulario extends State<HomeScreen> {
  10. @override
  11. void initState() {
  12. super.initState();
  13. }
  14. @override
  15. Widget build(BuildContext context) {
  16. var _selectedIndex;
  17. return Scaffold(
  18. backgroundColor: Colors.grey.shade200,
  19. appBar: AppBar(
  20. title: const CustomAppbar(),
  21. ),
  22. body: Row(
  23. children: [
  24. NavigationRail(
  25. backgroundColor: Color.fromARGB(255, 25, 30, 41),
  26. selectedIndex: _selectedIndex,
  27. onDestinationSelected: (int index) {
  28. setState(() {
  29. _selectedIndex = index;
  30. });
  31. },
  32. labelType: NavigationRailLabelType.all,
  33. destinations: const [
  34. NavigationRailDestination(
  35. icon: Icon(Icons.home, color: Colors.white),
  36. selectedIcon: Icon(Icons.home_filled),
  37. label: Text('Inicio'),
  38. ),
  39. NavigationRailDestination(
  40. icon: Icon(Icons.search),
  41. selectedIcon: Icon(
  42. Icons.search_rounded,
  43. color: Colors.white,
  44. ),
  45. label: Text('Buscar'),
  46. ),
  47. NavigationRailDestination(
  48. icon: Icon(Icons.settings),
  49. selectedIcon: Icon(Icons.settings_rounded, color: Colors.white),
  50. label: Text('Ajustes'),
  51. ),
  52. ],
  53. ),
  54. Expanded(
  55. child: Center(
  56. child: GridView.builder(
  57. gridDelegate:
  58. const SliverGridDelegateWithFixedCrossAxisCount(
  59. crossAxisCount: 4,
  60. childAspectRatio: 1.0,
  61. crossAxisSpacing: 10.0,
  62. mainAxisSpacing: 10.0),
  63. padding: const EdgeInsets.all(10),
  64. itemCount: 8,
  65. itemBuilder: (context, index) {
  66. return TableCard(
  67. icon: Icons.table_chart,
  68. color: Colors.blue,
  69. title: 'Mesa ${index + 1}',
  70. );
  71. })),
  72. ),
  73. // if (selectedTable != null)
  74. Expanded(
  75. flex: 1,
  76. child: Container(
  77. margin: const EdgeInsets.all(10),
  78. decoration: BoxDecoration(
  79. color: Colors.white,
  80. borderRadius: BorderRadius.circular(10),
  81. boxShadow: [
  82. BoxShadow(
  83. color: Colors.grey.withOpacity(0.2),
  84. blurRadius: 5,
  85. spreadRadius: 1,
  86. )
  87. ],
  88. ),
  89. // child: TablaDetalles(table: selectedTable!),
  90. )),
  91. ],
  92. ),
  93. );
  94. }
  95. }
  96. class TableCard extends StatelessWidget {
  97. final IconData icon;
  98. final Color color;
  99. final String title;
  100. const TableCard(
  101. {super.key,
  102. required this.icon,
  103. required this.color,
  104. required this.title});
  105. @override
  106. Widget build(BuildContext context) {
  107. return Card(
  108. color: color,
  109. child: Column(
  110. mainAxisAlignment: MainAxisAlignment.center,
  111. children: [
  112. Icon(
  113. icon,
  114. size: 50,
  115. color: Colors.white,
  116. ),
  117. Text(
  118. title,
  119. style: const TextStyle(color: Colors.white, fontSize: 20),
  120. )
  121. ],
  122. ),
  123. );
  124. }
  125. }
  126. class TableDetailsPanel extends StatelessWidget {
  127. final TableItem table;
  128. const TableDetailsPanel({
  129. Key? key,
  130. required this.table,
  131. }) : super(key: key);
  132. @override
  133. Widget build(BuildContext context) {
  134. return Column(
  135. crossAxisAlignment: CrossAxisAlignment.start,
  136. children: [
  137. // Encabezado del panel
  138. Container(
  139. padding: const EdgeInsets.all(16),
  140. decoration: BoxDecoration(
  141. borderRadius: const BorderRadius.vertical(top: Radius.circular(10)),
  142. ),
  143. child: Row(
  144. children: [
  145. Icon(Icons.person, color: Colors.white, size: 24),
  146. const SizedBox(width: 8),
  147. Text(
  148. table.name,
  149. style: const TextStyle(
  150. color: Colors.white,
  151. fontSize: 20,
  152. fontWeight: FontWeight.bold,
  153. ),
  154. ),
  155. ],
  156. ),
  157. ),
  158. // Contenido específico según el tipo
  159. ],
  160. );
  161. }
  162. }