diff --git a/lib/pages/tables.dart b/lib/pages/tables.dart index 6afd7c0..488a825 100644 --- a/lib/pages/tables.dart +++ b/lib/pages/tables.dart @@ -1,7 +1,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; -import 'dart:convert'; +import 'dart:convert'; import 'menu.dart'; // Assure-toi que ce fichier contient la page MenuPage @@ -230,7 +230,7 @@ class _TablesScreenState extends State { final screenWidth = MediaQuery.of(context).size.width; final isDesktop = screenWidth >= 768; - int crossAxisCount = 2; + int crossAxisCount = 1; if (screenWidth > 1200) { crossAxisCount = 4; } else if (screenWidth > 800) { @@ -446,39 +446,54 @@ class _TablesScreenState extends State { SizedBox( width: double.infinity, child: ElevatedButton( - onPressed: isSelectable - ? () { - // Affiche un message - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text('Table ${table.nom} sélectionnée'), - ), - ); - - // Redirige vers MenuPage avec les paramètres requis - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => MenuPage( - tableId: table.id, - personne: table.capacity, // Ajout du paramètre manquant + onPressed: + isSelectable + ? () { + // Affiche un message + ScaffoldMessenger.of( + context, + ).showSnackBar( + SnackBar( + content: Text( + 'Table ${table.nom} sélectionnée', + ), ), - ), - ); - } - : null, + ); + + // Redirige vers MenuPage avec les paramètres requis + Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => MenuPage( + tableId: table.id, + personne: + table + .capacity, // Ajout du paramètre manquant + ), + ), + ); + } + : null, style: ElevatedButton.styleFrom( - backgroundColor: isSelectable - ? Colors.green.shade700 - : Colors.grey.shade300, + backgroundColor: + isSelectable + ? Colors.green.shade700 + : Colors.grey.shade300, foregroundColor: Colors.white, - padding: const EdgeInsets.symmetric(vertical: 8), + padding: const EdgeInsets.symmetric( + vertical: 8, + ), shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), + borderRadius: BorderRadius.circular( + 8, + ), ), ), child: Text( - isSelectable ? 'Sélectionner' : 'Indisponible', + isSelectable + ? 'Sélectionner' + : 'Indisponible', style: const TextStyle( color: Colors.white, fontSize: 12, @@ -665,4 +680,4 @@ class _AddEditTableDialogState extends State<_AddEditTableDialog> { ], ); } -} \ No newline at end of file +}