@@ -5,81 +5,91 @@ import 'package:languagetool_textfield/src/utils/popup_overlay_renderer.dart';
55
66/// A TextField widget that checks the grammar using the given
77/// [LanguageToolController]
8- class LanguageToolTextField extends StatefulWidget {
9- /// A style to use for the text being edited.
10- final TextStyle ? style;
11-
12- /// A decoration of this [TextField] .
13- final InputDecoration decoration;
14-
15- /// Color scheme to highlight mistakes
16- final LanguageToolController controller;
8+ class LanguageToolTextField extends TextField {
9+ /// LanguageToolController to highlight mistakes
10+ @override
11+ LanguageToolController get controller =>
12+ super .controller as LanguageToolController ? ?? LanguageToolController ();
1713
1814 /// Mistake popup window
1915 final MistakePopup ? mistakePopup;
2016
21- /// The maximum number of lines to show at one time, wrapping if necessary.
22- final int ? maxLines;
23-
24- /// The minimum number of lines to occupy when the content spans fewer lines.
25- final int ? minLines;
26-
27- /// Whether this widget's height will be sized to fill its parent.
28- final bool expands;
29-
3017 /// A language code like en-US, de-DE, fr, or auto to guess
3118 /// the language automatically.
3219 /// ```language``` = 'auto' by default.
3320 final String language;
3421
35- /// Determine text alignment
36- /// textAlign = [TextAlign.start] by default.
37- final TextAlign textAlign;
38-
39- /// Determine text Direction
40- final TextDirection ? textDirection;
41-
42- final ValueChanged <String >? onTextChange;
43- final ValueChanged <String >? onTextSubmitted;
44- final VoidCallback ? onTap;
45- final TapRegionCallback ? onTapOutside;
46- final TextInputAction ? textInputAction;
47- final TextInputType ? keyboardType;
48- final Color ? cursorColor;
49- final bool autoFocus;
50- final FocusNode ? focusNode;
51- final Brightness ? keyboardAppearance;
52- final bool autocorrect;
53- final bool readOnly;
54- final MouseCursor ? mouseCursor;
22+ /// Whether to center align the text field widget.
5523 final bool alignCenter;
5624
5725 /// Creates a widget that checks grammar errors.
5826 const LanguageToolTextField ({
59- required this .controller,
60- this .style,
61- this .decoration = const InputDecoration (),
62- this .language = 'auto' ,
27+ required LanguageToolController super .controller,
6328 this .mistakePopup,
64- this .maxLines = 1 ,
65- this .minLines,
66- this .expands = false ,
67- this .textAlign = TextAlign .start,
68- this .textDirection,
69- this .cursorColor,
70- this .autocorrect = true ,
71- this .autoFocus = false ,
72- this .readOnly = false ,
73- this .textInputAction,
74- this .keyboardType,
75- this .focusNode,
76- this .keyboardAppearance,
77- this .mouseCursor,
78- this .onTap,
79- this .onTapOutside,
80- this .onTextChange,
81- this .onTextSubmitted,
29+ this .language = 'auto' ,
8230 this .alignCenter = true ,
31+ super .onChanged,
32+ super .onSubmitted,
33+ super .focusNode,
34+ super .undoController,
35+ super .decoration,
36+ super .keyboardType,
37+ super .textInputAction,
38+ super .textCapitalization,
39+ super .style,
40+ super .strutStyle,
41+ super .textAlign,
42+ super .textAlignVertical,
43+ super .textDirection,
44+ super .readOnly,
45+ super .showCursor,
46+ super .autofocus,
47+ super .statesController,
48+ super .obscuringCharacter,
49+ super .obscureText,
50+ super .autocorrect,
51+ super .smartDashesType,
52+ super .smartQuotesType,
53+ super .enableSuggestions,
54+ super .maxLines,
55+ super .minLines,
56+ super .expands,
57+ super .maxLength,
58+ super .maxLengthEnforcement,
59+ super .inputFormatters,
60+ super .enabled,
61+ super .ignorePointers,
62+ super .cursorWidth,
63+ super .cursorHeight,
64+ super .cursorRadius,
65+ super .cursorOpacityAnimates,
66+ super .cursorColor,
67+ super .cursorErrorColor,
68+ super .selectionHeightStyle,
69+ super .selectionWidthStyle,
70+ super .keyboardAppearance,
71+ super .scrollPadding,
72+ super .dragStartBehavior,
73+ super .enableInteractiveSelection,
74+ super .selectionControls,
75+ super .onTap,
76+ super .onTapAlwaysCalled,
77+ super .onTapOutside,
78+ super .onTapUpOutside,
79+ super .mouseCursor,
80+ super .buildCounter,
81+ super .scrollController,
82+ super .scrollPhysics,
83+ super .autofillHints,
84+ super .contentInsertionConfiguration,
85+ super .clipBehavior,
86+ super .restorationId,
87+ super .stylusHandwritingEnabled,
88+ super .enableIMEPersonalizedLearning,
89+ super .contextMenuBuilder,
90+ super .canRequestFocus,
91+ super .spellCheckConfiguration,
92+ super .magnifierConfiguration,
8393 super .key,
8494 });
8595
@@ -121,33 +131,76 @@ class _LanguageToolTextFieldState extends State<LanguageToolTextField> {
121131 ),
122132 );
123133
124- final inputDecoration = widget.decoration.copyWith (
134+ final inputDecoration = widget.decoration? .copyWith (
125135 suffix: fetchError != null ? httpErrorText : null ,
126136 );
127137
128138 Widget childWidget = TextField (
129- textAlign: widget.textAlign,
130- textDirection: widget.textDirection,
131- focusNode: _focusNode,
132139 controller: widget.controller,
140+ focusNode: _focusNode,
133141 scrollController: _scrollController,
134142 decoration: inputDecoration,
135- minLines: widget.minLines,
143+ keyboardType: widget.keyboardType,
144+ textInputAction: widget.textInputAction,
145+ textCapitalization: widget.textCapitalization,
146+ style: widget.style,
147+ strutStyle: widget.strutStyle,
148+ textAlign: widget.textAlign,
149+ textAlignVertical: widget.textAlignVertical,
150+ textDirection: widget.textDirection,
151+ autofocus: widget.autofocus,
152+ statesController: widget.statesController,
153+ readOnly: widget.readOnly,
154+ showCursor: widget.showCursor,
155+ obscuringCharacter: widget.obscuringCharacter,
156+ obscureText: widget.obscureText,
157+ autocorrect: widget.autocorrect,
158+ smartDashesType: widget.smartDashesType,
159+ smartQuotesType: widget.smartQuotesType,
160+ enableSuggestions: widget.enableSuggestions,
161+ maxLengthEnforcement: widget.maxLengthEnforcement,
136162 maxLines: widget.maxLines,
163+ minLines: widget.minLines,
137164 expands: widget.expands,
138- style: widget.style,
165+ maxLength: widget.maxLength,
166+ onChanged: widget.onChanged,
167+ onTap: widget.onTap,
168+ onTapAlwaysCalled: widget.onTapAlwaysCalled,
169+ onTapOutside: widget.onTapOutside,
170+ onTapUpOutside: widget.onTapUpOutside,
171+ onEditingComplete: widget.onEditingComplete,
172+ onSubmitted: widget.onSubmitted,
173+ inputFormatters: widget.inputFormatters,
174+ enabled: widget.enabled,
175+ ignorePointers: widget.ignorePointers,
176+ cursorWidth: widget.cursorWidth,
177+ cursorHeight: widget.cursorHeight,
178+ cursorRadius: widget.cursorRadius,
139179 cursorColor: widget.cursorColor,
140- autocorrect: widget.autocorrect,
141- textInputAction: widget.textInputAction,
180+ cursorErrorColor: widget.cursorErrorColor,
181+ scrollPadding: widget.scrollPadding,
182+ scrollPhysics: widget.scrollPhysics,
142183 keyboardAppearance: widget.keyboardAppearance,
143- keyboardType: widget.keyboardType,
144- autofocus: widget.autoFocus,
145- readOnly: widget.readOnly,
184+ enableInteractiveSelection: widget.enableInteractiveSelection,
185+ selectionControls: widget.selectionControls,
186+ buildCounter: widget.buildCounter,
187+ autofillHints: widget.autofillHints,
146188 mouseCursor: widget.mouseCursor,
147- onChanged: widget.onTextChange,
148- onSubmitted: widget.onTextSubmitted,
149- onTap: widget.onTap,
150- onTapOutside: widget.onTapOutside,
189+ contextMenuBuilder: widget.contextMenuBuilder,
190+ spellCheckConfiguration: widget.spellCheckConfiguration,
191+ magnifierConfiguration: widget.magnifierConfiguration,
192+ undoController: widget.undoController,
193+ onAppPrivateCommand: widget.onAppPrivateCommand,
194+ cursorOpacityAnimates: widget.cursorOpacityAnimates,
195+ selectionHeightStyle: widget.selectionHeightStyle,
196+ selectionWidthStyle: widget.selectionWidthStyle,
197+ dragStartBehavior: widget.dragStartBehavior,
198+ contentInsertionConfiguration: widget.contentInsertionConfiguration,
199+ clipBehavior: widget.clipBehavior,
200+ stylusHandwritingEnabled: widget.stylusHandwritingEnabled,
201+ canRequestFocus: widget.canRequestFocus,
202+ enableIMEPersonalizedLearning: widget.enableIMEPersonalizedLearning,
203+ restorationId: widget.restorationId,
151204 );
152205
153206 if (widget.alignCenter) {
0 commit comments