@@ -11,6 +11,8 @@ import '../utils/edge_insets.dart';
11
11
import '../utils/form_field.dart' ;
12
12
import '../utils/gradient.dart' ;
13
13
import '../utils/images.dart' ;
14
+ import '../utils/others.dart' ;
15
+ import '../utils/overlay_style.dart' ;
14
16
import '../utils/text.dart' ;
15
17
import '../utils/textfield.dart' ;
16
18
import 'create_control.dart' ;
@@ -159,22 +161,14 @@ class _CupertinoTextFieldControlState extends State<CupertinoTextFieldControl>
159
161
inputFormatters.add (TextCapitalizationFormatter (textCapitalization));
160
162
}
161
163
162
- TextInputType keyboardType = multiline
163
- ? TextInputType .multiline
164
- : parseTextInputType (
165
- widget.control.attrString ("keyboardType" ), TextInputType .text)! ;
166
-
167
164
TextAlign textAlign = parseTextAlign (
168
165
widget.control.attrString ("textAlign" ), TextAlign .start)! ;
169
166
170
167
double ? textVerticalAlign = widget.control.attrDouble ("textVerticalAlign" );
171
168
172
169
bool rtl = widget.control.attrBool ("rtl" , false )! ;
173
170
bool autocorrect = widget.control.attrBool ("autocorrect" , true )! ;
174
- bool enableSuggestions =
175
- widget.control.attrBool ("enableSuggestions" , true )! ;
176
- bool smartDashesType = widget.control.attrBool ("smartDashesType" , true )! ;
177
- bool smartQuotesType = widget.control.attrBool ("smartQuotesType" , true )! ;
171
+ ;
178
172
179
173
FocusNode focusNode = shiftEnter ? _shiftEnterfocusNode : _focusNode;
180
174
@@ -228,29 +222,25 @@ class _CupertinoTextFieldControlState extends State<CupertinoTextFieldControl>
228
222
}),
229
223
);
230
224
}
231
-
225
+ var fitParentSize = widget.control. attrBool ( "fitParentSize" , false ) ! ;
232
226
BoxDecoration ? defaultDecoration = const CupertinoTextField ().decoration;
233
227
var gradient = parseGradient (Theme .of (context), widget.control, "gradient" );
234
228
var blendMode = parseBlendMode (widget.control.attrString ("blendMode" ));
235
229
236
230
var bgColor = widget.control.attrColor ("bgColor" , context);
237
- // for adaptive TextField use label for placeholder
238
- var placeholder = widget.control.attrString ("placeholderText" ) ??
239
- widget.control.attrString ("label" );
240
- // for adaptive TextField use labelStyle for placeholderStyle
241
- var placeholderStyle =
242
- parseTextStyle (Theme .of (context), widget.control, "placeholderStyle" ) ??
243
- parseTextStyle (Theme .of (context), widget.control, "labelStyle" );
231
+
244
232
return withPageArgs ((context, pageArgs) {
245
- var decorationImage = parseDecorationImage (
246
- Theme .of (context), widget.control, "image" , pageArgs);
247
233
Widget textField = CupertinoTextField (
248
234
style: textStyle,
249
235
textAlignVertical: textVerticalAlign != null
250
236
? TextAlignVertical (y: textVerticalAlign)
251
237
: null ,
252
- placeholder: placeholder,
253
- placeholderStyle: placeholderStyle,
238
+ placeholder: widget.control.attrString ("placeholderText" ) ??
239
+ widget.control.attrString ("label" ),
240
+ // use label for adaptive TextField
241
+ placeholderStyle: parseTextStyle (Theme .of (context), widget.control, "placeholderStyle" ) ??
242
+ parseTextStyle (Theme .of (context), widget.control, "labelStyle" ),
243
+ // labelStyle for adaptive TextField
254
244
autofocus: autofocus,
255
245
enabled: ! disabled,
256
246
onSubmitted: ! multiline
@@ -262,7 +252,8 @@ class _CupertinoTextFieldControlState extends State<CupertinoTextFieldControl>
262
252
decoration: defaultDecoration? .copyWith (
263
253
color: bgColor,
264
254
gradient: gradient,
265
- image: decorationImage,
255
+ image: parseDecorationImage (
256
+ Theme .of (context), widget.control, "image" , pageArgs),
266
257
backgroundBlendMode:
267
258
bgColor != null || gradient != null ? blendMode : null ,
268
259
border: border,
@@ -274,47 +265,54 @@ class _CupertinoTextFieldControlState extends State<CupertinoTextFieldControl>
274
265
cursorWidth: widget.control.attrDouble ("cursorWidth" , 2.0 )! ,
275
266
cursorRadius: parseRadius (
276
267
widget.control, "cursorRadius" , const Radius .circular (2.0 ))! ,
277
- keyboardType: keyboardType,
268
+ keyboardType: multiline
269
+ ? TextInputType .multiline
270
+ : parseTextInputType (widget.control.attrString ("keyboardType" ),
271
+ TextInputType .text)! ,
278
272
clearButtonSemanticLabel:
279
273
widget.control.attrString ("clearButtonSemanticsLabel" ),
280
274
autocorrect: autocorrect,
281
- enableSuggestions: enableSuggestions,
282
- smartDashesType: smartDashesType
275
+ enableSuggestions:
276
+ widget.control.attrBool ("enableSuggestions" , true )! ,
277
+ smartDashesType: widget.control.attrBool ("smartDashesType" , true )!
283
278
? SmartDashesType .enabled
284
279
: SmartDashesType .disabled,
285
- smartQuotesType: smartQuotesType
280
+ smartQuotesType: widget.control. attrBool ( " smartQuotesType" , true ) !
286
281
? SmartQuotesType .enabled
287
282
: SmartQuotesType .disabled,
288
283
suffixMode: parseVisibilityMode (
289
- widget.control.attrString ("suffixVisibilityMode" , "" )! ),
284
+ widget.control.attrString ("suffixVisibilityMode" ),
285
+ OverlayVisibilityMode .always)! ,
290
286
prefixMode: parseVisibilityMode (
291
- widget.control.attrString ("prefixVisibilityMode" , "" )! ),
287
+ widget.control.attrString ("prefixVisibilityMode" ),
288
+ OverlayVisibilityMode .always)! ,
292
289
textAlign: textAlign,
293
- minLines: minLines,
294
- maxLines: maxLines,
290
+ minLines: fitParentSize ? null : minLines,
291
+ maxLines: fitParentSize ? null : maxLines,
295
292
maxLength: maxLength,
296
293
prefix: prefixControls.isNotEmpty
297
294
? createControl (widget.control, prefixControls.first.id, disabled,
298
295
parentAdaptive: widget.parentAdaptive)
299
296
: null ,
300
- suffix: revealPasswordIcon ??
301
- (suffixControls.isNotEmpty
302
- ? createControl (
303
- widget.control, suffixControls.first.id, disabled,
304
- parentAdaptive: widget.parentAdaptive)
305
- : null ),
297
+ suffix: revealPasswordIcon ?? (suffixControls.isNotEmpty ? createControl (widget.control, suffixControls.first.id, disabled, parentAdaptive: widget.parentAdaptive) : null ),
306
298
readOnly: readOnly,
307
299
textDirection: rtl ? TextDirection .rtl : null ,
308
300
inputFormatters: inputFormatters.isNotEmpty ? inputFormatters : null ,
309
301
obscureText: password && ! _revealPassword,
310
- padding: parseEdgeInsets (
311
- widget.control, "padding" , const EdgeInsets .all (7.0 ))! ,
302
+ padding: parseEdgeInsets (widget.control, "padding" , const EdgeInsets .all (7.0 ))! ,
312
303
scribbleEnabled: widget.control.attrBool ("enableScribble" , true )! ,
304
+ scrollPadding: parseEdgeInsets (widget.control, "scrollPadding" , const EdgeInsets .all (20.0 ))! ,
305
+ obscuringCharacter: widget.control.attrString ("obscuringCharacter" , '•' )! ,
306
+ cursorOpacityAnimates: widget.control.attrBool ("animateCursorOpacity" , Theme .of (context).platform == TargetPlatform .iOS)! ,
307
+ expands: fitParentSize,
308
+ enableIMEPersonalizedLearning: widget.control.attrBool ("enableIMEPersonalizedLearning" , true )! ,
309
+ clipBehavior: parseClip (widget.control.attrString ("clipBehavior" ), Clip .hardEdge)! ,
310
+ cursorColor: cursorColor,
313
311
autofillHints: parseAutofillHints (widget.control, "autofillHints" ),
314
- scrollPadding : parseEdgeInsets (
315
- widget.control, "scrollPadding" , const EdgeInsets . all ( 20.0 )) ! ,
316
- obscuringCharacter :
317
- widget.control. attrString ( "obscuringCharacter" , '•' ) ! ,
312
+ keyboardAppearance : parseBrightness (widget.control. attrString ( "keyboardBrightness" )),
313
+ enableInteractiveSelection : widget.control. attrBool ( "enableInteractiveSelection" ) ,
314
+ clearButtonMode : parseVisibilityMode (widget.control. attrString ( "clearButtonVisibilityMode" ), OverlayVisibilityMode .never) ! ,
315
+ strutStyle : parseStrutStyle ( widget.control, "strutStyle" ) ,
318
316
onTap: () {
319
317
widget.backend.triggerControlEvent (widget.control.id, "click" );
320
318
},
0 commit comments