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
3932ffb1
Commit
3932ffb1
authored
Sep 05, 2019
by
Anthony
Committed by
Jim Graham
Sep 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Show search app bar theme (#37962)" (#39786)
This reverts commit
e3f8d055
.
parent
2efbc11b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
108 deletions
+23
-108
search.dart
packages/flutter/lib/src/material/search.dart
+20
-37
search_test.dart
packages/flutter/test/material/search_test.dart
+3
-71
No files found.
packages/flutter/lib/src/material/search.dart
View file @
3932ffb1
...
...
@@ -198,9 +198,6 @@ abstract class SearchDelegate<T> {
primaryIconTheme:
theme
.
primaryIconTheme
.
copyWith
(
color:
Colors
.
grey
),
primaryColorBrightness:
Brightness
.
light
,
primaryTextTheme:
theme
.
textTheme
,
inputDecorationTheme:
theme
.
inputDecorationTheme
.
copyWith
(
border:
InputBorder
.
none
,
),
);
}
...
...
@@ -503,24 +500,28 @@ class _SearchPageState<T> extends State<_SearchPage<T>> {
namesRoute:
true
,
label:
routeName
,
child:
Scaffold
(
appBar:
_ThemedPreferredSizeWidget
(
theme:
theme
,
child:
AppBar
(
leading:
widget
.
delegate
.
buildLeading
(
context
),
title:
TextField
(
controller:
widget
.
delegate
.
_queryTextController
,
focusNode:
focusNode
,
textInputAction:
widget
.
delegate
.
textInputAction
,
keyboardType:
widget
.
delegate
.
keyboardType
,
onSubmitted:
(
String
_
)
{
widget
.
delegate
.
showResults
(
context
);
},
decoration:
InputDecoration
(
hintText:
searchFieldLabel
,
),
appBar:
AppBar
(
backgroundColor:
theme
.
primaryColor
,
iconTheme:
theme
.
primaryIconTheme
,
textTheme:
theme
.
primaryTextTheme
,
brightness:
theme
.
primaryColorBrightness
,
leading:
widget
.
delegate
.
buildLeading
(
context
),
title:
TextField
(
controller:
widget
.
delegate
.
_queryTextController
,
focusNode:
focusNode
,
style:
theme
.
textTheme
.
title
,
textInputAction:
widget
.
delegate
.
textInputAction
,
keyboardType:
widget
.
delegate
.
keyboardType
,
onSubmitted:
(
String
_
)
{
widget
.
delegate
.
showResults
(
context
);
},
decoration:
InputDecoration
(
border:
InputBorder
.
none
,
hintText:
searchFieldLabel
,
hintStyle:
theme
.
inputDecorationTheme
.
hintStyle
,
),
actions:
widget
.
delegate
.
buildActions
(
context
),
),
actions:
widget
.
delegate
.
buildActions
(
context
),
),
body:
AnimatedSwitcher
(
duration:
const
Duration
(
milliseconds:
300
),
...
...
@@ -530,21 +531,3 @@ class _SearchPageState<T> extends State<_SearchPage<T>> {
);
}
}
class
_ThemedPreferredSizeWidget
extends
StatelessWidget
implements
PreferredSizeWidget
{
const
_ThemedPreferredSizeWidget
({
this
.
theme
,
this
.
child
});
final
ThemeData
theme
;
final
PreferredSizeWidget
child
;
@override
Widget
build
(
BuildContext
context
)
{
return
Theme
(
data:
theme
,
child:
child
,
);
}
@override
Size
get
preferredSize
=>
child
.
preferredSize
;
}
packages/flutter/test/material/search_test.dart
View file @
3932ffb1
...
...
@@ -100,13 +100,9 @@ void main() {
await
tester
.
tap
(
find
.
byTooltip
(
'Search'
));
await
tester
.
pumpAndSettle
();
expect
(
tester
.
widget
<
RichText
>(
find
.
descendant
(
of:
find
.
byType
(
TextField
),
matching:
find
.
byType
(
RichText
),
)).
text
.
style
.
color
,
Colors
.
green
,
);
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
{
...
...
@@ -642,49 +638,6 @@ void main() {
semantics
.
dispose
();
});
});
testWidgets
(
'delegate appBarTheme is applied to the AppBar color on the search page'
,
(
WidgetTester
tester
)
async
{
final
_AppBarThemeTestDelegate
delegate
=
_AppBarThemeTestDelegate
(
appBarColor:
Colors
.
green
,
);
await
tester
.
pumpWidget
(
TestHomePage
(
delegate:
delegate
,
));
// Open the search page.
await
tester
.
tap
(
find
.
byTooltip
(
'Search'
));
await
tester
.
pumpAndSettle
();
expect
(
tester
.
widget
<
Material
>(
find
.
descendant
(
of:
find
.
byType
(
AppBar
),
matching:
find
.
byType
(
Material
),
)).
color
,
Colors
.
green
,
);
});
testWidgets
(
'delegate appBarTheme is applied to the enabledBorder of the TextField on the search page'
,
(
WidgetTester
tester
)
async
{
final
_AppBarThemeTestDelegate
delegate
=
_AppBarThemeTestDelegate
(
enabledBorder:
InputBorder
.
none
,
);
await
tester
.
pumpWidget
(
TestHomePage
(
delegate:
delegate
,
));
// Open the search page.
await
tester
.
tap
(
find
.
byTooltip
(
'Search'
));
await
tester
.
pumpAndSettle
();
await
tester
.
enterText
(
find
.
byType
(
TextField
),
'abc'
);
expect
(
tester
.
widget
<
InputDecorator
>(
find
.
descendant
(
of:
find
.
byType
(
AppBar
),
matching:
find
.
byType
(
InputDecorator
),
)).
decoration
.
enabledBorder
,
InputBorder
.
none
,
);
});
}
class
TestHomePage
extends
StatelessWidget
{
...
...
@@ -795,24 +748,3 @@ class _TestSearchDelegate extends SearchDelegate<String> {
return
actions
;
}
}
class
_AppBarThemeTestDelegate
extends
_TestSearchDelegate
{
_AppBarThemeTestDelegate
({
this
.
appBarColor
,
this
.
enabledBorder
});
final
Color
appBarColor
;
final
InputBorder
enabledBorder
;
@override
ThemeData
appBarTheme
(
BuildContext
context
)
{
final
ThemeData
theme
=
Theme
.
of
(
context
);
return
theme
.
copyWith
(
primaryColor:
appBarColor
,
appBarTheme:
theme
.
appBarTheme
.
copyWith
(
color:
appBarColor
,
),
inputDecorationTheme:
theme
.
inputDecorationTheme
.
copyWith
(
enabledBorder:
enabledBorder
,
),
);
}
}
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