StreamMessageComposerAttachment class
A styled container that wraps composer attachment content with a themed background, shape, and border.
StreamMessageComposerAttachment sizes itself to its child, paints a rounded surface
behind it, and clips the child to that shape. An outlined border is composed onto the
shape. The container also adds an outer margin so adjacent attachments in a row don't
touch.
When onRemovePressed is non-null, a circular StreamRemoveControl is overlaid at the
top-end corner, slightly outside the shape so it visually attaches to the edge.
{@tool snippet}
Basic usage — a rounded card with a subtle 1px border:
StreamMessageComposerAttachment(
onRemovePressed: () => removeAttachment(),
child: MyAttachmentContent(),
)
{@end-tool}
{@tool snippet}
With explicit style overrides:
StreamMessageComposerAttachment(
style: StreamMessageComposerAttachmentThemeData(
backgroundColor: Colors.blue.shade50,
side: BorderSide(color: Colors.blue.shade200),
),
child: MyAttachmentContent(),
)
{@end-tool}
Theming
StreamMessageComposerAttachment uses StreamMessageComposerAttachmentThemeData for
default styling — background color, shape, border side, and outer padding. Per-instance
style takes precedence over the inherited theme.
See also:
- StreamMessageComposerAttachmentTheme, for customizing attachment containers globally.
- StreamRemoveControl, the remove button shown when
onRemovePressedis provided. - StreamMessageAttachment, the analogous container for message-list attachments.
- DefaultStreamMessageComposerAttachment, the default visual implementation.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- StreamMessageComposerAttachment
Constructors
- StreamMessageComposerAttachment({Key? key, required Widget child, VoidCallback? onRemovePressed, String? semanticLabel, StreamMessageComposerAttachmentThemeData? style})
- Creates a composer attachment container.
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 → StreamMessageComposerAttachmentProps
-
The properties that configure this attachment container.
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