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