123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- import 'package:flutter/material.dart';
- import 'package:turquessa_mesas_hoster/utils/widgets/custom_appbar.dart';
- import 'package:turquessa_mesas_hoster/core/models/mesas_model.dart';
- class HomeScreen extends StatefulWidget {
- const HomeScreen({super.key});
- @override
- Formulario createState() => Formulario();
- }
- class Formulario extends State<HomeScreen> {
- @override
- void initState() {
- super.initState();
- }
- @override
- Widget build(BuildContext context) {
- var _selectedIndex;
- return Scaffold(
- backgroundColor: Colors.grey.shade200,
- appBar: AppBar(
- title: const CustomAppbar(),
- ),
- body: Row(
- children: [
- NavigationRail(
- backgroundColor: Color.fromARGB(255, 25, 30, 41),
- selectedIndex: _selectedIndex,
- onDestinationSelected: (int index) {
- setState(() {
- _selectedIndex = index;
- });
- },
- labelType: NavigationRailLabelType.all,
- destinations: const [
- NavigationRailDestination(
- icon: Icon(Icons.home, color: Colors.white),
- selectedIcon: Icon(Icons.home_filled),
- label: Text('Inicio'),
- ),
- NavigationRailDestination(
- icon: Icon(Icons.search),
- selectedIcon: Icon(
- Icons.search_rounded,
- color: Colors.white,
- ),
- label: Text('Buscar'),
- ),
- NavigationRailDestination(
- icon: Icon(Icons.settings),
- selectedIcon: Icon(Icons.settings_rounded, color: Colors.white),
- label: Text('Ajustes'),
- ),
- ],
- ),
- Expanded(
- child: Center(
- child: GridView.builder(
- gridDelegate:
- const SliverGridDelegateWithFixedCrossAxisCount(
- crossAxisCount: 4,
- childAspectRatio: 1.0,
- crossAxisSpacing: 10.0,
- mainAxisSpacing: 10.0),
- padding: const EdgeInsets.all(10),
- itemCount: 8,
- itemBuilder: (context, index) {
- return TableCard(
- icon: Icons.table_chart,
- color: Colors.blue,
- title: 'Mesa ${index + 1}',
- );
- })),
- ),
- // if (selectedTable != null)
- Expanded(
- flex: 1,
- child: Container(
- margin: const EdgeInsets.all(10),
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.circular(10),
- boxShadow: [
- BoxShadow(
- color: Colors.grey.withOpacity(0.2),
- blurRadius: 5,
- spreadRadius: 1,
- )
- ],
- ),
- // child: TablaDetalles(table: selectedTable!),
- )),
- ],
- ),
- );
- }
- }
- class TableCard extends StatelessWidget {
- final IconData icon;
- final Color color;
- final String title;
- const TableCard(
- {super.key,
- required this.icon,
- required this.color,
- required this.title});
- @override
- Widget build(BuildContext context) {
- return Card(
- color: color,
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Icon(
- icon,
- size: 50,
- color: Colors.white,
- ),
- Text(
- title,
- style: const TextStyle(color: Colors.white, fontSize: 20),
- )
- ],
- ),
- );
- }
- }
- class TableDetailsPanel extends StatelessWidget {
- final TableItem table;
- const TableDetailsPanel({
- Key? key,
- required this.table,
- }) : super(key: key);
- @override
- Widget build(BuildContext context) {
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- // Encabezado del panel
- Container(
- padding: const EdgeInsets.all(16),
- decoration: BoxDecoration(
- borderRadius: const BorderRadius.vertical(top: Radius.circular(10)),
- ),
- child: Row(
- children: [
- Icon(Icons.person, color: Colors.white, size: 24),
- const SizedBox(width: 8),
- Text(
- table.name,
- style: const TextStyle(
- color: Colors.white,
- fontSize: 20,
- fontWeight: FontWeight.bold,
- ),
- ),
- ],
- ),
- ),
- // Contenido específico según el tipo
- ],
- );
- }
- }
|