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
b73cae17
Unverified
Commit
b73cae17
authored
Nov 04, 2020
by
Hans Muller
Committed by
GitHub
Nov 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ButtonStyle style side should default to shape.side (#69713)
parent
ad9b30b3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
4 deletions
+39
-4
elevated_button.dart
packages/flutter/lib/src/material/elevated_button.dart
+7
-2
text_button.dart
packages/flutter/lib/src/material/text_button.dart
+7
-2
elevated_button_test.dart
packages/flutter/test/material/elevated_button_test.dart
+25
-0
No files found.
packages/flutter/lib/src/material/elevated_button.dart
View file @
b73cae17
...
...
@@ -229,7 +229,7 @@ class ElevatedButton extends ButtonStyleButton {
/// * `2 < textScaleFactor <= 3` - lerp(horizontal(8), horizontal(4))
/// * `3 < textScaleFactor` - horizontal(4)
/// * `minimumSize` - Size(64, 36)
/// * `side` -
BorderSide.none
/// * `side` -
null
/// * `shape` - RoundedRectangleBorder(borderRadius: BorderRadius.circular(4))
/// * `mouseCursor`
/// * disabled - SystemMouseCursors.forbidden
...
...
@@ -246,6 +246,11 @@ class ElevatedButton extends ButtonStyleButton {
/// * `1 < textScaleFactor <= 2` - lerp(start(12) end(16), horizontal(8))
/// * `2 < textScaleFactor <= 3` - lerp(horizontal(8), horizontal(4))
/// * `3 < textScaleFactor` - horizontal(4)
///
/// The default value for `side`, which defines the appearance of the button's
/// outline, is null. That means that the outline is defined by the button
/// shape's [OutlinedBorder.side]. Typically the default value of an
/// [OutlinedBorder]'s side is [BorderSide.none], so an outline is not drawn.
@override
ButtonStyle
defaultStyleOf
(
BuildContext
context
)
{
final
ThemeData
theme
=
Theme
.
of
(
context
);
...
...
@@ -267,7 +272,7 @@ class ElevatedButton extends ButtonStyleButton {
textStyle:
theme
.
textTheme
.
button
,
padding:
scaledPadding
,
minimumSize:
const
Size
(
64
,
36
),
side:
BorderSide
.
none
,
side:
null
,
shape:
const
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
4
))),
enabledMouseCursor:
SystemMouseCursors
.
click
,
disabledMouseCursor:
SystemMouseCursors
.
forbidden
,
...
...
packages/flutter/lib/src/material/text_button.dart
View file @
b73cae17
...
...
@@ -217,7 +217,7 @@ class TextButton extends ButtonStyleButton {
/// * `2 < textScaleFactor <= 3` - lerp(horizontal(8), horizontal(4))
/// * `3 < textScaleFactor` - horizontal(4)
/// * `minimumSize` - Size(64, 36)
/// * `side` -
BorderSide.none
/// * `side` -
null
/// * `shape` - RoundedRectangleBorder(borderRadius: BorderRadius.circular(4))
/// * `mouseCursor`
/// * disabled - SystemMouseCursors.forbidden
...
...
@@ -233,6 +233,11 @@ class TextButton extends ButtonStyleButton {
/// * `textScaleFactor <= 1` - all(8)
/// * `1 < textScaleFactor <= 2 `- lerp(all(8), horizontal(4))
/// * `2 < textScaleFactor` - horizontal(4)
///
/// The default value for `side`, which defines the appearance of the button's
/// outline, is null. That means that the outline is defined by the button
/// shape's [OutlinedBorder.side]. Typically the default value of an
/// [OutlinedBorder]'s side is [BorderSide.none], so an outline is not drawn.
@override
ButtonStyle
defaultStyleOf
(
BuildContext
context
)
{
final
ThemeData
theme
=
Theme
.
of
(
context
);
...
...
@@ -254,7 +259,7 @@ class TextButton extends ButtonStyleButton {
textStyle:
theme
.
textTheme
.
button
,
padding:
scaledPadding
,
minimumSize:
const
Size
(
64
,
36
),
side:
BorderSide
.
none
,
side:
null
,
shape:
const
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
4
))),
enabledMouseCursor:
SystemMouseCursors
.
click
,
disabledMouseCursor:
SystemMouseCursors
.
forbidden
,
...
...
packages/flutter/test/material/elevated_button_test.dart
View file @
b73cae17
...
...
@@ -1011,6 +1011,31 @@ void main() {
expect
(
physicalShape
().
elevation
,
0
);
expect
(
physicalShape
().
color
,
disabledBackgroundColor
);
});
testWidgets
(
'By default, ElevatedButton shape outline is defined by shape.side'
,
(
WidgetTester
tester
)
async
{
// This is a regression test for https://github.com/flutter/flutter/issues/69544
const
Color
borderColor
=
Color
(
0xff4caf50
);
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
ThemeData
.
from
(
colorScheme:
const
ColorScheme
.
light
()),
home:
Center
(
child:
ElevatedButton
(
style:
ElevatedButton
.
styleFrom
(
shape:
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
16
),
side:
const
BorderSide
(
width:
4
,
color:
borderColor
),
),
),
onPressed:
()
{
},
child:
const
Text
(
'button'
),
),
),
),
);
expect
(
find
.
byType
(
ElevatedButton
),
paints
..
path
(
strokeWidth:
4
)
..
drrect
(
color:
borderColor
));
});
}
TextStyle
_iconStyle
(
WidgetTester
tester
,
IconData
icon
)
{
...
...
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