NotebookEntry class
A single self-contained card on ruled notebook paper.
Give it one flowing run of mixed content — plain text, styled NotebookSpans,
and widgets — as children. It lays that content onto ruled rows of a
fixed height (the ruling's lineHeight), paints its own rules, and is
exactly as tall as the content requires.
The number of rows emerges from the content: text wraps to the available
width and continues on the next row; a '\n' (or an embedded newline)
starts a new row; widgets stay whole and move to the next row when they no
longer fit. The entry's height is its row count times the line height, and
minRows floors that count with empty ruled rows. The consumer never
supplies a height; the entry sizes itself to the rows it creates, and a
forced external height is unsupported.
Ruling (line height, color, wobble) comes from a NotebookStyle, resolved
from the explicit style, else an enclosing NotebookScope, else
const NotebookStyle(). Plain text takes its base style from the ambient
DefaultTextStyle.
HandDrawnNotebook(
child: NotebookEntry(
children: [
HandDrawnStatusSquare(color: Colors.green),
' Buy eggs, milk, and a very long list of groceries',
],
),
)
Content that is taller than a row is handled per fit; the assembled line is placed within its row by textAlignVertical. Flow direction comes from direction (else the ambient Directionality). Set wrap to false to lay the content on a single horizontal line for a horizontal scroll view.
Widget children must be self-sizing: they are laid out with unbounded constraints, so wrap a width- or height-hungry widget (one that expands to fill its parent) in a SizedBox or ConstrainedBox.
- Inheritance
Constructors
-
NotebookEntry({required List<
Object> children, Key? key, NotebookStyle? style, NotebookFit fit = NotebookFit.scaleDown, double scaleDownContentFraction = _kScaleDownContentFraction, TextAlignVertical textAlignVertical = TextAlignVertical.center, int minRows = 1, bool wrap = true, TextDirection? direction}) -
Creates a notebook entry from a run of mixed
children.factory
Properties
-
children
→ List<
Widget> -
The widgets below this widget in the tree.
finalinherited
- direction → TextDirection?
-
The flow direction, or null to use the ambient Directionality.
final
- fit → NotebookFit
-
How content taller than one row is handled.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- minRows → int
-
The minimum number of rows; extra rows are empty but ruled.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scaleDownContentFraction → double
-
Under NotebookFit.scaleDown, the fraction of the row height an oversized
widget is shrunk to occupy, leaving a little margin above and below so it
reads as smaller rather than touching both rules. Must be in
(0, 1];1.0fills the row edge to edge. Has no effect on text, or under NotebookFit.clip.final - style → NotebookStyle?
-
The ruling style, or null to resolve from an enclosing NotebookScope
(else
const NotebookStyle()).final - textAlignVertical → TextAlignVertical
-
Where the assembled line sits within its row.
final
- wrap → bool
-
Whether content wraps to new rows at the available width (the default).
final
Methods
-
createElement(
) → MultiChildRenderObjectElement -
RenderObjectWidgets always inflate to a RenderObjectElement subclass.
inherited
-
createRenderObject(
BuildContext context) → RenderObject -
Creates an instance of the RenderObject class that this
RenderObjectWidget represents, using the configuration described by this
RenderObjectWidget.
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
-
didUnmountRenderObject(
covariant RenderObject renderObject) → void -
This method is called when a RenderObject that was previously
associated with this widget is removed from the render tree.
The provided RenderObject will be of the same type as the one created by
this widget's createRenderObject method.
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
-
updateRenderObject(
BuildContext context, covariant RenderObject renderObject) → void -
Copies the configuration described by this RenderObjectWidget to the
given RenderObject, which will be of the same type as returned by this
object's createRenderObject.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited