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