SafaehSyncChip class

Pill that reports a SafaehSyncState, collapsing to a circle.

While the state is in collapseStates (by default SafaehSyncState.saved) the chip shows its label for collapseAfter and then shrinks to an icon-only circle; any other state shows the label until it changes. Tapping calls onTap, for example to open a status sheet. The host supplies the localized label, decides when the chip is shown, and may restyle each state through colorsBuilder (defaults come from SafaehStatusColors).

Hosts place it in an app bar leading or actions slot, or in a rail or header. It keeps a 44 pixel minimum tap target and is keyboard focusable when onTap is set.

Inheritance

Constructors

SafaehSyncChip({Key? key, required SafaehSyncState state, required String label, VoidCallback? onTap, Duration collapseAfter = const Duration(seconds: 2), Set<SafaehSyncState> collapseStates = const {SafaehSyncState.saved}, double minWidthForLabel = 70, double compactSize = 36, SafaehSyncChipColors colorsBuilder(BuildContext context, SafaehSyncState state)?})
const

Properties

collapseAfter → Duration
final
collapseStates → Set<SafaehSyncState>
final
colorsBuilder → SafaehSyncChipColors Function(BuildContext context, SafaehSyncState state)?
final
compactSize → double
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
label → String
final
minWidthForLabel → double
The label is hidden when the available width is below this.
final
onTap → VoidCallback?
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
state → SafaehSyncState
final

Methods

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

Static Methods

defaultColors(BuildContext context, SafaehSyncState state) → SafaehSyncChipColors
Container colors, as Hisab's sync chip uses: primary container when saved, tertiary container while syncing, error container when offline or failed. Hosts that want other colors pass colorsBuilder.