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
d9096a42
Unverified
Commit
d9096a42
authored
Mar 12, 2019
by
Hans Muller
Committed by
GitHub
Mar 12, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MaterialButton shape should override ButtonTheme shape (#29189)
parent
c4ffbb5e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
1 deletion
+24
-1
material_button.dart
packages/flutter/lib/src/material/material_button.dart
+4
-1
buttons_test.dart
packages/flutter/test/material/buttons_test.dart
+20
-0
No files found.
packages/flutter/lib/src/material/material_button.dart
View file @
d9096a42
...
...
@@ -223,6 +223,9 @@ class MaterialButton extends StatelessWidget {
/// The button's highlight and splash are clipped to this shape. If the
/// button has an elevation, then its drop shadow is defined by this
/// shape as well.
///
/// Defaults to the value from the current [ButtonTheme],
/// [ButtonThemeData.shape].
final
ShapeBorder
shape
;
/// {@macro flutter.widgets.Clip}
...
...
@@ -271,7 +274,7 @@ class MaterialButton extends StatelessWidget {
minWidth:
minWidth
,
minHeight:
height
,
),
shape:
buttonTheme
.
shape
,
shape:
buttonTheme
.
getShape
(
this
)
,
clipBehavior:
clipBehavior
??
Clip
.
none
,
animationDuration:
buttonTheme
.
getAnimationDuration
(
this
),
child:
child
,
...
...
packages/flutter/test/material/buttons_test.dart
View file @
d9096a42
...
...
@@ -625,4 +625,24 @@ void main() {
paintsExactlyCountTimes
(
#clipPath
,
0
),
);
});
testWidgets
(
'MaterialButton shape overrides ButtonTheme shape'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/29146
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
MaterialButton
(
onPressed:
()
{
},
shape:
const
StadiumBorder
(),
child:
const
Text
(
'button'
),
),
),
);
final
Finder
rawButtonMaterial
=
find
.
descendant
(
of:
find
.
byType
(
MaterialButton
),
matching:
find
.
byType
(
Material
),
);
expect
(
tester
.
widget
<
Material
>(
rawButtonMaterial
).
shape
,
const
StadiumBorder
());
});
}
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