toast_overlay 1.2.1
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 unlessdismissOnPressedis false.ToastTheme.actionColorandactionStylepaint it. -
Tappable cards.
onTapmakes 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: falseopts 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: falseopts out. -
Dismiss one toast.
shownow returns the toast's id, anddismissToast(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.infinityrestores 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 givenreferenceIdalso 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.copyWithcovers every field. It only tookdurationandoffsetbefore.
1.1.0 #
-
An error toast with both a
subtitleand areferenceIdnow shows both, theRef: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
ToastContentdirectly: it no longer draws the close button, and itsonDismissandtimerAnimationparameters are gone.ToastCardis unchanged. -
The example's glow backdrops are drawn with a
LinearGradientinstead of one WebP per status, so nothing has to be decoded, uploaded or cached to paint them. The four assets are gone;glowBuilderstill takes any widget, images included. -
The README screenshots are all generated by
example/test/screenshots_test.dartnow, 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 ofpackage:flutter/material.dart.This is breaking because the two libraries declare separate types. The
ThemeExtension,ThemeDataandColorSchemethis package uses arematerial_ui's, so an app still importingpackage:flutter/material.dartcannot registerToastThemein itsThemeData— the types will not match.To upgrade, migrate your app the same way:
dart fix --apply --code=migrate_design_widgetsIf you cannot migrate yet, stay on 0.3.0. Flutter's
MaterialUiCompatibilityBridgecan 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_squircleis gone. The squircle corners now come from the framework's ownRoundedSuperellipseBorder. The corner curve is very slightly different fromSmoothRectangleBorder; nothing else about the shapes changed. Passing your owncardShape/iconShapestill wins, including aSmoothRectangleBorderif you depend onfigma_squircleyourself.remixiconis gone.ToastIconsnow defaults to Material Icons. SetToastTheme.iconsto 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)(orToastController(maxStack:)) keeps several toasts against their edge instead of replacing; the oldest one drops off past the limit, andstackSpacingsets the gap. The default of 1 keeps the previous replace-on-show behaviour. ToastTheme.cardRadiusandToastTheme.iconRadiusset the corner radii as aBorderRadius, without having to build a wholeShapeBorder.cardShape/iconShapestill win when set.ToastTheme.fontFamilyswaps the typeface for every line, andreferenceStylestyles theRef: <id>line on its own.titleStyleandsubtitleStyleare now respected in full: afontWeight,colororfontFamilythey 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 resolvesToastStringsagainst the toast's ownBuildContextinstead of freezing them when the controller is created. A controller is usually built beforerunApp, where no localisations exist, so fixed strings could never follow a locale change.stringsstill works for apps that do not localise.
0.1.0 #
Initial release.
Toast.show/ToastControllerfor overlay toasts witherror,success,infoandwarningstatuses, anchored top or bottom.- Auto-dismiss with a countdown ring around the close button.
- Optional support
referenceIdrendered with a copy button; supplying one disables auto-dismiss so the user can copy it. ToastThemeextension for colours, text styles, shadows, shapes, icons and aglowBuilderbackdrop, with aColorScheme-derived fallback when none is registered.ToastStringsfor host-supplied localisation, English by default.ToastHistoryring buffer and aloggercallback.- 48×48 tap targets and semantics labels on both action buttons.
