@@ -96,6 +96,7 @@ class PassiveTextFieldWidget extends StatefulWidget {
9696 final Function (BuildContext context, List <Reaction > reactions, String value)?
9797 onIconTap;
9898 final bool useIconFonts;
99+ final bool withAutofill;
99100 final AutovalidateMode ? autovalidateMode;
100101 final FormFieldValidator <String >? validator;
101102
@@ -107,6 +108,7 @@ class PassiveTextFieldWidget extends StatefulWidget {
107108 this .onChanged,
108109 this .onSubmitted,
109110 this .useIconFonts = false ,
111+ this .withAutofill = true ,
110112 this .onIconTap,
111113 List <VariableData >? variables,
112114 this .autovalidateMode,
@@ -205,39 +207,38 @@ class _PassiveTextFieldWidgetState extends State<PassiveTextFieldWidget> {
205207
206208 @override
207209 Widget build (BuildContext context) {
208- final bool enabled = context.getNodeValue (widget.node.id, 'enabled' ) ??
209- widget.node.properties.enabled;
210+ final TextFieldNode node = widget.node;
211+ final TextFieldProperties properties = node.properties;
212+
213+ final bool enabled =
214+ context.getNodeValue (node.id, 'enabled' ) ?? properties.enabled;
210215 final bool obscureText =
211- context.getNodeValue (widget.node.id, 'obscureText' ) ??
212- widget.node.properties.obscureText;
213- final bool readOnly = context.getNodeValue (widget.node.id, 'readOnly' ) ??
214- widget.node.properties.readOnly;
216+ context.getNodeValue (node.id, 'obscureText' ) ?? properties.obscureText;
217+ final bool readOnly =
218+ context.getNodeValue (node.id, 'readOnly' ) ?? properties.readOnly;
215219 final bool showCursor =
216- context.getNodeValue (widget.node.id, 'showCursor' ) ??
217- widget.node.properties.showCursor;
218- final int ? maxLength = context.getNodeValue (widget.node.id, 'maxLength' ) ??
219- widget.node.properties.maxLength;
220+ context.getNodeValue (node.id, 'showCursor' ) ?? properties.showCursor;
221+ final int ? maxLength =
222+ context.getNodeValue (node.id, 'maxLength' ) ?? properties.maxLength;
220223
221224 final ScopedValues scopedValues = ScopedValues .of (context);
222225
223226 final TextInputType keyboardType =
224- widget.node. properties.keyboardType == TextInputTypeEnum .number
227+ properties.keyboardType == TextInputTypeEnum .number
225228 ? TextInputType .numberWithOptions (
226- decimal: widget.node. properties.showDecimalKey,
227- signed: widget.node. properties.showSignKey)
228- : widget.node. properties.keyboardType.toFlutter ();
229+ decimal: properties.showDecimalKey,
230+ signed: properties.showSignKey)
231+ : properties.keyboardType.toFlutter ();
229232
230- final TextInputValidatorModel validatorModel =
231- widget.node.properties.validator;
233+ final TextInputValidatorModel validatorModel = properties.validator;
232234 final FormFieldValidator <String > validator =
233235 widget.validator ?? validatorModel.validate;
234236
235237 Widget field = TextFormField (
236238 focusNode: focusNode,
237- autocorrect: widget.node.properties.autoCorrect,
238- autofocus: ! widget.settings.isPreview && widget.node.properties.autoFocus,
239- enableInteractiveSelection:
240- widget.node.properties.enableInteractiveSelection,
239+ autocorrect: properties.autoCorrect,
240+ autofocus: ! widget.settings.isPreview && properties.autoFocus,
241+ enableInteractiveSelection: properties.enableInteractiveSelection,
241242 enabled: enabled,
242243 controller: controller,
243244 obscureText: widget.node.properties.maxLines == 1 &&
@@ -246,18 +247,14 @@ class _PassiveTextFieldWidgetState extends State<PassiveTextFieldWidget> {
246247 readOnly: readOnly,
247248 showCursor: showCursor,
248249 keyboardType: keyboardType,
249- selectionHeightStyle:
250- widget.node.properties.selectionHeightStyle.toFlutter (),
251- selectionWidthStyle:
252- widget.node.properties.selectionWidthStyle.toFlutter (),
253- textAlign: widget.node.properties.textAlign.toFlutter (),
254- textAlignVertical:
255- widget.node.properties.textAlignVertical.flutterTextAlignVertical,
256- cursorColor:
257- widget.node.properties.cursorColor.toFlutterColor (opacity: 1 ),
258- cursorHeight: widget.node.properties.cursorHeight,
259- cursorWidth: widget.node.properties.cursorWidth,
260- cursorRadius: Radius .circular (widget.node.properties.cursorRadius),
250+ selectionHeightStyle: properties.selectionHeightStyle.toFlutter (),
251+ selectionWidthStyle: properties.selectionWidthStyle.toFlutter (),
252+ textAlign: properties.textAlign.toFlutter (),
253+ textAlignVertical: properties.textAlignVertical.flutterTextAlignVertical,
254+ cursorColor: properties.cursorColor.toFlutterColor (opacity: 1 ),
255+ cursorHeight: properties.cursorHeight,
256+ cursorWidth: properties.cursorWidth,
257+ cursorRadius: Radius .circular (properties.cursorRadius),
261258 maxLength: maxLength,
262259 validator: validator,
263260 autovalidateMode: widget.autovalidateMode ??
@@ -268,8 +265,7 @@ class _PassiveTextFieldWidgetState extends State<PassiveTextFieldWidget> {
268265 : null ,
269266 inputFormatters: [
270267 if (maxLength != null ) LengthLimitingTextInputFormatter (maxLength),
271- if (widget.node.properties.formatter.toFlutterFormatter ()
272- case var formatter? )
268+ if (properties.formatter.toFlutterFormatter () case var formatter? )
273269 formatter,
274270 ],
275271 maxLines:
@@ -288,23 +284,23 @@ class _PassiveTextFieldWidgetState extends State<PassiveTextFieldWidget> {
288284 },
289285 decoration: getDecoration (
290286 context,
291- widget. node,
292- widget.node. properties.decoration,
287+ node,
288+ properties.decoration,
293289 widget.useIconFonts,
294290 widget.settings,
295291 scopedValues,
296292 ),
297293 );
298294
299- if (widget. node.isHorizontalWrap) {
295+ if (node.isHorizontalWrap) {
300296 field = IntrinsicWidth (child: field);
301297 }
302- if (widget. node.isVerticalWrap) {
298+ if (node.isVerticalWrap) {
303299 field = IntrinsicHeight (child: field);
304300 }
305301
306302 field = AdaptiveNodeBox (
307- node: widget. node,
303+ node: node,
308304 child: field,
309305 );
310306
0 commit comments