fix: use dialog builder context for Navigator.pop in dialogs/sheets
Passing the outer widget context to Navigator.pop() inside a dialog or bottom sheet builder caused GoRouter to pop a page route instead of the modal, triggering the "no pages left to show" assertion. Affects _showChangeDialog and _confirmGenerate in menu_screen.dart, and _showAddMenu bottom sheet in products_screen.dart. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -8,7 +8,7 @@ import 'product_provider.dart';
|
||||
void _showAddMenu(BuildContext context) {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
builder: (_) => SafeArea(
|
||||
builder: (ctx) => SafeArea(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
@@ -16,7 +16,7 @@ void _showAddMenu(BuildContext context) {
|
||||
leading: const Icon(Icons.edit_outlined),
|
||||
title: const Text('Добавить вручную'),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
Navigator.pop(ctx);
|
||||
context.push('/products/add');
|
||||
},
|
||||
),
|
||||
@@ -24,7 +24,7 @@ void _showAddMenu(BuildContext context) {
|
||||
leading: const Icon(Icons.document_scanner_outlined),
|
||||
title: const Text('Сканировать чек или фото'),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
Navigator.pop(ctx);
|
||||
context.push('/scan');
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user