PrismAnnouncement class
An in-app announcement shown by PrismBanner.
A banner combines a message with display rules: when it may appear, for whom, and how it is dismissed. Banners are identified by id — changing the id (or bumping version on the same id) makes the banner show again for users who already dismissed it.
const PrismAnnouncement(
id: 'release-2-1',
message: 'New in 2.1: dark mode, faster sync, and keyboard shortcuts!',
severity: PrismSeverity.info,
)
- Annotations
Constructors
- PrismAnnouncement({required String id, required String message, int version = 1, PrismSeverity severity = PrismSeverity.info, String? actionLabel, VoidCallback? onAction, DateTime? startsAt, DateTime? endsAt, String? title})
-
Creates an announcement.
const
Properties
- actionLabel → String?
-
Label for an optional action button (e.g. "What's new").
final
- endsAt → DateTime?
-
Latest time the banner may appear (defaults to no end).
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
Stable identifier used for dismiss persistence. Reuse the id and bump
version when you edit the copy so previously-dismissed users see the
updated banner again.
final
- message → String
-
Main banner text. Keep it to one or two lines.
final
- onAction → VoidCallback?
-
Invoked when the user taps the actionLabel button.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- severity → PrismSeverity
-
Visual severity — drives the default color scheme.
final
- startsAt → DateTime?
-
Earliest time the banner may appear (defaults to immediately).
final
- title → String?
-
Optional bold lead-in rendered above message.
final
- version → int
-
Bump when the copy changes under the same id.
final
Methods
-
isScheduledFor(
DateTime now) → bool - Whether this announcement is currently within its schedule.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited