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:
dbastrikin
2026-02-22 17:29:55 +02:00
parent c8b8c33bcb
commit 0f2d86efdb

View File

@@ -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('Удалить'),
),
],