-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: create generic confirm dialog widget * feat: add confirm dialog to delete a custom condition
- Loading branch information
1 parent
c860e16
commit 4022454
Showing
4 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_gen/gen_l10n/app_localizations.dart'; | ||
|
||
class ConfirmDialog extends StatelessWidget { | ||
const ConfirmDialog({ | ||
super.key, | ||
required this.title, | ||
this.description, | ||
}); | ||
|
||
final String title; | ||
final String? description; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final localization = AppLocalizations.of(context)!; | ||
|
||
return AlertDialog( | ||
title: Text(title), | ||
content: SingleChildScrollView( | ||
child: Column( | ||
children: [ | ||
if (description != null) Text(description!), | ||
], | ||
), | ||
), | ||
actions: [ | ||
OutlinedButton( | ||
onPressed: () => Navigator.of(context).pop(false), | ||
child: Text(localization.no_button), | ||
), | ||
ElevatedButton( | ||
onPressed: () => Navigator.of(context).pop(true), | ||
child: Text(localization.yes_button), | ||
), | ||
], | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters