New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Scrollable TabBar
for Material 3
#131409
Conversation
8cb4860
to
0b1327e
Compare
Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change). If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. Changes reported for pull request #131409 at sha 0b1327e9fb159096bf1cea3f8e14560073231a41 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woohoo - LGTM to reland (kicks off Google testing). There will likely be over a 1000 images to check on this one. Standby! 😉
0b1327e
to
56ed828
Compare
Checked all customer test images, this is good to go. Needed to rebase to reset the google check though. |
Golden file changes are available for triage from new commit, Click here to view. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
Triaged goldens and manually set google status since I have run a global check already inside of Google. Last time Google changed between this landing and getting rolled in, so making sure to expedite this time. 👍 |
fixes [Material 3 `TabBar` does not take full width when `isScrollable: true`](flutter#117722) ### Description 1. Fixed the divider doesn't stretch to take all the available width in the scrollable tab bar in M3 2. Added `dividerHeight` property. ### Code sample <details> <summary>expand to view the code sample</summary> ```dart import 'package:flutter/material.dart'; /// Flutter code sample for [TabBar]. void main() => runApp(const TabBarApp()); class TabBarApp extends StatelessWidget { const TabBarApp({super.key}); @OverRide Widget build(BuildContext context) { return const MaterialApp( debugShowCheckedModeBanner: false, home: TabBarExample(), ); } } class TabBarExample extends StatefulWidget { const TabBarExample({super.key}); @OverRide State<TabBarExample> createState() => _TabBarExampleState(); } class _TabBarExampleState extends State<TabBarExample> { bool rtl = false; bool customColors = false; bool removeDivider = false; Color dividerColor = Colors.amber; Color indicatorColor = Colors.red; @OverRide Widget build(BuildContext context) { return DefaultTabController( initialIndex: 1, length: 3, child: Directionality( textDirection: rtl ? TextDirection.rtl : TextDirection.ltr, child: Scaffold( appBar: AppBar( title: const Text('TabBar Sample'), actions: <Widget>[ IconButton.filledTonal( tooltip: 'Switch direction', icon: const Icon(Icons.swap_horiz), onPressed: () { setState(() { rtl = !rtl; }); }, ), IconButton.filledTonal( tooltip: 'Use custom colors', icon: const Icon(Icons.color_lens), onPressed: () { setState(() { customColors = !customColors; }); }, ), IconButton.filledTonal( tooltip: 'Show/hide divider', icon: const Icon(Icons.remove_rounded), onPressed: () { setState(() { removeDivider = !removeDivider; }); }, ), ], ), body: Column( children: <Widget>[ const Spacer(), const Text('Scrollable - TabAlignment.start'), TabBar( isScrollable: true, tabAlignment: TabAlignment.start, dividerColor: customColors ? dividerColor : null, indicatorColor: customColors ? indicatorColor : null, dividerHeight: removeDivider ? 0 : null, tabs: const <Widget>[ Tab( icon: Icon(Icons.cloud_outlined), ), Tab( icon: Icon(Icons.beach_access_sharp), ), Tab( icon: Icon(Icons.brightness_5_sharp), ), ], ), const Text('Scrollable - TabAlignment.startOffset'), TabBar( isScrollable: true, tabAlignment: TabAlignment.startOffset, dividerColor: customColors ? dividerColor : null, indicatorColor: customColors ? indicatorColor : null, dividerHeight: removeDivider ? 0 : null, tabs: const <Widget>[ Tab( icon: Icon(Icons.cloud_outlined), ), Tab( icon: Icon(Icons.beach_access_sharp), ), Tab( icon: Icon(Icons.brightness_5_sharp), ), ], ), const Text('Scrollable - TabAlignment.center'), TabBar( isScrollable: true, tabAlignment: TabAlignment.center, dividerColor: customColors ? dividerColor : null, indicatorColor: customColors ? indicatorColor : null, dividerHeight: removeDivider ? 0 : null, tabs: const <Widget>[ Tab( icon: Icon(Icons.cloud_outlined), ), Tab( icon: Icon(Icons.beach_access_sharp), ), Tab( icon: Icon(Icons.brightness_5_sharp), ), ], ), const Spacer(), const Text('Non-scrollable - TabAlignment.fill'), TabBar( tabAlignment: TabAlignment.fill, dividerColor: customColors ? dividerColor : null, indicatorColor: customColors ? indicatorColor : null, dividerHeight: removeDivider ? 0 : null, tabs: const <Widget>[ Tab( icon: Icon(Icons.cloud_outlined), ), Tab( icon: Icon(Icons.beach_access_sharp), ), Tab( icon: Icon(Icons.brightness_5_sharp), ), ], ), const Text('Non-scrollable - TabAlignment.center'), TabBar( tabAlignment: TabAlignment.center, dividerColor: customColors ? dividerColor : null, indicatorColor: customColors ? indicatorColor : null, dividerHeight: removeDivider ? 0 : null, tabs: const <Widget>[ Tab( icon: Icon(Icons.cloud_outlined), ), Tab( icon: Icon(Icons.beach_access_sharp), ), Tab( icon: Icon(Icons.brightness_5_sharp), ), ], ), const Spacer(), const Text('Secondary - TabAlignment.fill'), TabBar.secondary( tabAlignment: TabAlignment.fill, dividerColor: customColors ? dividerColor : null, indicatorColor: customColors ? indicatorColor : null, dividerHeight: removeDivider ? 0 : null, tabs: const <Widget>[ Tab( icon: Icon(Icons.cloud_outlined), ), Tab( icon: Icon(Icons.beach_access_sharp), ), Tab( icon: Icon(Icons.brightness_5_sharp), ), ], ), const Text('Secondary - TabAlignment.center'), TabBar.secondary( tabAlignment: TabAlignment.center, dividerColor: customColors ? dividerColor : null, indicatorColor: customColors ? indicatorColor : null, dividerHeight: removeDivider ? 0 : null, tabs: const <Widget>[ Tab( icon: Icon(Icons.cloud_outlined), ), Tab( icon: Icon(Icons.beach_access_sharp), ), Tab( icon: Icon(Icons.brightness_5_sharp), ), ], ), const Spacer(), ], ), ), ), ); } } ``` </details> ### Before ![Screenshot 2023-07-27 at 14 12 36](https://github.com/flutter/flutter/assets/48603081/1c08a9d2-ac15-4d33-8fa1-c765b4b10f92) ### After ![Screenshot 2023-07-27 at 14 13 12](https://github.com/flutter/flutter/assets/48603081/7e662dfe-9f32-46c9-a128-3024a4782882) This also contains regression test for flutter#125974 (comment) ```dart // This is a regression test for flutter#125974 (comment). testWidgets('Divider can be constrained', (WidgetTester tester) async { ``` ![Screenshot 2023-07-27 at 14 16 37](https://github.com/flutter/flutter/assets/48603081/ac2ef49b-2410-46d0-8ae2-d9b77236abba)
Roll Flutter from 1d59196bafdb to b3f99ffe610a (32 revisions) flutter/flutter@1d59196...b3f99ff 2023-08-02 dnfield@google.com Fix reentrancy with WidgetBindingObserver callbacks (flutter/flutter#131774) 2023-08-02 42216813+eliasyishak@users.noreply.github.com Update .ci.yaml to add new shard to prevent timeouts (flutter/flutter#131712) 2023-08-02 katelovett@google.com Fix flex methods for min and max column widths (flutter/flutter#131724) 2023-08-02 engine-flutter-autoroll@skia.org Manual roll Flutter Engine from 9dae7b708bda to d6b962d0e36d (25 revisions) (flutter/flutter#131785) 2023-08-02 30870216+gaaclarke@users.noreply.github.com Added standard deviation to rasterizer results. (flutter/flutter#131781) 2023-08-02 5236035+fzyzcjy@users.noreply.github.com Tiny remove outdated comments (flutter/flutter#130387) 2023-08-02 49699333+dependabot[bot]@users.noreply.github.com Bump ubuntu from `f8f6584` to `c9820a4` in /dev/ci/docker_linux (flutter/flutter#130292) 2023-08-02 chevalier.dan@gmail.com Fix for endless recursion for getLayoutExplorerNode on a Tooltip (flutter/flutter#131486) 2023-08-02 49699333+dependabot[bot]@users.noreply.github.com Bump google/mirror-branch-action from 1.0 to 2.0 (flutter/flutter#126600) 2023-08-02 49699333+dependabot[bot]@users.noreply.github.com Bump dessant/lock-threads from 4.0.0 to 4.0.1 (flutter/flutter#128741) 2023-08-02 49699333+dependabot[bot]@users.noreply.github.com Bump codecov/codecov-action from 3.1.3 to 3.1.4 (flutter/flutter#126885) 2023-08-02 kj415j45@gmail.com Update `ThemeData`'s factory method documents (flutter/flutter#123984) 2023-08-02 tessertaha@gmail.com Fix Scrollable `TabBar` for Material 3 (flutter/flutter#131409) 2023-08-02 ian@hixie.ch ImageProvider.toString uses double.toStringAsFixed (flutter/flutter#131348) 2023-08-02 engine-flutter-autoroll@skia.org Roll Flutter Engine from 10a1f9cb74c9 to 9dae7b708bda (4 revisions) (flutter/flutter#131706) 2023-08-01 polinach@google.com Upgrade Flutter libraries. (flutter/flutter#131700) 2023-08-01 engine-flutter-autoroll@skia.org Roll Flutter Engine from 1aadc75dd5a7 to 10a1f9cb74c9 (1 revision) (flutter/flutter#131696) 2023-08-01 engine-flutter-autoroll@skia.org Roll Flutter Engine from e3f817ce9953 to 1aadc75dd5a7 (2 revisions) (flutter/flutter#131691) 2023-08-01 engine-flutter-autoroll@skia.org Roll Packages from 60e9a54 to 3dc00c1 (5 revisions) (flutter/flutter#131692) 2023-08-01 dnfield@google.com Avoid concurrent modification of persistent frame callbacks (flutter/flutter#131677) 2023-08-01 engine-flutter-autoroll@skia.org Roll Flutter Engine from ae535c024146 to e3f817ce9953 (1 revision) (flutter/flutter#131687) 2023-08-01 engine-flutter-autoroll@skia.org Roll Flutter Engine from 703d45539059 to ae535c024146 (4 revisions) (flutter/flutter#131679) 2023-08-01 engine-flutter-autoroll@skia.org Roll Flutter Engine from f1c80ce98499 to 703d45539059 (1 revision) (flutter/flutter#131668) 2023-08-01 engine-flutter-autoroll@skia.org Roll Flutter Engine from 2583c07f6a69 to f1c80ce98499 (1 revision) (flutter/flutter#131663) 2023-08-01 engine-flutter-autoroll@skia.org Roll Flutter Engine from 25b9d1088d09 to 2583c07f6a69 (1 revision) (flutter/flutter#131661) 2023-08-01 engine-flutter-autoroll@skia.org Roll Flutter Engine from 7651b3cba6ba to 25b9d1088d09 (4 revisions) (flutter/flutter#131655) 2023-08-01 engine-flutter-autoroll@skia.org Roll Flutter Engine from 1433e23c8a3d to 7651b3cba6ba (2 revisions) (flutter/flutter#131648) 2023-08-01 engine-flutter-autoroll@skia.org Roll Flutter Engine from 791f505c8c6e to 1433e23c8a3d (1 revision) (flutter/flutter#131647) 2023-08-01 engine-flutter-autoroll@skia.org Roll Flutter Engine from bb2a903c934c to 791f505c8c6e (4 revisions) (flutter/flutter#131645) 2023-08-01 github@alexv525.com 🐛 Treat empty ARB content as empty map when decoding (flutter/flutter#131242) 2023-08-01 engine-flutter-autoroll@skia.org Roll Flutter Engine from fe2369565f59 to bb2a903c934c (3 revisions) (flutter/flutter#131639) 2023-07-31 engine-flutter-autoroll@skia.org Roll Flutter Engine from b83172a4e995 to fe2369565f59 (12 revisions) (flutter/flutter#131638) 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 camillesimon@google.com,rmistry@google.com,stuartmorgan@google.com 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://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md ...
…property" (#9229) fixes #9228 Timeline and PR reference in [Customizing tabs alignment using the new TabBar.tabAlignment property](https://docs.flutter.dev/release/breaking-changes/tab-alignment) are outdated flutter/flutter#131409 landed recently and the breaking change page needs to reflect that.
…property" (flutter#9229) fixes flutter#9228 Timeline and PR reference in [Customizing tabs alignment using the new TabBar.tabAlignment property](https://docs.flutter.dev/release/breaking-changes/tab-alignment) are outdated flutter/flutter#131409 landed recently and the breaking change page needs to reflect that.
…property" (flutter#9229) fixes flutter#9228 Timeline and PR reference in [Customizing tabs alignment using the new TabBar.tabAlignment property](https://docs.flutter.dev/release/breaking-changes/tab-alignment) are outdated flutter/flutter#131409 landed recently and the breaking change page needs to reflect that.
fixes Material 3
TabBar
does not take full width whenisScrollable: true
Description
dividerHeight
property.Code sample
expand to view the code sample
Before
After
This also contains regression test for #125974 (comment)
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.