Skip to content

Commit

Permalink
Testing text selection.
Browse files Browse the repository at this point in the history
  • Loading branch information
szepetry committed Nov 29, 2021
1 parent d03ee76 commit fb7d102
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/text_editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,13 @@ class _TextEditorState extends State<TextEditor> {
late TextStyleModel _textStyleModel;
late FontOptionModel _fontOptionModel;
late Widget _doneButton;
TextEditingController textEditingController = TextEditingController();

@override
void initState() {
textEditingController.selection = TextSelection(
baseOffset: 0, extentOffset: textEditingController.text.length);

_textStyleModel = TextStyleModel(
widget.text,
textStyle: widget.textStyle,
Expand Down Expand Up @@ -182,10 +186,13 @@ class _TextEditorState extends State<TextEditor> {
child: Container(
child: Center(
child: TextField(
controller: TextEditingController()
controller: textEditingController
..text = _textStyleModel.text,
onChanged: (value) => _textStyleModel.text = value,
maxLines: null,
enableIMEPersonalizedLearning: true,
enableInteractiveSelection: true,
enableSuggestions: true,
keyboardType: TextInputType.multiline,
style: _textStyleModel.textStyle,
textAlign: _textStyleModel.textAlign!,
Expand Down

0 comments on commit fb7d102

Please sign in to comment.