CkCommentSheet<T> class

A generic, recursively-nested comment/reply list with built-in expand/collapse-replies state, connector-line drawing, and pagination — built on top of CkListView for the outer scroll/refresh/load-more mechanics.

T is your comment model; this widget has no knowledge of its shape.

Inheritance
Available extensions

Constructors

CkCommentSheet({Key? key, required List<T> items, required CkRepliesExtractor<T> repliesOf, required CkIdExtractor<T> idOf, required CkCommentContentBuilder<T> itemBuilder, required CkCommentAvatarBuilder<T> avatarBuilder, required CkCommentReplyActionBuilder<T> replyActionBuilder, required CkCommentReactionBuilder<T> reactionBuilder, WidgetBuilder? previewHeaderBuilder, void onRefresh()?, void onLoadMore(int page)?, void onLoadMoreReplies(T parent, int page)?, bool isLoading = false, bool isLoadDone = false, int replyPageSize = 2, CkAvatarSizeForDepth avatarSizeForDepth = _defaultAvatarSizeForDepth, bool exclusiveReplyExpansion = true, ScrollController? scrollController, EdgeInsetsGeometry? padding, WidgetBuilder? dividerBuilder, double gap = 8, double itemBottomSpacing = 16, Color? accentColor, Color? dividerColor, TextStyle? toggleTextStyle, T? replyTarget, void onSend(String text, T? replyTo)?, CkComposerFooterBuilder? composerFooterBuilder, Widget sendButtonBuilder(VoidCallback onTap)?, CkSendButtonPosition sendButtonPosition = CkSendButtonPosition.footer, bool showComposer = true, bool preserveComposeText = false, String composerHintText = 'Write a comment...', double composerMinHeight = 100, double composerFocusedHeight = 160, double composerMaximizedHeightFraction = 0.5, Color? composerBackgroundColor, void composerOnChanged(String value)?, Widget composerContainerBuilder(BuildContext context, Widget textField, bool isFocused)?, int? composerMaxLength, int? composerMaxWords, int composerMinLength = 0, int composerMinWords = 0, TextStyle? composerCounterTextStyle, CkMultilineHintLimitBuilder? composerLimitHintBuilder})
const

Properties

accentColor → Color?
Color used for the "View replies" / "Hide replies" icon and text. Defaults to Theme.of(context).colorScheme.primary.
final
avatarBuilder → CkCommentAvatarBuilder<T>
final
avatarSizeForDepth → CkAvatarSizeForDepth
final
center → Widget

Available on Widget, provided by the Alignments extension

no setter
composerBackgroundColor → Color?
final
composerContainerBuilder → Widget Function(BuildContext context, Widget textField, bool isFocused)?
Wraps the composer's text field with its container chrome (background, border radius, padding, shadow, etc). Defaults to a plain white rounded card if not provided.
final
composerCounterTextStyle → TextStyle?
Text style for the word/character count indicators.
final
composerFocusedHeight → double
Height of the composer text box when focused but not maximized.
final
composerFooterBuilder → CkComposerFooterBuilder?
Builds the composer's toolbar. If null, no toolbar is shown.
final
composerHintText → String
final
composerLimitHintBuilder → CkMultilineHintLimitBuilder?
Custom builder for limit hints.
final
composerMaximizedHeightFraction → double
Fraction of the screen height used when the composer is maximized.
final
composerMaxLength → int?
Maximum characters allowed in the composer text field.
final
composerMaxWords → int?
Maximum words allowed in the composer text field.
final
composerMinHeight → double
Height of the composer text box when not focused.
final
composerMinLength → int
Minimum characters required in the composer text field.
final
composerMinWords → int
Minimum words required in the composer text field.
final
composerOnChanged → void Function(String value)?
Called on every composer text change.
final
dividerBuilder → WidgetBuilder?
Overrides the default divider rendered after every item/reply.
final
dividerColor → Color?
Color used for connector lines and the default divider. Defaults to Theme.of(context).dividerColor.
final
end → Widget

Available on Widget, provided by the Alignments extension

no setter
exclusiveReplyExpansion → bool
When true (default), expanding the replies of a top-level item collapses the currently-expanded top-level item, if any. Nested expansions within the same top-level subtree are unaffected.
final
gap → double
Horizontal gap between the avatar column and its content.
final
hashCode → int
The hash code for this object.
no setterinherited
idOf → CkIdExtractor<T>
final
isLoadDone → bool
final
isLoading → bool
final
itemBottomSpacing → double
Vertical space after each top-level item (and its expanded replies) before the next one.
final
itemBuilder → CkCommentContentBuilder<T>
final
items → List<T>
The top-level items (e.g. comments on a post).
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
marginZero → Widget

Available on Widget, provided by the WidgetMarginX extension

no setter
onLoadMore → void Function(int page)?
Pagination for the top-level items list.
final
onLoadMoreReplies → void Function(T parent, int page)?
Pagination for parent's replies, called whenever more of an already-known parent's replies are requested. The sheet always reveals any already-available items from repliesOf first; use this to fetch more from the network when needed.
final
onRefresh → void Function()?
final
onSend → void Function(String text, T? replyTo)?
Called when the user taps send. replyTo mirrors replyTarget at the moment of sending: null means "post a new top-level comment", non-null means "reply to this item". The sheet clears its own text field after calling this; you're responsible for clearing any of your own state (e.g. attached media) and persisting the comment.
final
padding → EdgeInsetsGeometry?
final
paddingZero → Widget

Available on Widget, provided by the WidgetPaddingX extension

no setter
preserveComposeText → bool
When true, hiding the composer (via showComposer = false) preserves the written text in the composer field until onSend is triggered. When false (default), hiding the composer discards the current input.
final
previewHeaderBuilder → WidgetBuilder?
Rendered above the list (forwarded to CkListView.topWidget) — e.g. a "replying to ..." / "comment on post ..." context header.
final
reactionBuilder → CkCommentReactionBuilder<T>
final
repliesOf → CkRepliesExtractor<T>
final
replyActionBuilder → CkCommentReplyActionBuilder<T>
final
replyPageSize → int
How many replies become visible per "View more replies" tap.
final
replyTarget → T?
The item the composer is currently replying to, if any. Pass null for a new top-level comment. This is a controlled prop — update it from your own reactive state when the user taps a replyActionBuilder.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scrollController → ScrollController?
final
sendButtonBuilder → Widget Function(VoidCallback onTap)?
Builds the send button, given the tap handler to wire up. Defaults to a plain IconButton with Icons.send.
final
sendButtonPosition → CkSendButtonPosition
final
showComposer → bool
Whether the composer is visible. The composer only renders at all when onSend is provided. Controlled externally — e.g. drive this from your own show/hide state if you want a collapsible composer.
final
sliverBox → Widget

Available on Widget, provided by the WidgetSliverBoxX extension

no setter
start → Widget

Available on Widget, provided by the Alignments extension

no setter
toggleTextStyle → TextStyle?
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<CkCommentSheet<T>>
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
marginAll(double margin) → Widget

Available on Widget, provided by the WidgetMarginX extension

marginOnly({double left = 0.0, double top = 0.0, double right = 0.0, double bottom = 0.0}) → Widget

Available on Widget, provided by the WidgetMarginX extension

marginSymmetric({double horizontal = 0.0, double vertical = 0.0}) → Widget

Available on Widget, provided by the WidgetMarginX extension

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
paddingAll(double padding) → Widget

Available on Widget, provided by the WidgetPaddingX extension

paddingOnly({double left = 0.0, double top = 0.0, double right = 0.0, double bottom = 0.0}) → Widget

Available on Widget, provided by the WidgetPaddingX extension

paddingSymmetric({double horizontal = 0.0, double vertical = 0.0}) → Widget

Available on Widget, provided by the WidgetPaddingX extension

toAr(num width, num height) → Widget

Available on Widget, provided by the WidgetAspectRatio extension

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