Skip to content
pubscout

aligned_dialog

0.0.8, released 3 weeks ago by wenkaifan.com

Show dialogs and drawers aligned with specific target widgets or the screen.

WASM-ready
$ flutter pub add aligned_dialog
Source repository

What it does

Allows developers to open dialogs and drawers aligned relative to an associated widget using anchor points, rather than forcing them to the center of the screen. It supports overflow prevention, custom transitions, and global screen alignment.

AI-written summary of version 0.0.8, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to show a contextual popup menu or dialog directly next to a button or widget on large screens.
  • You want to display a global drawer or globally aligned dialog within safe areas.

Skip it when

  • You only need standard centered Material dialogs.
  • You want a fully declarative navigation or widget-based routing approach.

Strengths

  • Provides precise control over dialog placement using follower and target anchors.
  • Supports overflow prevention to keep dialogs inside the screen bounds.
  • Includes global drawer and global alignment options.

Weaknesses

  • Relies on imperative function calls rather than a widget-based approach.
  • Limited to dialog and drawer positioning use cases.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0
Builder(
  builder: (BuildContext context) {
    return ElevatedButton(
      onPressed: () async {
        final String? result = await showAlignedDialog<String>(
          context: context,
          builder: (BuildContext context) => TextButton(
            onPressed: () => Navigator.of(context).pop('Hello'),
            child: const Text('Close'),
          ),
          followerAnchor: Alignment.topLeft,
          targetAnchor: Alignment.bottomLeft,
          avoidOverflow: true,
        );
      },
      child: const Text('Show dialog'),
    );
  },
)

Alternatives

Packages that do the same job and could replace aligned_dialog.

Works with

Packages commonly used together with aligned_dialog: ones it builds on, ones built on it, and its own family.