StreamReactions class

Displays reactions as either individual chips or a single grouped chip.

Use StreamReactions.segmented to render each reaction type as its own chip, and StreamReactions.clustered to group all reaction types into a single chip.

Reactions can be displayed on their own or positioned relative to a child, such as a message bubble or container.

If a StreamMessageLayout is found in the ancestor tree, position, alignment, crossAxisAlignment, and indent are automatically derived from the message alignment when not explicitly set.

{@tool snippet}

Display segmented reactions below a child:

StreamReactions.segmented(
  items: [
    StreamReactionsItem(emoji: StreamEmoji(emoji: StreamUnicodeEmoji('👍')), count: 3),
    StreamReactionsItem(emoji: StreamEmoji(emoji: StreamUnicodeEmoji('❤️')), count: 2),
  ],
  child: Container(
    padding: EdgeInsets.all(12),
    child: Text('Looks good to me'),
  ),
)

{@end-tool}

{@tool snippet}

Display clustered reactions above a child:

StreamReactions.clustered(
  items: [
    StreamReactionsItem(emoji: StreamEmoji(emoji: StreamUnicodeEmoji('👍')), count: 4),
    StreamReactionsItem(emoji: StreamEmoji(emoji: StreamUnicodeEmoji('😂')), count: 2),
    StreamReactionsItem(emoji: StreamEmoji(emoji: StreamUnicodeEmoji('🔥'))),
  ],
  position: StreamReactionsPosition.header,
  child: Container(
    padding: EdgeInsets.all(12),
    child: Text('Let us ship this'),
  ),
)

{@end-tool}

See also:

Inheritance

Constructors

StreamReactions({Key? key, StreamReactionsType type = .clustered, required List<StreamReactionsItem> items, Widget? child, StreamReactionsPosition? position, StreamReactionsAlignment? alignment, int? max, bool overlap = true, double? indent, CrossAxisAlignment? crossAxisAlignment, Clip clipBehavior = Clip.none, VoidCallback? onPressed})
Creates a reaction display with the given type and items.
StreamReactions.clustered({Key? key, required List<StreamReactionsItem> items, Widget? child, StreamReactionsPosition? position, StreamReactionsAlignment? alignment, int? max, bool overlap = true, double? indent, CrossAxisAlignment? crossAxisAlignment, Clip clipBehavior = Clip.none, VoidCallback? onPressed})
Creates clustered reactions that group all reaction types into one chip.
StreamReactions.segmented({Key? key, required List<StreamReactionsItem> items, Widget? child, StreamReactionsPosition? position, StreamReactionsAlignment? alignment, int? max, bool overlap = true, double? indent, CrossAxisAlignment? crossAxisAlignment, Clip clipBehavior = Clip.none, VoidCallback? onPressed})
Creates segmented reactions where each type is rendered as its own chip.

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 StreamReactionsProps
The properties that configure this widget.
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