NotebookEntry constructor

NotebookEntry({
  1. required List<Object> children,
  2. Key? key,
  3. NotebookStyle? style,
  4. NotebookFit fit = NotebookFit.scaleDown,
  5. double scaleDownContentFraction = _kScaleDownContentFraction,
  6. TextAlignVertical textAlignVertical = TextAlignVertical.center,
  7. int minRows = 1,
  8. bool wrap = true,
  9. TextDirection? direction,
  10. double indent = 0,
  11. 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,
  );
}