Skip to content

Commit

Permalink
Fix ButtonStyleButton ink well shape. (#100226)
Browse files Browse the repository at this point in the history
  • Loading branch information
TahaTesser authored Jun 7, 2022
1 parent be0c1bd commit 78a0111
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/material/button_style_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ class _ButtonStyleState extends State<ButtonStyleButton> 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(
Expand Down
45 changes: 45 additions & 0 deletions packages/flutter/test/material/elevated_button_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<InkWell>(find.byType(InkWell)).customBorder,
const RoundedRectangleBorder(side: borderSide),
);

await tester.pumpWidget(buildFrame());
await tester.pumpAndSettle();
expect(
tester.widget<InkWell>(find.byType(InkWell)).customBorder,
const RoundedRectangleBorder(
side: BorderSide(
color: Color(0xff0000ff),
width: 0.0,
),
),
);
});
}

TextStyle _iconStyle(WidgetTester tester, IconData icon) {
Expand Down

0 comments on commit 78a0111

Please sign in to comment.