flutter_dialog_manager

Last updated:

0 purchases

flutter_dialog_manager Image
flutter_dialog_manager Images
Add to Cart

Description:

flutter dialog manager

flutter_dialog_manager #
A Flutter package that allows for neater declaration, abstraction and use of customisable dialogs.
Install #
In the pubspec.yaml of your flutter project, add the following dependency:
dependencies:
flutter_dialog_manager: ^1.0.0+4
copied to clipboard
Import the package in your project:
import 'package:flutter_dialog_manager/flutter_dialog_manager.dart';
copied to clipboard
Getting started #
Wrap your MaterialApp widget with a DialogManager
and pass the required GlobalKey<NavigatorState> navigatorKey parameter.
Also pass the navigator key to MaterialApp.
@override
Widget build(BuildContext context) {
return DialogManager(
navigatorKey: _navigatorKey,
child: MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
navigatorKey: _navigatorKey,
home: const MyHomePage(title: 'Flutter Demo Home Page'),
),
)
copied to clipboard
Usage #
Declare dialog UI implementations and their associated route names with onGenerateDialog or dialogRoutes
onGenerateDialog: (settings) {
switch (settings.name) {
case "/counter":
if (settings.arguments != null) {
return CounterDialog(
counter: settings.arguments as int,
);
}
break;
}}
copied to clipboard
dialogRoutes: {
"/": (context) => DefaultDialog(),
"/home": (context) => HomeDialog(),
}
copied to clipboard
Show dialog in your UI
DialogManager.of(context).showDialog(
routeName: "/counter",
arguments: _counter,
);
copied to clipboard
Explore detailed examples here.
Contributions #
Feel free to contribute to this project.
If you find a bug or want a feature, but don't know how to fix/implement it, please fill an issue.
If you fixed a bug or implemented a feature, please send a pull request.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.