StreamBadgeNotification class

A notification badge for displaying counts in colored pill shapes.

StreamBadgeNotification displays a count label in a colored pill-shaped badge with a border. It's used in channel list items and other places to indicate unread messages or pending notifications.

Unlike StreamBadgeCount, which uses neutral colors, this badge uses prominent colored backgrounds (primary, error, neutral) to draw attention.

When child is provided, the badge is automatically positioned relative to the child using a Stack, similar to Flutter's Badge widget.

The badge has three visual types controlled by StreamBadgeNotificationType:

{@tool snippet}

Basic usage (standalone badge):

StreamBadgeNotification(label: '3')

{@end-tool}

{@tool snippet}

With a child widget (automatically positioned):

StreamBadgeNotification(
  label: '5',
  child: Icon(Icons.chat_bubble_outline),
)

{@end-tool}

{@tool snippet}

Custom positioning:

StreamBadgeNotification(
  label: '3',
  alignment: Alignment.topRight,
  offset: Offset(2, -2),
  child: StreamAvatar(placeholder: (context) => Text('AB')),
)

{@end-tool}

{@tool snippet}

Error variant:

StreamBadgeNotification(
  label: '!',
  type: StreamBadgeNotificationType.error,
)

{@end-tool}

Theming

StreamBadgeNotification uses StreamBadgeNotificationThemeData for default styling. Colors are determined by the current StreamColorScheme.

See also:

Inheritance

Constructors

StreamBadgeNotification({Key? key, StreamBadgeNotificationType? type, StreamBadgeNotificationSize? size, required String label, String? semanticLabel, Widget? child, AlignmentGeometry? alignment, Offset? offset})
Creates a badge notification indicator.

Properties

hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
props StreamBadgeNotificationProps
The properties that configure this badge notification.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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