awesome_custom_dialog

pub package pub points license: MIT design

Dialogs, toasts, snackbars, form fields and small UI controls for Flutter, all with one easy-to-chain API. Show a ready-made success dialog in three lines, or style every pixel.

Every widget looks like Material by default, and can switch to Cupertino (iOS) or adaptive with one line. There are no third-party dependencies, only Flutter's own material_ui and cupertino_ui.

Example app home screen A Material dialog The same dialog with the Cupertino design

Upgrading from 1.x? 2.0 needs Flutter 3.50 and changes a few defaults. See Upgrading from 1.x.

Install

dependencies:
  awesome_custom_dialog: ^2.0.0
import 'package:awesome_custom_dialog/awesome_custom_dialog.dart';

Needs Flutter 3.50+ and Dart 3.14+. On an older Flutter, use ^1.6.0.

Quick start

1. Show a dialog. Build it, add content with .., then call show():

ACDDialog().build(context)
  ..success(title: 'Saved!', message: 'Your changes are safe.')
  ..show();

2. Show a toast. A short message that closes on its own and never blocks taps:

ACDDialog.toast(context: context, message: 'Copied to clipboard').show();

3. Get an answer back. Use actions and showForResult:

final bool? delete = await (ACDDialog().build(context)
      ..text(text: 'Delete this photo?')
      ..actions(const [
        ACDAction(label: 'Cancel', role: ACDActionRole.cancel),
        ACDAction(label: 'Delete', role: ACDActionRole.destructive, value: true),
      ]))
    .showForResult<bool>();

4. (Optional) Set a design and texts for the whole app. Without this, everything is Material and English.

ACDDesignScope(
  design: ACDDesign.adaptive, // iOS look on iPhone/Mac, Material elsewhere
  strings: const ACDStrings(ok: 'OK', cancel: 'Cancel'), // your translations
  child: MaterialApp(home: HomePage()),
);

Features

Group Features
Dialogs Presets · Content · Position & style · Bottom sheet · Loading · Searchable list
Messages Toast · Promise & undo toasts · Snackbar · One after another
Form fields Dropdown · Autocomplete · PIN / OTP
Controls Slide to confirm · Switch · Rating bar · Stepper · Progress
Motion & decoration Animate any widget · Staggered lists · Dashed & dotted

Dialogs

Ready-made presets

Success, error, warning and info dialogs. Just add a title and a message.

Success preset

ACDDialog().build(context)
  ..success(title: 'Awesome!', message: 'Payment received.')
  ..show();
// also: ..error(...)  ..warning(...)  ..info(...)

example

Lists & custom content

Mix text, buttons, a text field and lists in any order.

Custom dialog with list

ACDDialog().build(context)
  ..text(text: 'Choose an option', fontSize: 18, fontWeight: FontWeight.bold)
  ..listOfACDListTile(
    items: const [
      ACDListTileItem(text: 'Edit', leading: Icon(Icons.edit)),
      ACDListTileItem(text: 'Share', leading: Icon(Icons.share)),
    ],
    onClickItemListener: (index) => print('Selected $index'),
  )
  ..show();

Also: twoButton(), acdTextField(validator: …), listOfACDRadioButton(), listOfACDCheckbox(), acdProgress(). example

Position, animation & style

Center, edges or corners; fade, scale, bounce, slide or rotate; any shape or gradient.

Custom animation and position

ACDDialog().build(context)
  ..gravity = ACDGravity.top
  ..animation = ACDAnimation.slideDown
  ..backgroundGradient = const LinearGradient(colors: [Colors.indigo, Colors.blue])
  ..text(text: 'Hello from the top!', color: Colors.white)
  ..show();

Positions mirror automatically in right-to-left languages. example · all options

Bottom sheet

A sheet that slides up from the bottom, with a grab handle. Drag it down to close it.

Bottom sheet

final target = await (ACDDialog.bottomSheet(context: context)
      ..text(text: 'Share to')
      ..actions(const [
        ACDAction(label: 'Mail', value: 'mail'),
        ACDAction(label: 'Messages', value: 'messages'),
      ]))
    .showForResult<String>();

example · all options

Loading while you wait

A progress dialog that stays up while your work runs, then returns its result.

final user = await ACDDialog.loading(
  context: context,
  future: api.signIn(email, password),
  message: 'Signing in…',
);

Fast work never flashes a dialog (showAfter), and cancelable: true adds a Cancel button. example · all options

Searchable list

A list the user can filter by typing. Works with your own types and a server, too.

Searchable list

ACDDialog().build(context)
  ..height = 400
  ..searchableList<String>(
    items: countries,
    onChange: (country) => print('Picked $country'),
  )
  ..show();

Use multiSearchableList<T>() to pick several items. example · all options


Messages

Toast

A small message that closes on its own. It never blocks taps, and several toasts stack neatly.

Toast

ACDDialog.toast(
  context: context,
  message: 'Saved successfully',
  contentType: ACDContentType.success, // success, failure, warning or help
  showProgressBar: true,
  dragToDismiss: true,
).show();

example · all options

Promise & undo toasts

A promise toast turns from "Saving…" into a success or error message in place.

Loading dialog, promise and undo toasts

await ACDDialog.promiseToast(
  context: context,
  future: repo.save(note),
  loading: 'Saving…',
  success: (_) => 'Saved',
  error: (_) => 'Could not save',
);

An undo toast tells you whether the user tapped Undo:

final undone = await ACDDialog.undoToast(context: context, message: 'Message deleted');
if (!undone) await api.delete(message);

example · all options

Snackbar

A colorful banner for success, failure, warning or help messages.

Snackbar

ACDDialog.snackbar(
  context: context,
  title: 'Success',
  message: 'Your changes have been saved.',
  contentType: ACDContentType.success,
).show();

example · all options

One after another

Show dialogs or toasts in order, without them overlapping.

for (final msg in ['Step 1', 'Step 2', 'Step 3']) {
  ACDDialogQueue.enqueue(
    ACDDialog.toast(context: context, message: msg, cancelPrevious: false),
  );
}

Form fields

Every field works inside a normal Form, with validator, onSaved and reset(). For switches, ratings and autocomplete, use ACDSwitchFormField, ACDRatingFormField and ACDAutocompleteFormField.

Form-field wrappers

A searchable dropdown that sits in your form and shows the picked value.

Dropdown field

ACDDropdownField<String>(
  items: countries,
  decoration: const InputDecoration(labelText: 'Country'),
  validator: (value) => value == null ? 'Required' : null,
)

Choose mode: dialog, bottom sheet, menu or iOS picker. ACDMultiDropdownField picks several items and shows them as chips. example · all options

Autocomplete

A text field that suggests matches as the user types, plus @mentions and #hashtags.

Autocomplete

ACDAutocompleteField<String>(
  suggestions: countries,
  decoration: const InputDecoration(labelText: 'Country'),
  onSuggestionSelected: (country) => print('Picked $country'),
)

For triggers, use ACDTriggerAutocompleteField(triggers: [ACDAutocompleteTrigger(trigger: '@', …)]). example · all options

PIN / OTP

A PIN or one-time-code field. SMS code autofill works out of the box.

PIN / OTP field with resend countdown

final pin = ACDPinController();

ACDPinField(length: 6, controller: pin, onCompleted: verify);
ACDResendCountdown(onResend: () => auth.sendCode(phone)); // "Resend code (0:28)"

// after a wrong code:
pin..clear()..focus();

example · all options


Controls

Slide to confirm

The user must slide to confirm, so a stray tap can't trigger a payment or a delete.

Slide to confirm

final controller = ACDSlideActionController();

ACDSlideAction(
  controller: controller,
  label: 'Slide to pay',
  onConfirm: () async {
    controller.loading();
    final ok = await submitPayment();
    ok ? controller.success() : controller.reset();
  },
)

It confirms once; controller.reset() or autoResetAfter re-arms it. example · all options

Switch

An on/off switch you can style any way you like.

Switch

ACDSwitch(value: isOn, onChanged: (value) => setState(() => isOn = value))

example · all options

Rating bar

Star ratings, with half stars and any icon.

Rating bar

ACDRatingBar(
  initialRating: 3,
  allowHalfRating: true,
  onRatingUpdate: (rating) => print('Rated $rating'),
)

example · all options

Stepper

Show progress through steps, as a bar or a vertical timeline.

Stepper

ACDStepper(
  steps: const ['Cart', 'Address', 'Payment', 'Done'],
  activeStep: currentStep,
  onStepReached: (i) => setState(() => currentStep = i),
)

example · all options

Progress

Progress bars and circles, with an optional percentage label.

Percent and loading indicators

ACDLinearPercentIndicator(value: 0.4, showPercentageText: true);
ACDCircularPercentIndicator(radius: 60, value: 0.7, showPercentageText: true);
ACDLinearPercentIndicator(indeterminate: true); // unknown duration

example · all options


Motion & decoration

Animate any widget

Wrap a widget to make it fade, slide, scale or pulse. ACDAnimatedText animates text letter by letter.

Motion and animated text

ACDMotion(effect: ACDMotionEffect.fadeSlideIn(), child: const FlutterLogo())

example · all options

Staggered lists & grids

List rows or grid cells that slide in one after another.

Staggered list

ACDStaggeredList(
  itemCount: fruits.length,
  itemBuilder: (context, index) => ListTile(title: Text(fruits[index])),
)

example · all options

Dashed & dotted

Draw a dashed line, or put a dashed border around any widget.

Dashed and dotted decoration

ACDDashedBorder(
  shape: ACDDashedBorderShape.roundedRect,
  child: const Padding(padding: EdgeInsets.all(16), child: Text('Drop file here')),
)

example · all options


Material, Cupertino or adaptive

Every widget takes a design:. If you don't set one, it is Material.

ACDDesign Looks like
material (default) Material 3
cupertino iOS: text fields, alert buttons, switches, pickers, blur
adaptive iOS look on iPhone and Mac, Material everywhere else

A widget's own design: wins over ACDDesignScope. Everything also works inside a plain CupertinoApp.

Accessibility is built in.

  • Screen readers can read every control.
  • Keyboards work: Tab, Enter, arrow keys and Esc.
  • Touch targets are at least 48 dp.
  • "Reduce motion" turns animations off.

Good to know

  • Right-to-left layouts mirror automatically.
  • Tapping outside closes a dialog; set ..barrierDismissible = false to stop that.
  • Android back gesture follows the predictive back animation; set ..canPop = false to keep a dialog open.
  • Tests: call ACDToastManager.resetForTest() and ACDDialogQueue.reset() in tearDown.

More in the advanced guide.

Upgrading from 1.x

  1. Update to Flutter 3.50+ and add material_ui to your pubspec.yaml.
  2. Run dart fix --apply --code=migrate_design_widgets. It rewrites your imports.

No class, method or parameter was renamed or removed. A few things changed on purpose:

  • Defaults:
    • bigger tap targets;
    • a darker warning color;
    • chips in the multi-select dropdown;
    • theme surfaces in Material dark mode.
  • Behaviour:
    • the slide action confirms once;
    • onBarrierTap respects canPop;
    • a dialog with autoDismissAfter: Duration.zero stays open;
    • toasts and snackbars can be swiped away.

See CHANGELOG.md for the full list.

Example app

example/ has one screen per feature, with the code next to it: cd example && flutter run.

Learn more

Contributing

Issues and pull requests are welcome on GitHub.

License

MIT. See LICENSE.

Libraries

awesome_custom_dialog
A fluent, chainable builder for dialogs, toasts, and snackbars — see ACDDialog to get started, or ACDDialog.toast()/ACDDialog.snackbar() for the ready-made factories.