From 0b8fe017383427c57fe82d8f0028f9943baf4eba Mon Sep 17 00:00:00 2001 From: Leigha Jarett Date: Thu, 8 Jun 2023 18:28:10 -0400 Subject: [PATCH] Advise developers to use OverflowBar instead of ButtonBar (#128437) Fixes https://github.com/flutter/flutter/issues/128430 --- .../flutter/lib/src/material/button_bar.dart | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/packages/flutter/lib/src/material/button_bar.dart b/packages/flutter/lib/src/material/button_bar.dart index 765563f55f..e3e36ec80f 100644 --- a/packages/flutter/lib/src/material/button_bar.dart +++ b/packages/flutter/lib/src/material/button_bar.dart @@ -12,6 +12,37 @@ import 'dialog.dart'; /// An end-aligned row of buttons, laying out into a column if there is not /// enough horizontal space. /// +/// ## Updating to [OverflowBar] +/// +/// [ButtonBar] has been replace by a more efficient widget, [OverflowBar]. +/// +/// ```dart +/// // Before +/// ButtonBar( +/// alignment: MainAxisAlignment.spaceEvenly, +/// children: [ +/// TextButton( child: const Text('Button 1'), onPressed: () {}), +/// TextButton( child: const Text('Button 2'), onPressed: () {}), +/// TextButton( child: const Text('Button 3'), onPressed: () {}), +/// ], +/// ); +/// ``` +/// ```dart +/// // After +/// OverflowBar( +/// alignment: MainAxisAlignment.spaceEvenly, +/// children: [ +/// TextButton( child: const Text('Button 1'), onPressed: () {}), +/// TextButton( child: const Text('Button 2'), onPressed: () {}), +/// TextButton( child: const Text('Button 3'), onPressed: () {}), +/// ], +/// ); +/// ``` +/// +/// See the [OverflowBar] documentation for more details. +/// +/// ## Using [ButtonBar] +/// /// Places the buttons horizontally according to the [buttonPadding]. The /// children are laid out in a [Row] with [MainAxisAlignment.end]. When the /// [Directionality] is [TextDirection.ltr], the button bar's children are