Dialogs topic

Dialogs

Positioned dialogs

This type of dialogs is used to show at a specific place on the screen using EasyDialogPosition.

FlutterEasyDialogs.show(
  EasyDialog.positioned(
    position: EasyDialogPosition.top,
    content: Container(
      height: 150.0,
      color: Colors.amber[900],
      alignment: Alignment.center,
      child: Text('Dialog'),
    ),
  ),
);

Or:

Container(
  height: 150.0,
  color: Colors.amber[900],
  alignment: Alignment.center,
  child: Text('Dialog'),
).positioned(position: EasyDialogPosition.top).show();

Since version 3.2.0 you can make dialog draggable:

final content = Container(
  height: 150.0,
  color: Colors.amber[900],
  alignment: Alignment.center,
  child: Text('Dialog'),
);

content
    .positioned()
    .draggable()
    .show();

FullScreen dialogs

These dialogs are intended to cover all available space on the screen and be presented one at a time. There is a special behavior available to detect the Android software back button and handle it:

FlutterEasyDialogs.show(
  EasyDialog.fullScreen( 
    content: Container(
      height: 150.0,
      color: Colors.amber[900],
      alignment: Alignment.center,
      child: Text('Dialog'),
    ),
  ),
);

Or:

Container(
  height: 150.0,
  color: Colors.amber[900],
  alignment: Alignment.center,
  child: Text('Dialog'),
).fullScreen().show();

Basic parameters

  • content - widget that is desired to be shown.
  • animation configuration - responsible for configuring animation duration, start value, etc. It also provides an opportunity to create a configuration with an external AnimationController that will drive the dialog animation.
  • auto hide duration: duration after which the dialog will be automatically hidden. If you pass null the dialog won't auto hide at all.
  • decoration: a provided decoration that will be applied to the content.

Context

Each dialog has its own context, which is a class that contains helpful methods and properties, such as the animation associated with the dialog:

dialog.context.animation;
dialog.context.hideDialog();
dialog.context.vsync;

Classes

EasyDialog Getting started Dialogs
Base dialog class.
EasyDialogAnimationConfiguration Dialogs Migration guide from 2.x to 3.x
Configuration of EasyDialogAnimation.
EasyDialogContext Getting started Dialogs
Context that provides some useful methods and properties that are associated with specific EasyDialog.
EasyDialogsController Getting started Dialogs Migration guide from 2.x to 3.x
Core class for manipulating dialogs.
FlutterEasyDialogs Getting started Dialogs Migration guide from 2.x to 3.x FAQ
Wrapper for providing an easy use of different custom dialogs.