Skip to content

Commit

Permalink
chore: dont use await for removal dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
Merrit committed Aug 8, 2024
1 parent e1c60a8 commit caa1139
Showing 1 changed file with 26 additions and 29 deletions.
55 changes: 26 additions & 29 deletions lib/calculator/widgets/sheet_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,35 +110,32 @@ class _SheetSettingsViewState extends State<SheetSettingsView> {
void showConfirmRemovalDialog(BuildContext context, Sheet sheet) {
final calcCubit = context.read<CalculatorCubit>();

Future.delayed(
const Duration(seconds: 0),
() => showDialog(
context: context,
builder: (context) {
return AlertDialog(
content: Text('Remove sheet "${sheet.name}?"'),
actions: [
TextButton(
onPressed: () {
calcCubit.removeSheet(sheet);
Navigator.pushNamedAndRemoveUntil(
context,
CalculatorPage.id,
(route) => false,
);
},
child: const Text(
'REMOVE',
style: TextStyle(color: Colors.red),
),
),
TextButton(
onPressed: () => Navigator.pop(context),
child: const Text('CLOSE'),
showDialog(
context: context,
builder: (context) {
return AlertDialog(
content: Text('Remove sheet "${sheet.name}?"'),
actions: [
TextButton(
onPressed: () {
calcCubit.removeSheet(sheet);
Navigator.pushNamedAndRemoveUntil(
context,
CalculatorPage.id,
(route) => false,
);
},
child: const Text(
'REMOVE',
style: TextStyle(color: Colors.red),
),
],
);
},
),
),
TextButton(
onPressed: () => Navigator.pop(context),
child: const Text('CLOSE'),
),
],
);
},
);
}

0 comments on commit caa1139

Please sign in to comment.