@@ -293,6 +293,7 @@ class TextField extends StatefulWidget {
293
293
this .cursorWidth = 2.0 ,
294
294
this .cursorHeight,
295
295
this .cursorRadius,
296
+ this .cursorOpacityAnimates,
296
297
this .cursorColor,
297
298
this .selectionHeightStyle = ui.BoxHeightStyle .tight,
298
299
this .selectionWidthStyle = ui.BoxWidthStyle .tight,
@@ -581,6 +582,9 @@ class TextField extends StatefulWidget {
581
582
/// {@macro flutter.widgets.editableText.cursorRadius}
582
583
final Radius ? cursorRadius;
583
584
585
+ /// {@macro flutter.widgets.editableText.cursorOpacityAnimates}
586
+ final bool ? cursorOpacityAnimates;
587
+
584
588
/// The color of the cursor.
585
589
///
586
590
/// The cursor indicates the current location of text insertion point in
@@ -863,6 +867,7 @@ class TextField extends StatefulWidget {
863
867
properties.add (DoubleProperty ('cursorWidth' , cursorWidth, defaultValue: 2.0 ));
864
868
properties.add (DoubleProperty ('cursorHeight' , cursorHeight, defaultValue: null ));
865
869
properties.add (DiagnosticsProperty <Radius >('cursorRadius' , cursorRadius, defaultValue: null ));
870
+ properties.add (DiagnosticsProperty <bool >('cursorOpacityAnimates' , cursorOpacityAnimates, defaultValue: null ));
866
871
properties.add (ColorProperty ('cursorColor' , cursorColor, defaultValue: null ));
867
872
properties.add (DiagnosticsProperty <Brightness >('keyboardAppearance' , keyboardAppearance, defaultValue: null ));
868
873
properties.add (DiagnosticsProperty <EdgeInsetsGeometry >('scrollPadding' , scrollPadding, defaultValue: const EdgeInsets .all (20.0 )));
@@ -1248,7 +1253,7 @@ class _TextFieldState extends State<TextField> with RestorationMixin implements
1248
1253
1249
1254
TextSelectionControls ? textSelectionControls = widget.selectionControls;
1250
1255
final bool paintCursorAboveText;
1251
- final bool cursorOpacityAnimates;
1256
+ bool ? cursorOpacityAnimates = widget. cursorOpacityAnimates;
1252
1257
Offset ? cursorOffset;
1253
1258
final Color cursorColor;
1254
1259
final Color selectionColor;
@@ -1262,7 +1267,7 @@ class _TextFieldState extends State<TextField> with RestorationMixin implements
1262
1267
forcePressEnabled = true ;
1263
1268
textSelectionControls ?? = cupertinoTextSelectionHandleControls;
1264
1269
paintCursorAboveText = true ;
1265
- cursorOpacityAnimates = true ;
1270
+ cursorOpacityAnimates ?? = true ;
1266
1271
cursorColor = _hasError ? _errorColor : widget.cursorColor ?? selectionStyle.cursorColor ?? cupertinoTheme.primaryColor;
1267
1272
selectionColor = selectionStyle.selectionColor ?? cupertinoTheme.primaryColor.withOpacity (0.40 );
1268
1273
cursorRadius ?? = const Radius .circular (2.0 );
@@ -1274,7 +1279,7 @@ class _TextFieldState extends State<TextField> with RestorationMixin implements
1274
1279
forcePressEnabled = false ;
1275
1280
textSelectionControls ?? = cupertinoDesktopTextSelectionHandleControls;
1276
1281
paintCursorAboveText = true ;
1277
- cursorOpacityAnimates = false ;
1282
+ cursorOpacityAnimates ?? = false ;
1278
1283
cursorColor = _hasError ? _errorColor : widget.cursorColor ?? selectionStyle.cursorColor ?? cupertinoTheme.primaryColor;
1279
1284
selectionColor = selectionStyle.selectionColor ?? cupertinoTheme.primaryColor.withOpacity (0.40 );
1280
1285
cursorRadius ?? = const Radius .circular (2.0 );
@@ -1291,23 +1296,23 @@ class _TextFieldState extends State<TextField> with RestorationMixin implements
1291
1296
forcePressEnabled = false ;
1292
1297
textSelectionControls ?? = materialTextSelectionHandleControls;
1293
1298
paintCursorAboveText = false ;
1294
- cursorOpacityAnimates = false ;
1299
+ cursorOpacityAnimates ?? = false ;
1295
1300
cursorColor = _hasError ? _errorColor : widget.cursorColor ?? selectionStyle.cursorColor ?? theme.colorScheme.primary;
1296
1301
selectionColor = selectionStyle.selectionColor ?? theme.colorScheme.primary.withOpacity (0.40 );
1297
1302
1298
1303
case TargetPlatform .linux:
1299
1304
forcePressEnabled = false ;
1300
1305
textSelectionControls ?? = desktopTextSelectionHandleControls;
1301
1306
paintCursorAboveText = false ;
1302
- cursorOpacityAnimates = false ;
1307
+ cursorOpacityAnimates ?? = false ;
1303
1308
cursorColor = _hasError ? _errorColor : widget.cursorColor ?? selectionStyle.cursorColor ?? theme.colorScheme.primary;
1304
1309
selectionColor = selectionStyle.selectionColor ?? theme.colorScheme.primary.withOpacity (0.40 );
1305
1310
1306
1311
case TargetPlatform .windows:
1307
1312
forcePressEnabled = false ;
1308
1313
textSelectionControls ?? = desktopTextSelectionHandleControls;
1309
1314
paintCursorAboveText = false ;
1310
- cursorOpacityAnimates = false ;
1315
+ cursorOpacityAnimates ?? = false ;
1311
1316
cursorColor = _hasError ? _errorColor : widget.cursorColor ?? selectionStyle.cursorColor ?? theme.colorScheme.primary;
1312
1317
selectionColor = selectionStyle.selectionColor ?? theme.colorScheme.primary.withOpacity (0.40 );
1313
1318
handleDidGainAccessibilityFocus = () {
0 commit comments