TextInputModel constructor
TextInputModel({
- String prompt = '> ',
- String placeholder = '',
- EchoMode echoMode = EchoMode.normal,
- String echoCharacter = '*',
- int charLimit = 0,
- int width = 0,
- bool multiline = false,
- int maxHeight = 0,
- bool showSuggestions = false,
- bool useVirtualCursor = true,
- bool collapseLargePaste = false,
- int collapsedPasteMinChars = 1200,
- int collapsedPasteMinLines = 20,
- TextInputKeyMap? keyMap,
- CursorModel? cursor,
- ValidateFunc? validate,
- TextInputStyles? styles,
Creates a new text input model.
Implementation
TextInputModel({
this.prompt = '> ',
this.placeholder = '',
this.echoMode = EchoMode.normal,
this.echoCharacter = '*',
this.charLimit = 0,
this.width = 0,
this.multiline = false,
this.maxHeight = 0,
this.showSuggestions = false,
this.useVirtualCursor = true,
this.collapseLargePaste = false,
this.collapsedPasteMinChars = 1200,
this.collapsedPasteMinLines = 20,
TextInputKeyMap? keyMap,
CursorModel? cursor,
this.validate,
TextInputStyles? styles,
}) : keyMap = keyMap ?? TextInputKeyMap(),
cursor = cursor ?? CursorModel(),
styles = styles ?? defaultTextInputStyles() {
_document = TextDocument();
_editorState = EditorState();
_textView = TextView();
_history =
EditHistoryController<
_TextInputHistoryAction,
_TextInputEditState,
({int cursor, int length})
>(
maxEntries: _maxHistoryEntries,
sameState: (a, b) => a.sameAs(b),
canCoalesce: _canCoalesceHistoryAction,
markerForState: (action, state) =>
(cursor: state.position, length: state.value.length),
);
_syncCoreState();
_updateVirtualCursorStyle();
}