feat: show dish recognition result as bottom sheet on home screen
Remove "Определить блюдо" from ScanScreen and the /scan/dish route. The + button on each meal card now triggers dish recognition inline — picks image, shows loading dialog, then presents DishResultSheet as a modal bottom sheet. After adding to diary the sheet closes and the user stays on home. Also fix Navigator.pop crash: showDialog uses the root navigator by default, so capture Navigator.of(context, rootNavigator: true) before the async gap and use it to close the loading dialog. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -13,7 +13,6 @@ import '../../features/products/products_screen.dart';
|
||||
import '../../features/products/add_product_screen.dart';
|
||||
import '../../features/scan/scan_screen.dart';
|
||||
import '../../features/scan/recognition_confirm_screen.dart';
|
||||
import '../../features/scan/dish_result_screen.dart';
|
||||
import '../../features/scan/recognition_service.dart';
|
||||
import '../../features/menu/diary_screen.dart';
|
||||
import '../../features/menu/menu_screen.dart';
|
||||
@@ -150,16 +149,6 @@ final routerProvider = Provider<GoRouter>((ref) {
|
||||
return RecognitionConfirmScreen(items: items);
|
||||
},
|
||||
),
|
||||
GoRoute(
|
||||
path: '/scan/dish',
|
||||
builder: (context, state) {
|
||||
final extra = state.extra as Map<String, dynamic>?;
|
||||
final dish = extra?['dish'] as DishResult?;
|
||||
final mealType = extra?['meal_type'] as String?;
|
||||
if (dish == null) return const _InvalidRoute();
|
||||
return DishResultScreen(dish: dish, preselectedMealType: mealType);
|
||||
},
|
||||
),
|
||||
ShellRoute(
|
||||
builder: (context, state, child) => MainShell(child: child),
|
||||
routes: [
|
||||
|
||||
Reference in New Issue
Block a user