Show very simple dialogs in Flutter with a single line.
Keep in mind that these are very minimalistic dialogs with very few options to customize.
Installation
Add to pubspec.yaml
dependencies:
flutter_dialog_helper: ^0.1.0
Usage
Usually you will want to call any of the methods inside the callback of a button:
Success Message
ElevatedButton(
onPressed: (){
showSuccessMessage(context, 'Success!!!');
},
child: const Text('Success Message'),
),
Error Message
ElevatedButton(
onPressed: (){
showErrorMessage(context, 'Error!!!');
},
child: const Text('Error Message'),
),
Confirmation Dialog
ElevatedButton(
onPressed: () async{
bool? confirm = await showConfirmationMessage(context, 'Confirmation', 'Are you sure?');
setState(() {
lastConfirmation = confirm;
});
},
child: const Text('Confirmation Dialog'),
),
Prompt Dialog
ElevatedButton(
onPressed: () async{
String? input = await showPromtDialog(context, 'Input dialog',);
setState(() {
lastInput = input;
});
},
child: const Text('Prompt Dialog'),
),
Libraries
- flutter_dialog_helper
- Support for doing something awesome.