Update CupertinoTextField (#29008)
This commit is contained in:
parent
475d93a172
commit
fa2fd11275
@ -672,6 +672,7 @@ class _CupertinoTextFieldState extends State<CupertinoTextField> with AutomaticK
|
|||||||
final CupertinoThemeData themeData = CupertinoTheme.of(context);
|
final CupertinoThemeData themeData = CupertinoTheme.of(context);
|
||||||
final TextStyle textStyle = themeData.textTheme.textStyle.merge(widget.style);
|
final TextStyle textStyle = themeData.textTheme.textStyle.merge(widget.style);
|
||||||
final Brightness keyboardAppearance = widget.keyboardAppearance ?? themeData.brightness;
|
final Brightness keyboardAppearance = widget.keyboardAppearance ?? themeData.brightness;
|
||||||
|
final Color cursorColor = widget.cursorColor ?? themeData.primaryColor;
|
||||||
|
|
||||||
final Widget paddedEditable = Padding(
|
final Widget paddedEditable = Padding(
|
||||||
padding: widget.padding,
|
padding: widget.padding,
|
||||||
@ -702,7 +703,7 @@ class _CupertinoTextFieldState extends State<CupertinoTextField> with AutomaticK
|
|||||||
rendererIgnoresPointer: true,
|
rendererIgnoresPointer: true,
|
||||||
cursorWidth: widget.cursorWidth,
|
cursorWidth: widget.cursorWidth,
|
||||||
cursorRadius: widget.cursorRadius,
|
cursorRadius: widget.cursorRadius,
|
||||||
cursorColor: themeData.primaryColor,
|
cursorColor: cursorColor,
|
||||||
cursorOpacityAnimates: true,
|
cursorOpacityAnimates: true,
|
||||||
cursorOffset: cursorOffset,
|
cursorOffset: cursorOffset,
|
||||||
paintCursorAboveText: true,
|
paintCursorAboveText: true,
|
||||||
|
@ -1918,4 +1918,20 @@ void main() {
|
|||||||
await tester.pump();
|
await tester.pump();
|
||||||
expect(renderEditable.cursorColor, const Color(0xFFF44336));
|
expect(renderEditable.cursorColor, const Color(0xFFF44336));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testWidgets('cursor can override color from theme', (WidgetTester tester) async {
|
||||||
|
await tester.pumpWidget(
|
||||||
|
const CupertinoApp(
|
||||||
|
theme: CupertinoThemeData(),
|
||||||
|
home: Center(
|
||||||
|
child: CupertinoTextField(
|
||||||
|
cursorColor: Color(0xFFF44336),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
final EditableText editableText = tester.firstWidget(find.byType(EditableText));
|
||||||
|
expect(editableText.cursorColor, const Color(0xFFF44336));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user