TextAreaModel constructor

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

Implementation

TextAreaModel({
  this.prompt = '│ ',
  this.placeholder = '',
  this.showLineNumbers = true,
  this.charLimit = 0,
  this.softWrap = true,
  int width = 0,
  int height = 6,
  this.useVirtualCursor = true,
  TextAreaKeyMap? keyMap,
  CursorModel? cursor,
  TextAreaStyles? styles,
}) : keyMap = keyMap ?? TextAreaKeyMap(),
     cursor = cursor ?? CursorModel(),
     styles = styles ?? defaultTextAreaStyles(),
     _width = width,
     _height = height {
  _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();
}