Skip to content

Commit 78a0111

Browse files
authored
Fix ButtonStyleButton ink well shape. (#100226)
1 parent be0c1bd commit 78a0111

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

packages/flutter/lib/src/material/button_style_button.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ class _ButtonStyleState extends State<ButtonStyleButton> with MaterialStateMixin
367367
splashFactory: resolvedSplashFactory,
368368
overlayColor: overlayColor,
369369
highlightColor: Colors.transparent,
370-
customBorder: resolvedShape,
370+
customBorder: resolvedShape.copyWith(side: resolvedSide),
371371
child: IconTheme.merge(
372372
data: IconThemeData(color: resolvedForegroundColor),
373373
child: Padding(

packages/flutter/test/material/elevated_button_test.dart

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,6 +1554,51 @@ void main() {
15541554

15551555
expect(RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.basic);
15561556
});
1557+
1558+
testWidgets('Ink Response shape matches Material shape', (WidgetTester tester) async {
1559+
// This is a regression test for https://github.com/flutter/flutter/issues/91844
1560+
1561+
Widget buildFrame({BorderSide? side}) {
1562+
return MaterialApp(
1563+
home: Scaffold(
1564+
body: Center(
1565+
child: ElevatedButton(
1566+
style: ElevatedButton.styleFrom(
1567+
side: side,
1568+
shape: const RoundedRectangleBorder(
1569+
side: BorderSide(
1570+
color: Color(0xff0000ff),
1571+
width: 0,
1572+
),
1573+
),
1574+
),
1575+
onPressed: () { },
1576+
child: const Text('ElevatedButton'),
1577+
),
1578+
),
1579+
),
1580+
);
1581+
}
1582+
1583+
const BorderSide borderSide = BorderSide(width: 10, color: Color(0xff00ff00));
1584+
await tester.pumpWidget(buildFrame(side: borderSide));
1585+
expect(
1586+
tester.widget<InkWell>(find.byType(InkWell)).customBorder,
1587+
const RoundedRectangleBorder(side: borderSide),
1588+
);
1589+
1590+
await tester.pumpWidget(buildFrame());
1591+
await tester.pumpAndSettle();
1592+
expect(
1593+
tester.widget<InkWell>(find.byType(InkWell)).customBorder,
1594+
const RoundedRectangleBorder(
1595+
side: BorderSide(
1596+
color: Color(0xff0000ff),
1597+
width: 0.0,
1598+
),
1599+
),
1600+
);
1601+
});
15571602
}
15581603

15591604
TextStyle _iconStyle(WidgetTester tester, IconData icon) {

0 commit comments

Comments
 (0)