TextAreaModel constructor
TextAreaModel({
- String prompt = '│ ',
- String placeholder = '',
- bool showLineNumbers = true,
- int charLimit = 0,
- bool softWrap = true,
- int width = 0,
- int height = 6,
- bool useVirtualCursor = true,
- TextAreaKeyMap? keyMap,
- CursorModel? cursor,
- 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();
}