diff --git a/packages/flutter/lib/src/material/elevated_button.dart b/packages/flutter/lib/src/material/elevated_button.dart index 2bc3baa796..4eb8737b71 100644 --- a/packages/flutter/lib/src/material/elevated_button.dart +++ b/packages/flutter/lib/src/material/elevated_button.dart @@ -468,7 +468,7 @@ class _ElevatedButtonWithIconChild extends StatelessWidget { final double gap = scale <= 1 ? 8 : lerpDouble(8, 4, math.min(scale - 1, 1))!; return Row( mainAxisSize: MainAxisSize.min, - children: [icon, SizedBox(width: gap), Flexible(child: label)], + children: [icon, SizedBox(width: gap), label], ); } } diff --git a/packages/flutter/lib/src/material/flat_button.dart b/packages/flutter/lib/src/material/flat_button.dart index 0098fd129d..6f8712059d 100644 --- a/packages/flutter/lib/src/material/flat_button.dart +++ b/packages/flutter/lib/src/material/flat_button.dart @@ -229,7 +229,7 @@ class _FlatButtonWithIcon extends FlatButton with MaterialButtonWithIconMixin { children: [ icon, const SizedBox(width: 8.0), - Flexible(child: label), + label, ], ), minWidth: minWidth, diff --git a/packages/flutter/lib/src/material/outline_button.dart b/packages/flutter/lib/src/material/outline_button.dart index f390ec2246..d5a33ff904 100644 --- a/packages/flutter/lib/src/material/outline_button.dart +++ b/packages/flutter/lib/src/material/outline_button.dart @@ -274,7 +274,7 @@ class _OutlineButtonWithIcon extends OutlineButton with MaterialButtonWithIconMi children: [ icon, const SizedBox(width: 8.0), - Flexible(child:label), + label, ], ), ); diff --git a/packages/flutter/lib/src/material/outlined_button.dart b/packages/flutter/lib/src/material/outlined_button.dart index 7902c82b80..af10f032c1 100644 --- a/packages/flutter/lib/src/material/outlined_button.dart +++ b/packages/flutter/lib/src/material/outlined_button.dart @@ -374,7 +374,7 @@ class _OutlinedButtonWithIconChild extends StatelessWidget { final double gap = scale <= 1 ? 8 : lerpDouble(8, 4, math.min(scale - 1, 1))!; return Row( mainAxisSize: MainAxisSize.min, - children: [icon, SizedBox(width: gap), Flexible(child:label)], + children: [icon, SizedBox(width: gap), label], ); } } diff --git a/packages/flutter/lib/src/material/raised_button.dart b/packages/flutter/lib/src/material/raised_button.dart index 5bca8f90bd..a81c980733 100644 --- a/packages/flutter/lib/src/material/raised_button.dart +++ b/packages/flutter/lib/src/material/raised_button.dart @@ -265,7 +265,7 @@ class _RaisedButtonWithIcon extends RaisedButton with MaterialButtonWithIconMixi children: [ icon, const SizedBox(width: 8.0), - Flexible(child: label), + label, ], ), ); diff --git a/packages/flutter/lib/src/material/text_button.dart b/packages/flutter/lib/src/material/text_button.dart index d3ea3e443a..4f857fbc20 100644 --- a/packages/flutter/lib/src/material/text_button.dart +++ b/packages/flutter/lib/src/material/text_button.dart @@ -465,7 +465,7 @@ class _TextButtonWithIconChild extends StatelessWidget { final double gap = scale <= 1 ? 8 : lerpDouble(8, 4, math.min(scale - 1, 1))!; return Row( mainAxisSize: MainAxisSize.min, - children: [icon, SizedBox(width: gap), Flexible(child:label)], + children: [icon, SizedBox(width: gap), label], ); } } diff --git a/packages/flutter/test/material/elevated_button_test.dart b/packages/flutter/test/material/elevated_button_test.dart index 338b07c34e..6b35b4c5fa 100644 --- a/packages/flutter/test/material/elevated_button_test.dart +++ b/packages/flutter/test/material/elevated_button_test.dart @@ -1114,26 +1114,6 @@ void main() { await tester.pumpAndSettle(); } }); - - testWidgets('Fixed ElevatedButton.icon RenderFlex overflow', (WidgetTester tester) async { - await tester.pumpWidget( - MaterialApp( - home: Scaffold( - body: SizedBox( - width: 200, - child: ElevatedButton.icon( - onPressed: () {}, - icon: const Icon(Icons.add), - label: const Text( - 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut a euismod nibh. Morbi laoreet purus.', - ), - ), - ), - ), - ), - ); - expect(tester.takeException(), null); - }); } TextStyle _iconStyle(WidgetTester tester, IconData icon) { diff --git a/packages/flutter/test/material/flat_button_test.dart b/packages/flutter/test/material/flat_button_test.dart index 7b2ce1227d..70794d3e18 100644 --- a/packages/flutter/test/material/flat_button_test.dart +++ b/packages/flutter/test/material/flat_button_test.dart @@ -882,26 +882,6 @@ void main() { await buildWidget(buttonMinWidth: buttonMinWidth); expect(tester.widget(rawMaterialButtonFinder).constraints.minWidth, buttonMinWidth); }); - - testWidgets('Fixed FlatButton.icon RenderFlex overflow', (WidgetTester tester) async { - await tester.pumpWidget( - MaterialApp( - home: Scaffold( - body: SizedBox( - width: 200, - child: FlatButton.icon( - onPressed: () {}, - icon: const Icon(Icons.add), - label: const Text( - 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut a euismod nibh. Morbi laoreet purus.', - ), - ), - ), - ), - ), - ); - expect(tester.takeException(), null); - }); } TextStyle? _iconStyle(WidgetTester tester, IconData icon) { diff --git a/packages/flutter/test/material/outline_button_test.dart b/packages/flutter/test/material/outline_button_test.dart index ae6a576e11..59ba49eb26 100644 --- a/packages/flutter/test/material/outline_button_test.dart +++ b/packages/flutter/test/material/outline_button_test.dart @@ -1222,26 +1222,6 @@ void main() { expect(box.size, equals(const Size(76, 36))); expect(childRect, equals(const Rect.fromLTRB(372.0, 293.0, 428.0, 307.0))); }); - - testWidgets('Fixed OutlineButton.icon RenderFlex overflow', (WidgetTester tester) async { - await tester.pumpWidget( - MaterialApp( - home: Scaffold( - body: SizedBox( - width: 200, - child: OutlineButton.icon( - onPressed: () {}, - icon: const Icon(Icons.add), - label: const Text( - 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut a euismod nibh. Morbi laoreet purus.', - ), - ), - ), - ), - ), - ); - expect(tester.takeException(), null); - }); } PhysicalModelLayer _findPhysicalLayer(Element element) { diff --git a/packages/flutter/test/material/outlined_button_test.dart b/packages/flutter/test/material/outlined_button_test.dart index 4dcd3b82cd..428271c647 100644 --- a/packages/flutter/test/material/outlined_button_test.dart +++ b/packages/flutter/test/material/outlined_button_test.dart @@ -1290,26 +1290,6 @@ void main() { await tester.pumpAndSettle(); } }); - - testWidgets('Fixed OutlinedButton.icon RenderFlex overflow', (WidgetTester tester) async { - await tester.pumpWidget( - MaterialApp( - home: Scaffold( - body: SizedBox( - width: 200, - child: OutlinedButton.icon( - onPressed: () {}, - icon: const Icon(Icons.add), - label: const Text( - 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut a euismod nibh. Morbi laoreet purus.', - ), - ), - ), - ), - ), - ); - expect(tester.takeException(), null); - }); } PhysicalModelLayer _findPhysicalLayer(Element element) { diff --git a/packages/flutter/test/material/raised_button_test.dart b/packages/flutter/test/material/raised_button_test.dart index a105f65996..eb6d91d8d7 100644 --- a/packages/flutter/test/material/raised_button_test.dart +++ b/packages/flutter/test/material/raised_button_test.dart @@ -727,26 +727,6 @@ void main() { expect(paddingRect.top, tallerWidget.top - 5); expect(paddingRect.bottom, tallerWidget.bottom + 12); }); - - testWidgets('Fixed RaisedButton.icon RenderFlex overflow', (WidgetTester tester) async { - await tester.pumpWidget( - MaterialApp( - home: Scaffold( - body: SizedBox( - width: 200, - child: RaisedButton.icon( - onPressed: () {}, - icon: const Icon(Icons.add), - label: const Text( - 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut a euismod nibh. Morbi laoreet purus.', - ), - ), - ), - ), - ), - ); - expect(tester.takeException(), null); - }); } TextStyle _iconStyle(WidgetTester tester, IconData icon) { diff --git a/packages/flutter/test/material/text_button_test.dart b/packages/flutter/test/material/text_button_test.dart index 9ef3bb35de..7047df212b 100644 --- a/packages/flutter/test/material/text_button_test.dart +++ b/packages/flutter/test/material/text_button_test.dart @@ -1087,26 +1087,6 @@ void main() { await tester.pumpAndSettle(); } }); - - testWidgets('Fixed TextButton.icon RenderFlex overflow', (WidgetTester tester) async { - await tester.pumpWidget( - MaterialApp( - home: Scaffold( - body: SizedBox( - width: 200, - child: TextButton.icon( - onPressed: () {}, - icon: const Icon(Icons.add), - label: const Text( - 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut a euismod nibh. Morbi laoreet purus.', - ), - ), - ), - ), - ), - ); - expect(tester.takeException(), null); - }); } TextStyle? _iconStyle(WidgetTester tester, IconData icon) {