PrismBanner class

Renders the first active, not-yet-dismissed PrismAnnouncement as a dismissible banner above your content.

The banner is hidden while there is nothing to show, so you can drop it at the top of any column. Dismissals are persisted via BannerDismissStore (default: shared_preferences), and a previously-dismissed banner returns when you bump the announcement's version.

Column(
  children: [
    PrismBanner(
      announcements: [
        const PrismAnnouncement(
          id: 'release-2-1',
          message: 'New in 2.1: dark mode and faster sync!',
          actionLabel: 'See what\u2019s new',
        ),
      ],
    ),
    // …the rest of your page…
  ],
)
Inheritance

Constructors

PrismBanner({Key? key, required List<PrismAnnouncement> announcements, BannerDismissStore store = const SharedPrefsDismissStore(), PrismBannerPriority priority = PrismBannerPriority.newest, PrismBannerStyle? style, double maxWidth = 720})
Creates a banner host.
const

Properties

announcements → List<PrismAnnouncement>
Candidate announcements. Only the first scheduled, undismissed one is shown per priority.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
maxWidth → double
Maximum banner width; wider windows center the banner.
final
priority → PrismBannerPriority
Which announcement wins when several are eligible.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
store → BannerDismissStore
Where dismissals are persisted.
final
style → PrismBannerStyle?
Optional custom styling; falls back to the ambient ThemeData.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<PrismBanner>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() → List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) → String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String
Returns a one-line detailed description of the object.
inherited
toStringShort() → String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited