@@ -91,6 +91,20 @@ void main() {
9191 expect (find.text ('Suggestions' ), findsOneWidget);
9292 });
9393
94+ testWidgets ('Hint text color overridden' , (WidgetTester tester) async {
95+ final _TestSearchDelegate delegate = _TestSearchDelegate ();
96+
97+ await tester.pumpWidget (TestHomePage (
98+ delegate: delegate,
99+ ));
100+ await tester.tap (find.byTooltip ('Search' ));
101+ await tester.pumpAndSettle ();
102+
103+ final TextField textField = tester.widget <TextField >(find.byType (TextField ));
104+ final Color hintColor = textField.decoration.hintStyle.color;
105+ expect (hintColor, delegate.hintTextColor);
106+ });
107+
94108 testWidgets ('Requests suggestions' , (WidgetTester tester) async {
95109 final _TestSearchDelegate delegate = _TestSearchDelegate ();
96110
@@ -644,6 +658,15 @@ class _TestSearchDelegate extends SearchDelegate<String> {
644658 final String suggestions;
645659 final String result;
646660 final List <Widget > actions;
661+ final Color hintTextColor = Colors .green;
662+
663+ @override
664+ ThemeData appBarTheme (BuildContext context) {
665+ final ThemeData theme = Theme .of (context);
666+ return theme.copyWith (
667+ inputDecorationTheme: InputDecorationTheme (hintStyle: TextStyle (color: hintTextColor)),
668+ );
669+ }
647670
648671 @override
649672 Widget buildLeading (BuildContext context) {
@@ -680,4 +703,4 @@ class _TestSearchDelegate extends SearchDelegate<String> {
680703 List <Widget > buildActions (BuildContext context) {
681704 return actions;
682705 }
683- }
706+ }
0 commit comments