ToggleAttributeItem class
A toolbar toggle bound to one Attribute: bold, blockquote,
list: 'ordered', direction: 'rtl', ...
The button is active when the selection carries the attribute with the
same value — for valued attributes (list styles, alignment, direction)
each value gets its own button and only the matching one lights up,
which is what makes separate LTR and RTL buttons work correctly.
Pressing always calls controller.formatSelection(attribute); the
controller's toggle semantics turn a second press into a removal.
The item listens to the controller itself, so only this button rebuilds on selection changes.
- Inheritance
-
- Object
- ToolbarItem
- ToggleAttributeItem
Constructors
-
ToggleAttributeItem({required String id, required String group, required Attribute<
Object?> attribute, required IconData icon, required String tooltipOf(QuillKitStrings strings), bool activeWhen(Style selectionStyle)?}) -
Creates a toggle for
attribute.const
Properties
- activeWhen → bool Function(Style selectionStyle)?
-
Custom active-state predicate over the selection style; defaults to
"the style holds attribute with an equal value". The checklist
button uses this to light up for both
'checked'and'unchecked'list values.final -
attribute
→ Attribute<
Object?> -
The attribute applied on press and matched for the active state.
final
- group → String
-
Grouping key used for ordering and separators, e.g.
'inline','block','history'.final - hashCode → int
-
The hash code for this object.
no setterinherited
- icon → IconData
-
Icon of the button.
final
- id → String
-
Unique identifier, e.g.
'quill_kit.bold'.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tooltipOf → String Function(QuillKitStrings strings)
-
Resolves the tooltip from the ambient strings.
final
Methods
-
build(
BuildContext context, ToolbarItemContext itemContext) → Widget -
Builds the widget for this item.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited