BlockWidget class
A widget that represents a single block in the outliner.
Supports inline editing, focus management, and customizable rendering via builder callbacks.
Example with custom block rendering:
BlockWidget(
block: myBlock,
blockBuilder: (context, block) {
return CustomRichTextWidget(content: block.content);
},
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- BlockWidget
Constructors
- BlockWidget({Key? key, required Block block, int depth = 0, bool keyboardShortcutsEnabled = true, BlockStyle style = const BlockStyle(), Widget blockBuilder(BuildContext context, Block block)?, Widget editingBlockBuilder(BuildContext context, Block block, TextEditingController controller, FocusNode focusNode, VoidCallback onSubmitted)?, Widget bulletBuilder(BuildContext context, Block block, bool hasChildren, bool isCollapsed, VoidCallback? onToggle)?, InputDecoration textFieldDecorationBuilder(BuildContext context)?, bool applyDepthPadding = true})
-
const
Properties
- applyDepthPadding → bool
-
Whether to apply automatic padding based on depth.
Set to false if the parent widget already adds indentation.
final
- block → Block
-
The block to display
final
- blockBuilder → Widget Function(BuildContext context, Block block)?
-
Custom builder for rendering block content when not editing.
If null, displays plain text.
final
- bulletBuilder → Widget Function(BuildContext context, Block block, bool hasChildren, bool isCollapsed, VoidCallback? onToggle)?
-
Custom builder for rendering the bullet/collapse indicator.
Parameters: context, block, hasChildren, isCollapsed, onToggle callback.
If null, uses default bullet rendering.
final
- depth → int
-
Nesting depth (0 for root blocks)
final
- editingBlockBuilder → Widget Function(BuildContext context, Block block, TextEditingController controller, FocusNode focusNode, VoidCallback onSubmitted)?
-
Custom builder for rendering block content when editing.
Parameters: context, block, controller, focusNode, onSubmitted callback.
If null, uses default TextField with textFieldDecorationBuilder.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- keyboardShortcutsEnabled → bool
-
Whether keyboard shortcuts (Tab/Shift+Tab, Enter) are enabled
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- style → BlockStyle
-
Style configuration for the block
final
- textFieldDecorationBuilder → InputDecoration Function(BuildContext context)?
-
Custom builder for TextField decoration when editing.
If null, uses minimal decoration.
Ignored if editingBlockBuilder is provided.
final
Methods
-
build(
BuildContext context, WidgetRef ref) → Widget - Describes the part of the user interface represented by this widget.
-
createElement(
) → _HookConsumerElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → _ConsumerState -
Creates the mutable state for this widget at a given 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