TextAreaModel constructor

TextAreaModel({
  1. String prompt = '│ ',
  2. String placeholder = '',
  3. bool showLineNumbers = true,
  4. int minimumLineNumberDigits = 0,
  5. int charLimit = 0,
  6. bool softWrap = true,
  7. int width = 0,
  8. int height = 6,
  9. bool useVirtualCursor = true,
  10. TextAreaKeyMap? keyMap,
  11. CursorModel? cursor,
  12. TextAreaStyles? styles,
  13. DateTime nowProvider()?,
})

Implementation

TextAreaModel({
  this.prompt = '│ ',
  this.placeholder = '',
  this.showLineNumbers = true,
  this.minimumLineNumberDigits = 0,
  this.charLimit = 0,
  this.softWrap = true,
  int width = 0,
  int height = 6,
  this.useVirtualCursor = true,
  TextAreaKeyMap? keyMap,
  CursorModel? cursor,
  TextAreaStyles? styles,
  DateTime Function()? nowProvider,
}) : assert(minimumLineNumberDigits >= 0),
     keyMap = keyMap ?? TextAreaKeyMap(),
     cursor = cursor ?? CursorModel(),
     styles = styles ?? defaultTextAreaStyles(),
     _width = width,
     _height = height,
     _nowProvider = nowProvider ?? _defaultNowProvider {
  _document = TextDocument();
  _editorState = EditorState();
  _textView = TextView(width: width, height: height, softWrap: softWrap);
  _history =
      EditHistoryController<
        _TextAreaHistoryAction,
        _TextAreaEditState,
        ({int row, int col, int length})
      >(
        maxEntries: _maxHistoryEntries,
        sameState: (a, b) => a.sameAs(b),
        canCoalesce: _canCoalesceHistoryAction,
        markerForState: (action, state) => (
          row: state.row,
          col: state.col,
          length: uni.graphemes(state.value).length,
        ),
      );
  _editorStateDirty = true;
  _syncCoreState();
  _updateVirtualCursorStyle();
}