Skip to content

Conversation

@TahaTesser
Copy link
Member

@TahaTesser TahaTesser commented Mar 21, 2024

fixes Deprecate ButtonBar

Code sample

expand to view the code sample
import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        buttonBarTheme: const ButtonBarThemeData(
          alignment: MainAxisAlignment.spaceEvenly,
        ),
      ),
      home: Scaffold(
        body: ButtonBar(
          alignment: MainAxisAlignment.spaceEvenly,
          children: <Widget>[
            TextButton(
              onPressed: () {},
              child: const Text('Button 1'),
            ),
            TextButton(
              onPressed: () {},
              child: const Text('Button 2'),
            ),
            TextButton(
              onPressed: () {},
              child: const Text('Button 3'),
            ),
          ],
        ),
      ),
    );
  }
}

Data driven fix

Before executing dart fix --apply

  return MaterialApp(
      theme: ThemeData(
        buttonBarTheme: const ButtonBarThemeData(
          alignment: MainAxisAlignment.spaceEvenly,
        ),
      ),
      home: Scaffold(
        body: ButtonBar(
          alignment: MainAxisAlignment.spaceEvenly,
          children: <Widget>[
            TextButton(
              onPressed: () {},
              child: const Text('Button 1'),
            ),
            TextButton(
              onPressed: () {},
              child: const Text('Button 2'),
            ),
            TextButton(
              onPressed: () {},
              child: const Text('Button 3'),
            ),
          ],
        ),
      ),
    );

After executing dart fix --apply

    return MaterialApp(
      theme: ThemeData(

      ),
      home: Scaffold(
        body: OverflowBar(
          alignment: MainAxisAlignment.spaceEvenly,
          children: <Widget>[
            TextButton(
              onPressed: () {},
              child: const Text('Button 1'),
            ),
            TextButton(
              onPressed: () {},
              child: const Text('Button 2'),
            ),
            TextButton(
              onPressed: () {},
              child: const Text('Button 3'),
            ),
          ],
        ),
      ),
    );

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. c: tech-debt Technical debt, code quality, testing, etc. labels Mar 21, 2024
@TahaTesser TahaTesser force-pushed the deprecate_button_bar branch 2 times, most recently from 0025dac to 27b0319 Compare March 21, 2024 12:24
@TahaTesser TahaTesser marked this pull request as ready for review March 21, 2024 13:26
@TahaTesser TahaTesser requested a review from Piinks March 21, 2024 13:28
Copy link
Contributor

@Piinks Piinks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just throwing this idea out there since OverflowBar does not have a theme, do you think there is any value in refactoring ButtonBar to use the OverflowBar internally?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah! Just when ThemeData was clear! 😆

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha yes, i saw your comment here when I had to restore all the deprecation sections with comments.

farisbasha

This comment was marked as resolved.

@TahaTesser
Copy link
Member Author

TahaTesser commented Mar 25, 2024

Just throwing this idea out there since OverflowBar does not have a theme, do you think there is any value in refactoring ButtonBar to use the OverflowBar internally?

This is an interesting idea, we can could keep the widget and make it customizable with the ButtonBarTheme for sure.

FYI, over time all ButtonBar references have been removed from the other widgets in the framework and their examples.
I also replaced ButtonBar in the rfw packages with OverflowBar

The ButtonBarTheme contains some ineffective properties, related to other widgets, which are removed from other widgets. We definitely need to deprecate these properties if the the whole widget and theme.
The following properties don't do anything:

  //  - `buttonMinWidth`
  //  - `buttonHeight`
  //  - `buttonAlignedDropdown`

@TahaTesser TahaTesser requested a review from Piinks March 25, 2024 15:30
@Piinks
Copy link
Contributor

Piinks commented Mar 28, 2024

Thank Taha for considering the keep-it path and the additional context. We discussed a bit more offline and it makes more sense to deprecate this. 👍 Just wanted to be extra considerate before we did so.

Copy link
Contributor

@Piinks Piinks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just the TBDs in the fix data files are left to fill in here, otherwise, this LGTM! We can land the migration guide once this is in.

@TahaTesser TahaTesser force-pushed the deprecate_button_bar branch from 27b0319 to 285406b Compare April 1, 2024 10:14
@TahaTesser TahaTesser added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 1, 2024
@auto-submit auto-submit bot merged commit e85340e into flutter:master Apr 1, 2024
@TahaTesser TahaTesser deleted the deprecate_button_bar branch April 1, 2024 11:45
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 1, 2024
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Apr 2, 2024
Manual roll requested by [email protected]

flutter/flutter@9d32f07...7fa932b

2024-04-01 [email protected] Roll Flutter Engine from e6f19409b613 to ea93c5d91b12 (3 revisions) (flutter/flutter#146100)
2024-04-01 [email protected] Refactor realm_checker (flutter/flutter#145905)
2024-04-01 [email protected] Add info strings to code blocks. (flutter/flutter#146085)
2024-04-01 [email protected] Add test for animated_container.0.dart API example. (flutter/flutter#145995)
2024-04-01 [email protected] Roll Flutter Engine from 8dff6b833fe2 to e6f19409b613 (2 revisions) (flutter/flutter#146093)
2024-04-01 [email protected] Roll Flutter Engine from d33666d90916 to 8dff6b833fe2 (3 revisions) (flutter/flutter#146087)
2024-04-01 [email protected] Fix SliverMainAxisGroup layout in reverse (flutter/flutter#145572)
2024-04-01 [email protected] Roll Flutter Engine from dd4f5cd5c9d5 to d33666d90916 (3 revisions) (flutter/flutter#146083)
2024-04-01 [email protected] Roll Packages from 51faaa1 to d5aff19 (3 revisions) (flutter/flutter#146081)
2024-04-01 [email protected] Fixes some gesture recognizers are not disposed. (flutter/flutter#146072)
2024-04-01 [email protected] Flutter Gradle Plugin: add versionName and versionCode to FlutterExtension (flutter/flutter#146044)
2024-04-01 [email protected] Roll Flutter Engine from bf348cd73d49 to dd4f5cd5c9d5 (1 revision) (flutter/flutter#146071)
2024-04-01 [email protected] Roll Flutter Engine from 984a78b04671 to bf348cd73d49 (1 revision) (flutter/flutter#146065)
2024-04-01 [email protected] Deprecate `ButtonBar`, `ButtonBarThemeData`, and `ThemeData.buttonBarTheme` (flutter/flutter#145523)
2024-04-01 [email protected] Add `DataColumn.headingRowAlignment ` for `DataTable` (flutter/flutter#144006)
2024-04-01 [email protected] Roll Flutter Engine from e9d35f8bfbe2 to 984a78b04671 (2 revisions) (flutter/flutter#146062)
2024-04-01 [email protected] Roll Flutter Engine from 4f6b832c8e33 to e9d35f8bfbe2 (1 revision) (flutter/flutter#146060)
2024-03-31 [email protected] Roll Flutter Engine from 9689390986b7 to 4f6b832c8e33 (1 revision) (flutter/flutter#146055)
2024-03-31 [email protected] Roll Flutter Engine from 34081fea4d59 to 9689390986b7 (1 revision) (flutter/flutter#146053)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
sfshaza2 added a commit to flutter/website that referenced this pull request Apr 3, 2024
Related to flutter/flutter#145523

## Presubmit checklist

- [x] This PR doesn’t contain automatically generated corrections
(Grammarly or similar).
- [x] This PR follows the [Google Developer Documentation Style
Guidelines](https://developers.google.com/style) — for example, it
doesn’t use _i.e._ or _e.g._, and it avoids _I_ and _we_ (first person).
- [x] This PR uses [semantic line
breaks](https://github.com/dart-lang/site-shared/blob/main/doc/writing-for-dart-and-flutter-websites.md#semantic-line-breaks)
of 80 characters or fewer.

---------

Co-authored-by: Kate Lovett <[email protected]>
Co-authored-by: Shams Zakhour (ignore Sfshaza) <[email protected]>
atsansone pushed a commit to atsansone/website that referenced this pull request Apr 5, 2024
Related to flutter/flutter#145523

## Presubmit checklist

- [x] This PR doesn’t contain automatically generated corrections
(Grammarly or similar).
- [x] This PR follows the [Google Developer Documentation Style
Guidelines](https://developers.google.com/style) — for example, it
doesn’t use _i.e._ or _e.g._, and it avoids _I_ and _we_ (first person).
- [x] This PR uses [semantic line
breaks](https://github.com/dart-lang/site-shared/blob/main/doc/writing-for-dart-and-flutter-websites.md#semantic-line-breaks)
of 80 characters or fewer.

---------

Co-authored-by: Kate Lovett <[email protected]>
Co-authored-by: Shams Zakhour (ignore Sfshaza) <[email protected]>
TecHaxter pushed a commit to TecHaxter/flutter_packages that referenced this pull request May 22, 2024
)

Manual roll requested by [email protected]

flutter/flutter@9d32f07...7fa932b

2024-04-01 [email protected] Roll Flutter Engine from e6f19409b613 to ea93c5d91b12 (3 revisions) (flutter/flutter#146100)
2024-04-01 [email protected] Refactor realm_checker (flutter/flutter#145905)
2024-04-01 [email protected] Add info strings to code blocks. (flutter/flutter#146085)
2024-04-01 [email protected] Add test for animated_container.0.dart API example. (flutter/flutter#145995)
2024-04-01 [email protected] Roll Flutter Engine from 8dff6b833fe2 to e6f19409b613 (2 revisions) (flutter/flutter#146093)
2024-04-01 [email protected] Roll Flutter Engine from d33666d90916 to 8dff6b833fe2 (3 revisions) (flutter/flutter#146087)
2024-04-01 [email protected] Fix SliverMainAxisGroup layout in reverse (flutter/flutter#145572)
2024-04-01 [email protected] Roll Flutter Engine from dd4f5cd5c9d5 to d33666d90916 (3 revisions) (flutter/flutter#146083)
2024-04-01 [email protected] Roll Packages from 51faaa1 to d5aff19 (3 revisions) (flutter/flutter#146081)
2024-04-01 [email protected] Fixes some gesture recognizers are not disposed. (flutter/flutter#146072)
2024-04-01 [email protected] Flutter Gradle Plugin: add versionName and versionCode to FlutterExtension (flutter/flutter#146044)
2024-04-01 [email protected] Roll Flutter Engine from bf348cd73d49 to dd4f5cd5c9d5 (1 revision) (flutter/flutter#146071)
2024-04-01 [email protected] Roll Flutter Engine from 984a78b04671 to bf348cd73d49 (1 revision) (flutter/flutter#146065)
2024-04-01 [email protected] Deprecate `ButtonBar`, `ButtonBarThemeData`, and `ThemeData.buttonBarTheme` (flutter/flutter#145523)
2024-04-01 [email protected] Add `DataColumn.headingRowAlignment ` for `DataTable` (flutter/flutter#144006)
2024-04-01 [email protected] Roll Flutter Engine from e9d35f8bfbe2 to 984a78b04671 (2 revisions) (flutter/flutter#146062)
2024-04-01 [email protected] Roll Flutter Engine from 4f6b832c8e33 to e9d35f8bfbe2 (1 revision) (flutter/flutter#146060)
2024-03-31 [email protected] Roll Flutter Engine from 9689390986b7 to 4f6b832c8e33 (1 revision) (flutter/flutter#146055)
2024-03-31 [email protected] Roll Flutter Engine from 34081fea4d59 to 9689390986b7 (1 revision) (flutter/flutter#146053)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App c: tech-debt Technical debt, code quality, testing, etc. f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deprecate ButtonBar

3 participants