mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
InputDecorator iconColor/prefixIconColor/suffixIconColor (#109988)
This commit is contained in:
parent
c43e44b48a
commit
6a1fc9eae6
@ -1991,17 +1991,20 @@ class _InputDecoratorState extends State<InputDecorator> with TickerProviderStat
|
||||
}
|
||||
|
||||
Color _getIconColor(ThemeData themeData, InputDecorationTheme defaults) {
|
||||
return MaterialStateProperty.resolveAs(themeData.inputDecorationTheme.iconColor, materialState)
|
||||
return MaterialStateProperty.resolveAs(decoration.iconColor, materialState)
|
||||
?? MaterialStateProperty.resolveAs(themeData.inputDecorationTheme.iconColor, materialState)
|
||||
?? MaterialStateProperty.resolveAs(defaults.iconColor!, materialState);
|
||||
}
|
||||
|
||||
Color _getPrefixIconColor(ThemeData themeData, InputDecorationTheme defaults) {
|
||||
return MaterialStateProperty.resolveAs(themeData.inputDecorationTheme.prefixIconColor, materialState)
|
||||
return MaterialStateProperty.resolveAs(decoration.prefixIconColor, materialState)
|
||||
?? MaterialStateProperty.resolveAs(themeData.inputDecorationTheme.prefixIconColor, materialState)
|
||||
?? MaterialStateProperty.resolveAs(defaults.prefixIconColor!, materialState);
|
||||
}
|
||||
|
||||
Color _getSuffixIconColor(ThemeData themeData, InputDecorationTheme defaults) {
|
||||
return MaterialStateProperty.resolveAs(themeData.inputDecorationTheme.suffixIconColor, materialState)
|
||||
return MaterialStateProperty.resolveAs(decoration.suffixIconColor, materialState)
|
||||
?? MaterialStateProperty.resolveAs(themeData.inputDecorationTheme.suffixIconColor, materialState)
|
||||
?? MaterialStateProperty.resolveAs(defaults.suffixIconColor!, materialState);
|
||||
}
|
||||
|
||||
|
@ -1657,6 +1657,30 @@ void main() {
|
||||
expect(tester.getTopRight(find.text('text')).dx, lessThanOrEqualTo(tester.getTopLeft(find.text('s')).dx));
|
||||
});
|
||||
|
||||
testWidgets('InputDecorator iconColor/prefixIconColor/suffixIconColor', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: Material(
|
||||
child: TextField(
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(Icons.cabin),
|
||||
prefixIcon: Icon(Icons.sailing),
|
||||
suffixIcon: Icon(Icons.close),
|
||||
iconColor: Colors.amber,
|
||||
prefixIconColor: Colors.green,
|
||||
suffixIconColor: Colors.red,
|
||||
filled: true,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(tester.widget<IconTheme>(find.widgetWithIcon(IconTheme,Icons.cabin).first).data.color, Colors.amber);
|
||||
expect(tester.widget<IconTheme>(find.widgetWithIcon(IconTheme,Icons.sailing).first).data.color, Colors.green);
|
||||
expect(tester.widget<IconTheme>(find.widgetWithIcon(IconTheme,Icons.close).first).data.color, Colors.red);
|
||||
});
|
||||
|
||||
testWidgets('InputDecorator prefix/suffix widgets', (WidgetTester tester) async {
|
||||
const Key pKey = Key('p');
|
||||
const Key sKey = Key('s');
|
||||
|
Loading…
Reference in New Issue
Block a user