fix: use dialog context in product delete confirmation
Navigator.pop(context) with the outer tile context caused go_router to pop the main navigation stack instead of closing the dialog. Use the builder's ctx parameter instead. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -176,16 +176,16 @@ class _ProductTile extends ConsumerWidget {
|
||||
confirmDismiss: (_) async {
|
||||
return await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (_) => AlertDialog(
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: const Text('Удалить продукт?'),
|
||||
content: Text('«${product.name}» будет удалён из списка.'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, false),
|
||||
onPressed: () => Navigator.pop(ctx, false),
|
||||
child: const Text('Отмена'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, true),
|
||||
onPressed: () => Navigator.pop(ctx, true),
|
||||
child: const Text('Удалить'),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user