Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

flutter material dialogs

a flutter library aims to help you create animated, simple, and stylish material dialogs in your app.

1. material dialog 2. animations material dialog 3. bottom material dialog 4. animations bottom dialog
A Flutter library to help you create animated and Material Dialogs A Flutter library to help you create animated and Material Dialogs A Flutter library to help you create animated and Material Dialogs material dialogs

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.
A Flutter library to help you create animated and Material Dialogs A Flutter library to help you create animated and Material Dialogs

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,
            ),
          ])

normal

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,
            ),
          ]),

bottom

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 animations: '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',
          animations: '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,
    ),

single_btn

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.


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Top