Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
1bc84024
Commit
1bc84024
authored
Jun 11, 2019
by
guoskyhero
Committed by
Justin McCandless
Jun 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add hintStyle in SearchDelegate (#30388)
SearchDelegate hintStyle parameter
parent
336e4c4c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletion
+25
-1
search.dart
packages/flutter/lib/src/material/search.dart
+1
-0
search_test.dart
packages/flutter/test/material/search_test.dart
+24
-1
No files found.
packages/flutter/lib/src/material/search.dart
View file @
1bc84024
...
...
@@ -466,6 +466,7 @@ class _SearchPageState<T> extends State<_SearchPage<T>> {
decoration:
InputDecoration
(
border:
InputBorder
.
none
,
hintText:
searchFieldLabel
,
hintStyle:
theme
.
inputDecorationTheme
.
hintStyle
,
),
),
actions:
widget
.
delegate
.
buildActions
(
context
),
...
...
packages/flutter/test/material/search_test.dart
View file @
1bc84024
...
...
@@ -91,6 +91,20 @@ void main() {
expect
(
find
.
text
(
'Suggestions'
),
findsOneWidget
);
});
testWidgets
(
'Hint text color overridden'
,
(
WidgetTester
tester
)
async
{
final
_TestSearchDelegate
delegate
=
_TestSearchDelegate
();
await
tester
.
pumpWidget
(
TestHomePage
(
delegate:
delegate
,
));
await
tester
.
tap
(
find
.
byTooltip
(
'Search'
));
await
tester
.
pumpAndSettle
();
final
TextField
textField
=
tester
.
widget
<
TextField
>(
find
.
byType
(
TextField
));
final
Color
hintColor
=
textField
.
decoration
.
hintStyle
.
color
;
expect
(
hintColor
,
delegate
.
hintTextColor
);
});
testWidgets
(
'Requests suggestions'
,
(
WidgetTester
tester
)
async
{
final
_TestSearchDelegate
delegate
=
_TestSearchDelegate
();
...
...
@@ -644,6 +658,15 @@ class _TestSearchDelegate extends SearchDelegate<String> {
final
String
suggestions
;
final
String
result
;
final
List
<
Widget
>
actions
;
final
Color
hintTextColor
=
Colors
.
green
;
@override
ThemeData
appBarTheme
(
BuildContext
context
)
{
final
ThemeData
theme
=
Theme
.
of
(
context
);
return
theme
.
copyWith
(
inputDecorationTheme:
InputDecorationTheme
(
hintStyle:
TextStyle
(
color:
hintTextColor
)),
);
}
@override
Widget
buildLeading
(
BuildContext
context
)
{
...
...
@@ -680,4 +703,4 @@ class _TestSearchDelegate extends SearchDelegate<String> {
List
<
Widget
>
buildActions
(
BuildContext
context
)
{
return
actions
;
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment