A Flutter library aims to help you create animated, simple, and stylish Material Dialogs in your app.

Overview

Flutter Material Dialogs

pub

Flutter Material Dialogs 📱

A Flutter library aims to help you create 💪🏻animated, 😃 simple, 😎 stylish Material Dialogs in your app.

1. Material Dialog 2. Animations Material Dialog 3. Bottom Material Dialog 4. Animations Bottom Dialog

Table of Contents:

Introduction

MaterialDialog This Plugin will be useful to create simple, animated, and beautiful dialogs in your next Flutter app. This library implements Airbnb's Lottie library to render After Effects animation in app.

Types of Dialog

MaterialDialog library provides two types of dialog i.e.

1. Material Dialog 2. Bottom Sheet Material Dialog
A normal material dialog which can have one or two buttons. A Bottom Sheet material dialog which can have one or two buttons, is showed from bottom of device.

Implementation

Implementation of Material Dialog library is so easy. You can check /example directory for demo. Let's have look talk in details about it.

install

i. pubspec

In pubspec.yaml

dependencies:
  material_dialogs: _latest_version

Now in your Dart code, you can use:

import 'package:material_dialogs/material_dialogs.dart';

Details see pub.dev.

Create Dialog

As there are two types of dialogs in library. Material Dialogs are instantiated as follows.

i. Material Dialog

Dialogs class will be used to create your dialog, below is an example to show your dialog in the app.

Dialogs.materialDialog(
          msg: 'Are you sure ? you can\'t undo this',
          title: "Delete",
          color: Colors.white,
          context: context,
          actions: [
            IconsOutlineButton(
              onPressed: () {},
              text: 'Cancel',
              iconData: Icons.cancel_outlined,
              textStyle: TextStyle(color: Colors.grey),
              iconColor: Colors.grey,
            ),
            IconsButton(
              onPressed: () {},
              text: 'Delete',
              iconData: Icons.delete,
              color: Colors.red,
              textStyle: TextStyle(color: Colors.white),
              iconColor: Colors.white,
            ),
          ])

IconsOutlineButton and IconsButton are both buttons widgets provided by the plugin to make things easier for you read more, you can use any other buttons if you want.

ii. Bottom Sheet Material Dialog

Dialogs class will be used to create your dialog, use bottomMaterialDialog. Below is an example to show your dialog in the app.

Dialogs.bottomMaterialDialog(
          msg: 'Are you sure? you can\'t undo this action',
          title: 'Delete',
          context: context,
          actions: [
            IconsOutlineButton(
              onPressed: () {},
              text: 'Cancel',
              iconData: Icons.cancel_outlined,
              textStyle: TextStyle(color: Colors.grey),
              iconColor: Colors.grey,
            ),
            IconsButton(
              onPressed: () {},
              text: 'Delete',
              iconData: Icons.delete,
              color: Colors.red,
              textStyle: TextStyle(color: Colors.white),
              iconColor: Colors.white,
            ),
          ]),

Show Animations

Animations in this library are implemented using Lottie animation library. You can get free animations files here.

*.json file downloaded from LottieFiles should be placed in flutter project.

For example, here cong_example.json animation file is used in the assets folder to show congratulations animation in the example app.

In code, set animation: 'path to your animation file' arg in Widget to set Animation to the dialog.

Dialogs.materialDialog(
          color: Colors.white,
          msg: 'Congratulations, you won 500 points',
          title: 'Congratulations',
          animation: 'assets/cong_example.json',
          context: context,
          actions: [
            IconsButton(
              onPressed: () {},
              text: 'Claim',
              iconData: Icons.done,
              color: Colors.blue,
              textStyle: TextStyle(color: Colors.white),
              iconColor: Colors.white,
            ),
          ]),

Icons buttons

The plugin provide you some out of the box customized buttons to help you creating your dialog.

IconsOutlineButton

This widget helps you create an outline button easily

    IconsOutlineButton(
      onPressed: () {},
      text: 'Cancel',
      iconData: Icons.cancel_outlined,
      textStyle: TextStyle(color: Colors.grey),
      iconColor: Colors.grey,
    ),

IconsButton

This widget helps you create a material button with icons in few lines of code

    IconsButton(
      onPressed: () {},
      text: 'Delete',
      iconData: Icons.delete,
      color: Colors.red,
      textStyle: TextStyle(color: Colors.white),
      iconColor: Colors.white,
    ),

Limitations

it's better to make your animation to have the same background color as your dialog's background color, please use lottie editor to remove the background layer of your animation or make it same as your dialog background color before using it in the plugin.

Contribute

Let's develop with collaborations. We would love to have contributions by raising issues and opening PRs. Filing an issue before PR is must.

Credits

This library is built using following open-source libraries.

License

Project is published under the Apache 2.0 license. Feel free to clone and modify repo as you want, but don't forget to add reference to authors :)

Comments
  • Closing dialog programmatically

    Closing dialog programmatically

    Hi,

    Currently opening a materialDialog from a bottomMaterialDialog causes the bottomMaterialDialog to persist. Meaning that two taps are required to exit from both dialogs back to the main screen.

    Seems like a method to close a dialog programmatically would help circumvent this problem.

    enhancement 
    opened by Ro-El 4
  • Method call null on bottomMaterialDialog

    Method call null on bottomMaterialDialog

    Hi,

    Dialogs.materialDialog() works, but Dialogs.bottomMaterialDialog() doesn't. It produces this stacktrace:

    The following NoSuchMethodError was thrown building BottomSheet(dirty, dependencies: [_InheritedTheme, _LocalizationsScope-[GlobalKey#e7ba0]], state: _BottomSheetState#a43c6): The method '>' was called on null. Receiver: null Tried calling: >(0)

    The relevant error-causing widget was MaterialApp lib\main.dart:12 When the exception was thrown, this was the stack #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5) #1 new FrameRate package:lottie/src/frame_rate.dart:7 #2 Dialogs.bottomMaterialDialog. package:material_dialogs/material_dialogs.dart:111 #3 _BottomSheetState.build package:flutter/…/material/bottom_sheet.dart:266 #4 StatefulElement.build package:flutter/…/widgets/framework.dart:4744 ...

    Any help would be appreciated :)

    Greetings,

    R.

    bug 
    opened by Ro-El 4
  • Is there a way to limit the width of the dialog?

    Is there a way to limit the width of the dialog?

    I am displaying the dialog in a flutter web app, and the width of the dialog stretches from end to end. Is there a way to limit the width of the dialog Screen Shot 2022-05-21 at 7 33 59 PM ?

    enhancement 
    opened by kennedykok 3
  • Stateful versions of dialogs

    Stateful versions of dialogs

    Hi,

    Would it be possible to add stateful vesions of the dialogs? Allowing to setState from one of the dialog buttons to for instance change the title or msg used for the dialog.

    Greetings,

    R.

    enhancement 
    opened by Ro-El 3
  • Return any value from `materialDialog` instead of the fixed `String` type parameter

    Return any value from `materialDialog` instead of the fixed `String` type parameter

    Dialogs.materialDialog has a type parameter of String which can be inconvenient when you want the future to return values of other types. Could this fixed type parameter be removed or replaced with a generic type T?

    opened by James-Aidoo 1
  • Enable title and msg text alignment for materialDialog

    Enable title and msg text alignment for materialDialog

    For my own project, I added titleAlign and msgAlign named argument to materialDialog because I was using msg that would span more than one line.

    This may be helpful for others too.

    opened by edwardcahyadi 1
  • Feature Request : bottomMaterialDialog > CustomView with Input

    Feature Request : bottomMaterialDialog > CustomView with Input

    Hi @Ezaldeen99, Thank you for creating & maintaining this package.

    I want to work with input (Like TextFormField), but when soft keyboard is shown, it hide the input completely. I just want to know is there anyway to implement this at the moment?

    enhancement 
    opened by PSPTora 1
  • Feature request: customView position

    Feature request: customView position

    It would be nice if the position of customView could be customizable. Now the customView is always on the top of the title. Sometimes it could be useful to have it in between of title and msg or below msg.

    enhancement 
    opened by marcoberetta96 2
Owner
Ezaldeen Sahb
Welcome, I am an Electrical Engineer who loves to write code, let's make a project together ^^
Ezaldeen Sahb
Flutter-Animated-Library-of-Books - Flutter App - Animated Book Library

bookshelf A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if thi

Ulfhrafn 1 Dec 4, 2022
Deepak Sharma 149 Dec 10, 2022
A dialog queue for you to manage your dialogs to display on flutter platform

A dialog queue for you to manage your dialogs to display on flutter platform 中文 Features Support pop dialog orderly Support pop dialog by priority Sup

Raymond 4 Nov 1, 2022
Chance Dart is a free Open Source project that lets you create random strings, integers, and other things to help with tiresome tasks, especially when building automated tests or wherever else you require anything random.

Chance Dart Random generator helper for Dart Homepage • Documentation Overview Chance Dart is a free Open Source project that lets you create random s

Ayotomide 55 Dec 27, 2022
A Very Flexible Widget that can Implement Material Sheets on all Directions, both modal and persistent, and consequently a Material Navigation Drawer

Flutter_MaterialSheetAndNavigationDrawer If this project helped you reduce developement time or you just want to help me continue making useful tools

Bryan Cancel 30 Dec 4, 2021
Animated shimmer - A simple & lightweight widget to display an animated shimmer effect

Animated Shimmer Supports Null Safety A simple & lightweight widget to display a

Shubham Soni 7 Apr 27, 2022
Easy nav - A simple wrapper around flutter navigator, dialogs and snackbar to do those things without context

EasyNav Just a simple wrapper around flutter navigator, dialogs and snackbar to

Abdul Shakoor 2 Feb 26, 2022
Material io ext - A collection of extensions for creating widgets following material.io guidelines

material_io_ext It is a collection of extensions for creating widgets following

BetterX.io 3 Jan 28, 2022
The Health==Wealth app aims to make leading a healthy lifestyle simple, fun and rewarding for students.

The Health==Wealth app aims to make leading a healthy lifestyle simple, fun and rewarding for students. Students can also track and see their progress through the app.

null 2 Jun 25, 2022
This project aims to provide a simple and customizable Review Page interaction made with Flutter.

Review Page Interaction This project aims to provide a simple and customizable Review Page interaction made with Flutter. Check it out on Béhance (htt

Marcos Morales Rodrigo 29 Mar 29, 2022
A collection of Animations that aims to improve the user experience for your next flutter project.

Flutter Animations A collection of Animations that aims to improve the user experience for your next flutter project. Built by Ezaldeen SAHB I hope th

Ezaldeen Sahb 134 Dec 24, 2022
The easiest way to create your animated splash screen in a fully customizable way.

Animated Splash Screen Check it out at Pub.Dev Do it your way Assets image Custom Widget Url image IconData Or just change PageTransition and/or Splas

Clean Code 104 Nov 10, 2022
Animated dialog box - A pure dart package for showing animated alert box.

animated_dialog_box A pure dart package for showing animated alert box. Getting Started https://github.com/Shubham-Narkhede/animated_dialog_box/blob/m

Shubham-Narkhede 10 Jul 24, 2022
It's a universal app template to have a great animated splash screen and liquid slider. Just change the animation if you want (rive) and change the images or colours according to your app.

liquid A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this i

Zikyan Rasheed 28 Oct 7, 2022
Dialogs for picking and saving files in Android and in iOS.

flutter_file_dialog Dialogs for picking and saving files in Android and in iOS. Features Supports Android (API level 19 or later) and iOS (10.0 or lat

KineApps 26 Dec 31, 2022
Today we will show you how you can create your developer portfolio website and app using flutter.

Responsive and Animated Portfolio Website & App - Flutter UI Live Preview Watch it on YouTube Packages we are using: flutter_svg: link goole_fonts: li

Abu Anwar 198 Dec 30, 2022
A new flutter package project which contains lots of beautiful alert dialog that will help you lot to create beautiful awesome alert box very quickly and easily.

A new flutter package project which contains lots of beautiful alert dialog that will help you lot to create beautiful awesome alert box very quickly and easily.

Karan Soni 8 Jan 8, 2022
A simple project that will help you learn how to build a simple face filter app with Flutter and Deep AR

flutter_deepar This is a simple project that will help you learn how to build a simple face filter app with Flutter and Deep AR You can read an articl

mobile software engineer and team leader 3 Mar 11, 2022