toast_overlay 1.2.1 copy "toast_overlay: ^1.2.1" to clipboard
toast_overlay: ^1.2.1 copied to clipboard

An animated, themeable overlay toast for Flutter with an auto-dismiss countdown ring and an optional copyable support reference id.

Changelog #

1.2.1 #

  • No change to the published code. CI moved to the shared reusable workflow in CtrlAltDevelop/ci-workflows: formatting, analyze --fatal-infos, the tests, the example, a changelog entry per version, and a pana score with no points lost — the same gate across every package here.
  • Dependency bounds are explicit ranges rather than carets — a floor that resolves on the supported SDK, the next major as the ceiling — so a consumer already on an older version in the same major is not forced to move.
  • The README carries the pub, pub points, CI and licence badges the other packages here carry.

1.2.0 #

  • Actions. A toast can carry a button — action: ToastAction(label: 'Undo', onPressed: restore). It dismisses the toast when pressed unless dismissOnPressed is false. ToastTheme.actionColor and actionStyle paint it.

  • Tappable cards. onTap makes the whole card a target, for a toast that opens the thing it is about. The close and copy buttons still win the gesture arena, so they keep working.

  • Swipe to dismiss. A drag towards the anchored edge — up at the top, down at the bottom — throws the toast away past 40% of its height, or on a flick; anything less springs back. Dragging the other way does nothing, so it never fights a scroll underneath. dismissible: false opts out.

  • The countdown pauses under a pointer. Hovering a card stops the timer and leaving resumes it from where it stopped, so a toast does not vanish mid-sentence on desktop and web. pauseOnHover: false opts out.

  • Dismiss one toast. show now returns the toast's id, and dismissToast(id) plays that one card's exit animation while the rest stay. dismissAll() animates every toast out; dismiss() still cuts them immediately.

  • Announced to screen readers. The title and subtitle are one live region, and on platforms that support announcements the toast announces itself when it appears — assertively for an error, politely otherwise. A toast in an overlay was otherwise easy to miss before it auto-dismissed.

  • The card no longer stretches across a desktop window. It is capped at ToastTheme.maxWidth, 520 by default, and centred. maxWidth: double.infinity restores the previous full-width card.

  • A reference id now renders on any status. It used to be dropped on anything but error, which was surprising given referenceId also disables auto-dismiss whatever the status.

  • Lower floor, looser constraints. The package now asks for Dart 3.12 and Flutter 3.44 — material_ui's own minimum — instead of 3.13 / 3.47, and its dependencies float over a range rather than one major line: material_ui >=1.0.0 <2.0.0, flutter_lints >=5.0.0 <7.0.0. The test suite passes against the lowest versions the range allows as well as the newest.

  • ToastConfig.copyWith covers every field. It only took duration and offset before.

1.1.0 #

  • An error toast with both a subtitle and a referenceId now shows both, the Ref: line under the subtitle. Previously the reference id replaced the subtitle.

  • The card is more compact. The dismiss button is now laid out on top of the card instead of in the title row, so its 48dp tap target no longer stretches the toast; the copy button, the leading icon tile and the paddings shrank to match, and the icon tile lost its drop shadow. A toast with a reference id is about half its previous height.

    Breaking for anyone building ToastContent directly: it no longer draws the close button, and its onDismiss and timerAnimation parameters are gone. ToastCard is unchanged.

  • The example's glow backdrops are drawn with a LinearGradient instead of one WebP per status, so nothing has to be decoded, uploaded or cached to paint them. The four assets are gone; glowBuilder still takes any widget, images included.

  • The README screenshots are all generated by example/test/screenshots_test.dart now, including the stacked and bottom ones, which were hand-taken on a simulator before.

1.0.0 #

Breaking. Read the first item before upgrading.

  • Moved to package:material_ui. Material has been decoupled from the Flutter framework into its own package, and the toast now builds on it instead of package:flutter/material.dart.

    This is breaking because the two libraries declare separate types. The ThemeExtension, ThemeData and ColorScheme this package uses are material_ui's, so an app still importing package:flutter/material.dart cannot register ToastTheme in its ThemeData — the types will not match.

    To upgrade, migrate your app the same way:

    dart fix --apply --code=migrate_design_widgets
    

    If you cannot migrate yet, stay on 0.3.0. Flutter's MaterialUiCompatibilityBridge can bridge a mixed tree, but it ships already deprecated and is not a long-term answer.

  • Requires Dart 3.13 and Flutter 3.47.

  • Dropped both previous third-party dependencies.

    • figma_squircle is gone. The squircle corners now come from the framework's own RoundedSuperellipseBorder. The corner curve is very slightly different from SmoothRectangleBorder; nothing else about the shapes changed. Passing your own cardShape / iconShape still wins, including a SmoothRectangleBorder if you depend on figma_squircle yourself.
    • remixicon is gone. ToastIcons now defaults to Material Icons. Set ToastTheme.icons to keep the Remix glyphs — example/ shows this.
  • The example's iOS deployment target is now 15.0, the minimum Flutter 3.47 supports.

0.3.0 #

  • Toasts can stack. Toast.init(maxStack: 3) (or ToastController(maxStack:)) keeps several toasts against their edge instead of replacing; the oldest one drops off past the limit, and stackSpacing sets the gap. The default of 1 keeps the previous replace-on-show behaviour.
  • ToastTheme.cardRadius and ToastTheme.iconRadius set the corner radii as a BorderRadius, without having to build a whole ShapeBorder. cardShape / iconShape still win when set.
  • ToastTheme.fontFamily swaps the typeface for every line, and referenceStyle styles the Ref: <id> line on its own.
  • titleStyle and subtitleStyle are now respected in full: a fontWeight, color or fontFamily they set is no longer overwritten by the theme's defaults.
  • README screenshots are generated from the real widgets by example/test/screenshots_test.dart.

0.2.0 #

  • Added stringsBuilder, which resolves ToastStrings against the toast's own BuildContext instead of freezing them when the controller is created. A controller is usually built before runApp, where no localisations exist, so fixed strings could never follow a locale change. strings still works for apps that do not localise.

0.1.0 #

Initial release.

  • Toast.show / ToastController for overlay toasts with error, success, info and warning statuses, anchored top or bottom.
  • Auto-dismiss with a countdown ring around the close button.
  • Optional support referenceId rendered with a copy button; supplying one disables auto-dismiss so the user can copy it.
  • ToastTheme extension for colours, text styles, shadows, shapes, icons and a glowBuilder backdrop, with a ColorScheme-derived fallback when none is registered.
  • ToastStrings for host-supplied localisation, English by default.
  • ToastHistory ring buffer and a logger callback.
  • 48×48 tap targets and semantics labels on both action buttons.
1
likes
160
points
214
downloads
screenshot

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

An animated, themeable overlay toast for Flutter with an auto-dismiss countdown ring and an optional copyable support reference id.

Homepage
Repository (GitHub)
View/report issues

Topics

#toast #notification #snackbar #overlay

License

MIT (license)

Dependencies

flutter, material_ui

More

Packages that depend on toast_overlay