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(); 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().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(We’ll carry ServicePointID through every request.)", textAlign: TextAlign.center, ), ], ), ), ), ); } }