|
@@ -3,6 +3,7 @@ import 'package:provider/provider.dart';
|
|
|
import 'package:turquessa_mesas_hoster/core/models/mesa_model.dart';
|
|
|
import 'package:turquessa_mesas_hoster/utils/widgets/custom_appbar.dart';
|
|
|
import 'package:turquessa_mesas_hoster/utils/widgets/custom_card.dart';
|
|
|
+import 'package:turquessa_mesas_hoster/utils/widgets/get_status_style.dart';
|
|
|
import 'package:turquessa_mesas_hoster/utils/widgets/navigation_rail.dart';
|
|
|
|
|
|
import '../../../utils/widgets/ordenes_card.dart';
|
|
@@ -134,10 +135,11 @@ class TablaDetalles extends StatelessWidget {
|
|
|
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
+ final mesaViewModel = Provider.of<MesaViewModel>(context, listen: true);
|
|
|
+ final style = getStatusStyle(status);
|
|
|
return Container(
|
|
|
- padding: const EdgeInsets.all(10),
|
|
|
decoration: BoxDecoration(
|
|
|
- color: Colors.white,
|
|
|
+ color: Color.fromARGB(255, 247, 249, 250),
|
|
|
boxShadow: [
|
|
|
BoxShadow(
|
|
|
color: Colors.grey.withOpacity(0.2),
|
|
@@ -152,9 +154,7 @@ class TablaDetalles extends StatelessWidget {
|
|
|
Container(
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
decoration: BoxDecoration(
|
|
|
- color: table.activa! ? Colors.blue : Colors.grey,
|
|
|
- borderRadius:
|
|
|
- const BorderRadius.vertical(top: Radius.circular(10)),
|
|
|
+ color: style.iconColor,
|
|
|
),
|
|
|
child: Row(
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
@@ -208,11 +208,16 @@ class TablaDetalles extends StatelessWidget {
|
|
|
color: Colors.white.withOpacity(0.2),
|
|
|
borderRadius: BorderRadius.circular(20),
|
|
|
),
|
|
|
- child: Text(table.activa! ? 'Activa' : 'Inactiva',
|
|
|
- style: const TextStyle(
|
|
|
- color: Colors.white,
|
|
|
- fontWeight: FontWeight.bold,
|
|
|
- )),
|
|
|
+ child: GestureDetector(
|
|
|
+ onTap: () {
|
|
|
+ mesaViewModel.cambiarEstadoPedidoMesa(style.nextStatus);
|
|
|
+ },
|
|
|
+ child: Text(table.activa! ? 'Activa' : 'Inactiva',
|
|
|
+ style: const TextStyle(
|
|
|
+ color: Colors.white,
|
|
|
+ fontWeight: FontWeight.bold,
|
|
|
+ )),
|
|
|
+ ),
|
|
|
),
|
|
|
],
|
|
|
),
|
|
@@ -227,13 +232,13 @@ class TablaDetalles extends StatelessWidget {
|
|
|
children: [
|
|
|
Row(
|
|
|
children: [
|
|
|
- Text(
|
|
|
- "Estatus: ${status.toString().split('.').last}",
|
|
|
- style: const TextStyle(
|
|
|
- fontWeight: FontWeight.bold,
|
|
|
- color: Colors.black,
|
|
|
- ),
|
|
|
- ),
|
|
|
+ // Text(
|
|
|
+ // "Estatus: ${status.toString().split('.').last}",
|
|
|
+ // style: const TextStyle(
|
|
|
+ // fontWeight: FontWeight.bold,
|
|
|
+ // color: Colors.black,
|
|
|
+ // ),
|
|
|
+ // ),
|
|
|
],
|
|
|
),
|
|
|
// const SizedBox(height: 16),
|
|
@@ -243,13 +248,6 @@ class TablaDetalles extends StatelessWidget {
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
decoration: BoxDecoration(
|
|
|
color: Colors.white,
|
|
|
- boxShadow: [
|
|
|
- BoxShadow(
|
|
|
- color: Colors.grey.withOpacity(0.2),
|
|
|
- blurRadius: 1,
|
|
|
- spreadRadius: 1,
|
|
|
- )
|
|
|
- ],
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
border: Border.all(color: Colors.grey.shade200),
|
|
|
),
|
|
@@ -260,6 +258,7 @@ class TablaDetalles extends StatelessWidget {
|
|
|
const Text("Pedido Actual",
|
|
|
style: TextStyle(
|
|
|
fontWeight: FontWeight.bold,
|
|
|
+ fontSize: 20,
|
|
|
color: Colors.black,
|
|
|
)),
|
|
|
GestureDetector(
|
|
@@ -268,8 +267,8 @@ class TablaDetalles extends StatelessWidget {
|
|
|
.pushNamed('creacion-pedido');
|
|
|
},
|
|
|
child: const Row(children: [
|
|
|
- const Text("Ver detalle"),
|
|
|
- const Icon(Icons.arrow_forward_ios_rounded),
|
|
|
+ Text("Ver detalle"),
|
|
|
+ Icon(Icons.arrow_forward_ios_rounded),
|
|
|
]),
|
|
|
)
|
|
|
]),
|
|
@@ -291,6 +290,23 @@ class TablaDetalles extends StatelessWidget {
|
|
|
precio: "15.20",
|
|
|
cantidad: 1,
|
|
|
),
|
|
|
+ const SizedBox(height: 10),
|
|
|
+ const Divider(),
|
|
|
+ const Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
+ children: [
|
|
|
+ Text(
|
|
|
+ "Total",
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 20, fontWeight: FontWeight.bold),
|
|
|
+ ),
|
|
|
+ Text(
|
|
|
+ "\$45.60",
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 20, fontWeight: FontWeight.bold),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ )
|
|
|
]),
|
|
|
),
|
|
|
|
|
@@ -316,63 +332,26 @@ class TableCard extends StatelessWidget {
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
final status = mesa.estado ?? EstadoPedido.disponible;
|
|
|
+ final mesaViewModel = Provider.of<MesaViewModel>(context, listen: true);
|
|
|
|
|
|
- Color backgroundColor;
|
|
|
- Color iconColor;
|
|
|
- IconData icon;
|
|
|
- Color cardColor;
|
|
|
-
|
|
|
- switch (status) {
|
|
|
- case EstadoPedido.disponible:
|
|
|
- backgroundColor = const Color.fromARGB(255, 220, 252, 232);
|
|
|
- iconColor = Colors.green;
|
|
|
- icon = Icons.table_restaurant_rounded;
|
|
|
- cardColor = const Color.fromARGB(255, 220, 252, 232);
|
|
|
- break;
|
|
|
- case EstadoPedido.surtida:
|
|
|
- backgroundColor = const Color.fromARGB(255, 220, 234, 254);
|
|
|
- iconColor = Colors.blue;
|
|
|
- icon = Icons.coffee_rounded;
|
|
|
- cardColor = const Color.fromARGB(255, 220, 234, 254);
|
|
|
- break;
|
|
|
- case EstadoPedido.preparacion:
|
|
|
- backgroundColor = const Color.fromARGB(255, 243, 232, 255);
|
|
|
- iconColor = Colors.deepPurple;
|
|
|
- icon = Icons.kitchen_rounded;
|
|
|
- cardColor = const Color.fromARGB(255, 243, 232, 255);
|
|
|
- break;
|
|
|
- case EstadoPedido.cobrado:
|
|
|
- backgroundColor = const Color.fromARGB(255, 255, 238, 213);
|
|
|
- iconColor = Colors.amber;
|
|
|
- icon = Icons.attach_money_rounded;
|
|
|
- cardColor = const Color.fromARGB(255, 255, 238, 213);
|
|
|
- break;
|
|
|
- default:
|
|
|
- backgroundColor = Colors.grey.shade200;
|
|
|
- iconColor = Colors.grey;
|
|
|
- icon = Icons.settings;
|
|
|
- cardColor = Colors.white;
|
|
|
- break;
|
|
|
- }
|
|
|
+ final style = getStatusStyle(status);
|
|
|
|
|
|
return Card(
|
|
|
- color: cardColor,
|
|
|
+ borderOnForeground: false,
|
|
|
+ color: style.cardColor,
|
|
|
child: Column(
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
children: [
|
|
|
IconButton(
|
|
|
onPressed: () {
|
|
|
- if (status == EstadoPedido.disponible) {
|
|
|
- final mesaViewModel =
|
|
|
- Provider.of<MesaViewModel>(context, listen: false);
|
|
|
- mesaViewModel.CambiarEstadoPedidoMesa(EstadoPedido.preparacion);
|
|
|
- }
|
|
|
+ mesaViewModel.cambiarEstadoPedidoMesa(style.nextStatus);
|
|
|
+ print('Cambiando estado de la mesa ${style.nextStatus}');
|
|
|
},
|
|
|
iconSize: 48,
|
|
|
style: ButtonStyle(
|
|
|
- backgroundColor: MaterialStateProperty.all(backgroundColor),
|
|
|
+ backgroundColor: MaterialStateProperty.all(style.backgroundColor),
|
|
|
),
|
|
|
- icon: Icon(icon, color: iconColor),
|
|
|
+ icon: Icon(style.icon, color: style.iconColor),
|
|
|
),
|
|
|
const SizedBox(height: 8),
|
|
|
Text(
|
|
@@ -384,6 +363,20 @@ class TableCard extends StatelessWidget {
|
|
|
fontSize: 20,
|
|
|
fontWeight: FontWeight.w500,
|
|
|
),
|
|
|
+ ),
|
|
|
+ Container(
|
|
|
+ padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: style.backgroundColor,
|
|
|
+ borderRadius: BorderRadius.circular(20),
|
|
|
+ ),
|
|
|
+ child: Text(
|
|
|
+ status.toString().split('.').last,
|
|
|
+ style: TextStyle(
|
|
|
+ color: style.iconColor,
|
|
|
+ fontWeight: FontWeight.bold,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
)
|
|
|
],
|
|
|
),
|