diff --git a/packages/flutter/lib/src/material/about.dart b/packages/flutter/lib/src/material/about.dart index dc61cc6de2..34d5134fce 100644 --- a/packages/flutter/lib/src/material/about.dart +++ b/packages/flutter/lib/src/material/about.dart @@ -11,7 +11,6 @@ import 'package:flutter/widgets.dart' hide Flow; import 'app_bar.dart'; import 'back_button.dart'; -import 'button_bar.dart'; import 'card.dart'; import 'constants.dart'; import 'debug.dart'; @@ -1534,13 +1533,17 @@ class _MasterDetailScaffoldState extends State<_MasterDetailScaffold> mainAxisAlignment: MainAxisAlignment.start, children: [ ConstrainedBox( - constraints: - BoxConstraints.tightFor(width: masterViewWidth), + constraints: BoxConstraints.tightFor(width: masterViewWidth), child: IconTheme( data: Theme.of(context).primaryIconTheme, - child: ButtonBar( - children: - widget.actionBuilder!(context, _ActionLevel.view), + child: Container( + alignment: AlignmentDirectional.centerEnd, + padding: const EdgeInsets.all(8), + child: OverflowBar( + spacing: 8, + overflowAlignment: OverflowBarAlignment.end, + children: widget.actionBuilder!(context, _ActionLevel.view), + ), ), ), ) diff --git a/packages/flutter/lib/src/material/scaffold.dart b/packages/flutter/lib/src/material/scaffold.dart index 144137e971..d5b80b2d70 100644 --- a/packages/flutter/lib/src/material/scaffold.dart +++ b/packages/flutter/lib/src/material/scaffold.dart @@ -13,7 +13,6 @@ import 'package:flutter/gestures.dart' show DragStartBehavior; import 'app_bar.dart'; import 'bottom_sheet.dart'; -import 'button_bar.dart'; import 'colors.dart'; import 'curves.dart'; import 'debug.dart'; @@ -1555,7 +1554,7 @@ class Scaffold extends StatefulWidget { /// Typically this is a list of [TextButton] widgets. These buttons are /// persistently visible, even if the [body] of the scaffold scrolls. /// - /// These widgets will be wrapped in a [ButtonBar]. + /// These widgets will be wrapped in an [OverflowBar]. /// /// The [persistentFooterButtons] are rendered above the /// [bottomNavigationBar] but below the [body]. @@ -3114,8 +3113,16 @@ class ScaffoldState extends State with TickerProviderStateMixin, Resto ), child: SafeArea( top: false, - child: ButtonBar( - children: widget.persistentFooterButtons!, + child: IntrinsicHeight( + child: Container( + alignment: AlignmentDirectional.centerEnd, + padding: const EdgeInsets.all(8), + child: OverflowBar( + spacing: 8, + overflowAlignment: OverflowBarAlignment.end, + children: widget.persistentFooterButtons!, + ), + ), ), ), ), diff --git a/packages/flutter/test/material/scaffold_test.dart b/packages/flutter/test/material/scaffold_test.dart index a2783352b9..1648f9139a 100644 --- a/packages/flutter/test/material/scaffold_test.dart +++ b/packages/flutter/test/material/scaffold_test.dart @@ -492,8 +492,8 @@ void main() { ), ), ); - expect(tester.getBottomLeft(find.byType(ButtonBar)), const Offset(10.0, 560.0)); - expect(tester.getBottomRight(find.byType(ButtonBar)), const Offset(770.0, 560.0)); + expect(tester.getBottomLeft(_findButtonBar()), const Offset(10.0, 560.0)); + expect(tester.getBottomRight(_findButtonBar()), const Offset(770.0, 560.0)); }); testWidgets('Persistent bottom buttons bottom padding is not consumed by viewInsets', (WidgetTester tester) async { @@ -2293,3 +2293,10 @@ class _CustomPageRoute extends PageRoute { return child; } } + +// What was the Scaffold's ButtonBar when many of these tests were written, +// is now a Container with an OverflowBar child. The Container's size and location +// match the original ButtonBar's size and location. +Finder _findButtonBar() { + return find.ancestor(of: find.byType(OverflowBar), matching: find.byType(Container)).first; +}