payfrit-app/lib/screens/order_home_screen.dart
2025-12-28 12:28:45 -08:00

66 lines
1.9 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import "package:flutter/material.dart";
import "package:provider/provider.dart";
import "../app/app_router.dart";
import "../app/app_state.dart";
class OrderHomeScreen extends StatelessWidget {
const OrderHomeScreen({super.key});
@override
Widget build(BuildContext context) {
final state = context.watch<AppState>();
if (!state.hasLocationSelection) {
// Defensive: if state is cleared, bounce back.
WidgetsBinding.instance.addPostFrameCallback((_) {
if (!context.mounted) return;
Navigator.of(context).pushNamedAndRemoveUntil(
AppRoutes.restaurantSelect,
(route) => false,
);
});
}
return Scaffold(
appBar: AppBar(
title: const Text("PAYFRIT"),
actions: [
IconButton(
tooltip: "Change location",
onPressed: () {
context.read<AppState>().clearAll();
Navigator.of(context).pushNamedAndRemoveUntil(
AppRoutes.restaurantSelect,
(route) => false,
);
},
icon: const Icon(Icons.location_off),
),
],
),
body: Center(
child: Padding(
padding: const EdgeInsets.all(18),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const Text(
"MVP Scaffold",
style: TextStyle(fontSize: 20, fontWeight: FontWeight.w700),
),
const SizedBox(height: 12),
Text("BusinessID: ${state.selectedBusinessId ?? "-"}"),
Text("ServicePointID: ${state.selectedServicePointId ?? "-"}"),
const SizedBox(height: 18),
const Text(
"Next: menu + cart + order submission.\n(Well carry ServicePointID through every request.)",
textAlign: TextAlign.center,
),
],
),
),
),
);
}
}