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
dfa489c3
Unverified
Commit
dfa489c3
authored
Feb 05, 2019
by
Hans Muller
Committed by
GitHub
Feb 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update OutlineButton on-pressed fill color (#27519)
parent
965dc52e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
6 deletions
+62
-6
outline_button.dart
packages/flutter/lib/src/material/outline_button.dart
+1
-4
outline_button_test.dart
packages/flutter/test/material/outline_button_test.dart
+60
-1
theme_defaults_test.dart
packages/flutter/test/material/theme_defaults_test.dart
+1
-1
No files found.
packages/flutter/lib/src/material/outline_button.dart
View file @
dfa489c3
...
...
@@ -343,10 +343,7 @@ class _OutlineButtonState extends State<_OutlineButton> with SingleTickerProvide
}
Color
_getFillColor
()
{
final
bool
themeIsDark
=
widget
.
brightness
==
Brightness
.
dark
;
final
Color
color
=
widget
.
color
??
(
themeIsDark
?
const
Color
(
0x00000000
)
:
const
Color
(
0x00FFFFFF
));
final
Color
color
=
widget
.
color
??
Theme
.
of
(
context
).
canvasColor
;
final
Tween
<
Color
>
colorTween
=
ColorTween
(
begin:
color
.
withAlpha
(
0x00
),
end:
color
.
withAlpha
(
0xFF
),
...
...
packages/flutter/test/material/outline_button_test.dart
View file @
dfa489c3
...
...
@@ -121,7 +121,7 @@ void main() {
// Wait for the border color to change from disabled to enabled.
await
tester
.
pumpAndSettle
();
// Expect that the button is
dis
abled and painted with the enabled border color.
// Expect that the button is
en
abled and painted with the enabled border color.
expect
(
tester
.
widget
<
OutlineButton
>(
outlineButton
).
enabled
,
true
);
expect
(
outlineButton
,
...
...
@@ -314,4 +314,63 @@ void main() {
'splashColor: Color(0xff9e9e9e)'
,
]);
});
testWidgets
(
'OutlineButton pressed fillColor default'
,
(
WidgetTester
tester
)
async
{
Widget
buildFrame
(
ThemeData
theme
)
{
return
MaterialApp
(
theme:
theme
,
home:
Scaffold
(
body:
Center
(
child:
OutlineButton
(
onPressed:
()
{},
child:
const
Text
(
'Hello'
),
),
),
),
);
}
await
tester
.
pumpWidget
(
buildFrame
(
ThemeData
.
dark
()));
final
Finder
button
=
find
.
byType
(
OutlineButton
);
final
Offset
center
=
tester
.
getCenter
(
button
);
// Default value for dark Theme.of(context).canvasColor as well as
// the OutlineButton fill color when the button has been pressed.
Color
fillColor
=
Colors
.
grey
[
850
];
// Initially the interior of the button is transparent.
expect
(
button
,
paints
..
path
(
color:
fillColor
.
withAlpha
(
0x00
)));
// Tap-press gesture on the button triggers the fill animation.
TestGesture
gesture
=
await
tester
.
startGesture
(
center
);
await
tester
.
pump
();
// Start the button fill animation.
await
tester
.
pump
(
const
Duration
(
milliseconds:
200
));
// Animation is complete.
expect
(
button
,
paints
..
path
(
color:
fillColor
.
withAlpha
(
0xFF
)));
// Tap gesture completes, button returns to its initial configuration.
await
gesture
.
up
();
await
tester
.
pumpAndSettle
();
expect
(
button
,
paints
..
path
(
color:
fillColor
.
withAlpha
(
0x00
)));
await
tester
.
pumpWidget
(
buildFrame
(
ThemeData
.
light
()));
await
tester
.
pumpAndSettle
();
// Finish the theme change animation.
// Default value for light Theme.of(context).canvasColor as well as
// the OutlineButton fill color when the button has been pressed.
fillColor
=
Colors
.
grey
[
50
];
// Initially the interior of the button is transparent.
expect
(
button
,
paints
..
path
(
color:
fillColor
.
withAlpha
(
0x00
)));
// Tap-press gesture on the button triggers the fill animation.
gesture
=
await
tester
.
startGesture
(
center
);
await
tester
.
pump
();
// Start the button fill animation.
await
tester
.
pump
(
const
Duration
(
milliseconds:
200
));
// Animation is complete.
expect
(
button
,
paints
..
path
(
color:
fillColor
.
withAlpha
(
0xFF
)));
// Tap gesture completes, button returns to its initial configuration.
await
gesture
.
up
();
await
tester
.
pumpAndSettle
();
expect
(
button
,
paints
..
path
(
color:
fillColor
.
withAlpha
(
0x00
)));
});
}
packages/flutter/test/material/theme_defaults_test.dart
View file @
dfa489c3
...
...
@@ -143,7 +143,7 @@ void main() {
final
RawMaterialButton
raw
=
tester
.
widget
<
RawMaterialButton
>(
find
.
byType
(
RawMaterialButton
));
expect
(
raw
.
textStyle
.
color
,
const
Color
(
0xdd000000
));
expect
(
raw
.
fillColor
,
const
Color
(
0x00f
fffff
));
expect
(
raw
.
fillColor
,
const
Color
(
0x00f
afafa
));
expect
(
raw
.
highlightColor
,
const
Color
(
0x29000000
));
// Was Color(0x66bcbcbc)
expect
(
raw
.
splashColor
,
const
Color
(
0x1f000000
));
// Was Color(0x66c8c8c8)
expect
(
raw
.
elevation
,
0.0
);
...
...
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