NotebookEntry constructor
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,
- double indent = 0,
- double? firstRowIndent,
Creates a notebook entry from a run of mixed children.
Each element must be a String, a NotebookSpan, or a Widget; any other
type throws an ArgumentError. minRows must be at least 1. indent
and firstRowIndent must be non-negative and finite; a null
firstRowIndent follows indent.
Implementation
factory 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,
double indent = 0,
double? firstRowIndent,
}) {
assert(
scaleDownContentFraction > 0 && scaleDownContentFraction <= 1,
'scaleDownContentFraction must be in the range (0, 1].',
);
assert(
indent >= 0 && indent < double.infinity,
'indent must be non-negative and finite.',
);
assert(
firstRowIndent == null ||
(firstRowIndent >= 0 && firstRowIndent < double.infinity),
'firstRowIndent must be non-negative and finite.',
);
final content = _NotebookContent.parse(children);
return NotebookEntry._(
key: key,
pieces: content.pieces,
style: style,
fit: fit,
scaleDownContentFraction: scaleDownContentFraction,
textAlignVertical: textAlignVertical,
minRows: minRows,
wrap: wrap,
direction: direction,
indent: indent,
firstRowIndent: firstRowIndent ?? indent,
children: content.widgets,
);
}