From 78a0111c2093f5836c01fe167e38f6bad2594f72 Mon Sep 17 00:00:00 2001 From: Taha Tesser Date: Tue, 7 Jun 2022 18:23:40 +0300 Subject: [PATCH] Fix `ButtonStyleButton` ink well shape. (#100226) --- .../lib/src/material/button_style_button.dart | 2 +- .../test/material/elevated_button_test.dart | 45 +++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/packages/flutter/lib/src/material/button_style_button.dart b/packages/flutter/lib/src/material/button_style_button.dart index 097aa3c2f4eb..1ed4bffddecb 100644 --- a/packages/flutter/lib/src/material/button_style_button.dart +++ b/packages/flutter/lib/src/material/button_style_button.dart @@ -367,7 +367,7 @@ class _ButtonStyleState extends State with MaterialStateMixin splashFactory: resolvedSplashFactory, overlayColor: overlayColor, highlightColor: Colors.transparent, - customBorder: resolvedShape, + customBorder: resolvedShape.copyWith(side: resolvedSide), child: IconTheme.merge( data: IconThemeData(color: resolvedForegroundColor), child: Padding( diff --git a/packages/flutter/test/material/elevated_button_test.dart b/packages/flutter/test/material/elevated_button_test.dart index d40b1efef845..f7bc03541e48 100644 --- a/packages/flutter/test/material/elevated_button_test.dart +++ b/packages/flutter/test/material/elevated_button_test.dart @@ -1554,6 +1554,51 @@ void main() { expect(RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.basic); }); + + testWidgets('Ink Response shape matches Material shape', (WidgetTester tester) async { + // This is a regression test for https://github.com/flutter/flutter/issues/91844 + + Widget buildFrame({BorderSide? side}) { + return MaterialApp( + home: Scaffold( + body: Center( + child: ElevatedButton( + style: ElevatedButton.styleFrom( + side: side, + shape: const RoundedRectangleBorder( + side: BorderSide( + color: Color(0xff0000ff), + width: 0, + ), + ), + ), + onPressed: () { }, + child: const Text('ElevatedButton'), + ), + ), + ), + ); + } + + const BorderSide borderSide = BorderSide(width: 10, color: Color(0xff00ff00)); + await tester.pumpWidget(buildFrame(side: borderSide)); + expect( + tester.widget(find.byType(InkWell)).customBorder, + const RoundedRectangleBorder(side: borderSide), + ); + + await tester.pumpWidget(buildFrame()); + await tester.pumpAndSettle(); + expect( + tester.widget(find.byType(InkWell)).customBorder, + const RoundedRectangleBorder( + side: BorderSide( + color: Color(0xff0000ff), + width: 0.0, + ), + ), + ); + }); } TextStyle _iconStyle(WidgetTester tester, IconData icon) {