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
782f9cce
Commit
782f9cce
authored
Jan 25, 2020
by
Darren Austin
Committed by
Flutter GitHub Bot
Jan 25, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose a color property to CloseButton (#49256)
parent
bc5c4643
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
2 deletions
+44
-2
back_button.dart
packages/flutter/lib/src/material/back_button.dart
+8
-1
back_button_test.dart
packages/flutter/test/material/back_button_test.dart
+36
-1
No files found.
packages/flutter/lib/src/material/back_button.dart
View file @
782f9cce
...
...
@@ -128,13 +128,20 @@ class BackButton extends StatelessWidget {
/// * [IconButton], to create other material design icon buttons.
class
CloseButton
extends
StatelessWidget
{
/// Creates a Material Design close button.
const
CloseButton
({
Key
key
})
:
super
(
key:
key
);
const
CloseButton
({
Key
key
,
this
.
color
})
:
super
(
key:
key
);
/// The color to use for the icon.
///
/// Defaults to the [IconThemeData.color] specified in the ambient [IconTheme],
/// which usually matches the ambient [Theme]'s [ThemeData.iconTheme].
final
Color
color
;
@override
Widget
build
(
BuildContext
context
)
{
assert
(
debugCheckHasMaterialLocalizations
(
context
));
return
IconButton
(
icon:
const
Icon
(
Icons
.
close
),
color:
color
,
tooltip:
MaterialLocalizations
.
of
(
context
).
closeButtonTooltip
,
onPressed:
()
{
Navigator
.
maybePop
(
context
);
...
...
packages/flutter/test/material/back_button_test.dart
View file @
782f9cce
...
...
@@ -69,7 +69,6 @@ void main() {
final
Key
iOSKey
=
UniqueKey
();
final
Key
androidKey
=
UniqueKey
();
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Column
(
...
...
@@ -92,6 +91,24 @@ void main() {
expect
(
iOSIcon
==
androidIcon
,
false
);
});
testWidgets
(
'BackButton color'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
MaterialApp
(
home:
Material
(
child:
BackButton
(
color:
Colors
.
blue
,
),
),
),
);
final
RichText
iconText
=
tester
.
firstWidget
(
find
.
descendant
(
of:
find
.
byType
(
BackButton
),
matching:
find
.
byType
(
RichText
)
));
expect
(
iconText
.
text
.
style
.
color
,
Colors
.
blue
);
});
testWidgets
(
'BackButton semantics'
,
(
WidgetTester
tester
)
async
{
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
await
tester
.
pumpWidget
(
...
...
@@ -123,4 +140,22 @@ void main() {
));
handle
.
dispose
();
});
testWidgets
(
'CloseButton color'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
MaterialApp
(
home:
Material
(
child:
CloseButton
(
color:
Colors
.
red
,
),
),
),
);
final
RichText
iconText
=
tester
.
firstWidget
(
find
.
descendant
(
of:
find
.
byType
(
CloseButton
),
matching:
find
.
byType
(
RichText
)
));
expect
(
iconText
.
text
.
style
.
color
,
Colors
.
red
);
});
}
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