Unverified Commit b73cae17 authored by Hans Muller's avatar Hans Muller Committed by GitHub

ButtonStyle style side should default to shape.side (#69713)

parent ad9b30b3
......@@ -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,
......
......@@ -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,
......
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment