Skip to content

Commit b9f4a19

Browse files
Merge pull request #90 from andrew-bekhiet-solid/feat-add-missing-text-field-properties
feat: add missing text field properties
2 parents 9367d73 + 37abad8 commit b9f4a19

File tree

3 files changed

+181
-80
lines changed

3 files changed

+181
-80
lines changed

CHANGELOG.md

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,52 @@
1+
## 1.0.0
2+
3+
- BREAKING: rename autoFocus to autofocus to match `TextField`'s naming
4+
- Add missing properties from flutter's `TextField`
5+
- autofillHints
6+
- autofocus
7+
- buildCounter
8+
- canRequestFocus
9+
- clipBehavior
10+
- contentInsertionConfiguration
11+
- contextMenuBuilder
12+
- cursorErrorColor
13+
- cursorHeight
14+
- cursorOpacityAnimates
15+
- cursorRadius
16+
- cursorWidth
17+
- dragStartBehavior
18+
- enabled
19+
- enableIMEPersonalizedLearning
20+
- enableInteractiveSelection
21+
- enableSuggestions
22+
- ignorePointers
23+
- inputFormatters
24+
- key
25+
- magnifierConfiguration
26+
- maxLength
27+
- maxLengthEnforcement
28+
- obscureText
29+
- obscuringCharacter
30+
- onTapAlwaysCalled
31+
- onTapUpOutside
32+
- restorationId
33+
- scrollController
34+
- scrollPadding
35+
- scrollPhysics
36+
- selectionControls
37+
- selectionHeightStyle
38+
- selectionWidthStyle
39+
- showCursor
40+
- smartDashesType
41+
- smartQuotesType
42+
- spellCheckConfiguration
43+
- statesController
44+
- strutStyle
45+
- stylusHandwritingEnabled
46+
- textAlignVertical
47+
- textCapitalization
48+
- undoController
49+
150
## 0.1.1
251

352
- Fix changelog
@@ -13,7 +62,7 @@
1362
## 0.0.6
1463

1564
- Add textAlign and textDirection arguments to LanguageToolTextField constructor
16-
- Enforce utf-8 decoding format for LanguageTool API responses.
65+
- Enforce utf-8 decoding format for LanguageTool API responses.
1766

1867
Credits: @Semsem-programmer
1968

lib/src/presentation/language_tool_text_field.dart

Lines changed: 128 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -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) {

pubspec.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
name: languagetool_textfield
22
description: The LanguageTool TextField package is a spell-checker designed for Flutter apps. This is useful for apps that need text input like messaging, notes, and email.
3-
version: 0.1.1
3+
version: 1.0.0
44
homepage: https://github.com/solid-software/languagetool_textfield/
55

6-
76
environment:
8-
sdk: '>=2.18.6 <4.0.0'
7+
sdk: ">=2.18.6 <4.0.0"
98
flutter: ">=1.17.0"
109

1110
dependencies:
@@ -14,8 +13,8 @@ dependencies:
1413
flutter:
1514
sdk: flutter
1615
http: ^1.0.0
17-
throttling: ^2.0.1
1816
pointer_interceptor: ^0.10.1
17+
throttling: ^2.0.1
1918

2019
dev_dependencies:
2120
flutter_test:

0 commit comments

Comments
 (0)