A powerful plugin for displaying message dialogs, list dialogs, success dialogs, failed dialogs, input dialogs, popup dialogs and loading dialogs. This plugin is fully customizable with examples
- Message Dialog
- Success Dialog
- Failed Dialog
- List Dialog
- Input Dialog
- Loading Dialog
- Popup Dialog
To use this plugin, add dialogpack as a dependency in your pubspec.yaml file.
dependencies:
flutter:
sdk: flutter
dialogpack:
git:
url: git://github.com/johnebere58/dialogpack.git
ref: master # branch name
Add DialogManager.initialize() to the initState method of your root widget
import 'package:dialogpack/dialogpack.dart';
@override
void initState() {
DialogManager.initialize();
super.initState();
}You can choose to set a global style for all your dialogs during initialization,
import 'package:dialogpack/dialogpack.dart';
@override
void initState() {
super.initState();
DialogManager.initialize(
messageDialogStyle: MessageDialogStyle( ... ),
dialogEntrance: DialogEntrance.fade_in,
popupDialogStyle: PopupDialogStyle( ... ),
inputDialogStyle: InputDialogStyle( ... ),
listDialogStyle: ListDialogStyle( ... ),
);
}After initialization you can show a method dialog by doing this
import 'package:dialogpack/dialogpack.dart';
DialogManager.showSimpleMessageDialog(context,
message: "This is a simple message dialog", title: "Welcome");
Everything is flexible on the go, you can switch theme styles or switch from dark theme to light theme
DialogManager.switchToLightMode();
DialogManager.switchToDarkMode();You set a custom entrance for any of your dialogs
DialogManager.showSimpleMessageDialog(context,
message: "This is a simple message dialog",
title: "Welcome",
dialogEntrance: DialogEntrance.slide_down);You can choose to position your dialog at the top, center or bottom of the screen
DialogManager.showSimpleMessageDialog(context,
message: "This is a simple message dialog",
title: "Welcome",
dialogEntrance: DialogEntrance.slide_up,
messageDialogStyle: MessageDialogStyle(
dialogStyle: const DialogStyle(
dialogPlacement: DialogPlacement.bottom)));You can use the MessageDialogStyle class to style a message dialog however you want
DialogManager.showSimpleMessageDialog(context,
message: "This is a simple message dialog",
title: "Welcome",
dialogEntrance: DialogEntrance.slide_up,
messageDialogStyle: MessageDialogStyle(
dialogStyle: const DialogStyle(
dialogPlacement: DialogPlacement.bottom,
margin: 0.0,curvedRadius: 0.0,elevation: 0.0),
titleTextSize: 25.0,
dialogButtonDesign: DialogButtonDesign.stroked,
buttonSpacing: 10.0,
));To show a list dialog is very easy, call DialogManager.showSimpleListDialog
DialogManager.showSimpleListDialog(context,
items: [
"Apple", "Ball", "Cake"
],
onItemSelected: (dynamic result){
showSnackBar(result);
});You can set the dialog to return the int index of the item selection,
instead of the selection String by setting returnIndexes to true
DialogManager.showSimpleListDialog(context,
items: [
"Apple", "Ball", "Cake"
],
onItemSelected: (dynamic result){
showSnackBar(result);
}, returnIndexes :true);To selection multiple items you need to set the maxSelections parameter to be greater than 1
DialogManager.showSimpleListDialog(context,
items: [
"Apple", "Ball", "Cake"
],
onItemSelected: (dynamic result){
showSnackBar(result);
}, maxSelections: 2);The result will be a list of the items selected, if you set returnIndexes to true, the result will be a list of the indexes of the items selected
For help getting started with Flutter development, view the online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.















