Skip to content

[material_ui] Fix minimum width for Material 3 primary tab indicator - #13322

Merged
auto-submit[bot] merged 5 commits into
flutter:mainfrom
hamza-flutterdev:fix/material3-primary-tab-indicator-min-width
Nov 6, 2026
Merged

auto-submit[bot] merged 5 commits into
flutter:mainfrom
hamza-flutterdev:fix/material3-primary-tab-indicator-min-width

Conversation

@hamza-flutterdev

@hamza-flutterdev hamza-flutterdev commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

This change gives the default Material 3 primary TabBar indicator a minimum width of 24dp, centered on the selected label, as specified by the Material 3 tabs spec. It adds a regression test for a short tab label. Custom indicators and secondary tabs retain their existing sizing behavior.

part of flutter/flutter#194716

Testing

  • dart run script/tool/bin/flutter_plugin_tools.dart test --packages=material_ui — passed for all four targets: material_ui, its example, the accessibility assessments app, and gen_defaults.
  • flutter test test/tabs_test.dart — passed (204 tests), including the 24dp regression test.
  • flutter analyze lib/src/tabs.dart test/tabs_test.dart — no issues found.
  • dart format lib/src/tabs.dart test/tabs_test.dart — completed; no formatting changes were needed.

Pre-Review Checklist

@github-actions github-actions Bot added p: material_ui triage-design Should be looked at in design triage labels Oct 19, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a minimum width of 24dp for the Material 3 primary tab indicator when using the default label indicator size. It updates _IndicatorPainter to accept and enforce a minimumIndicatorWidth during painting and repainting checks, and adds a corresponding widget test to verify this behavior. There are no review comments, so no additional feedback is provided.

@fluttergithubbot

Copy link
Copy Markdown
Contributor

An existing Git SHA, e2cda364044cefe83645595c796a83f37ae8e9a8, was detected, and no actions were taken.

To re-trigger presubmits after closing or re-opeing a PR, or pushing a HEAD commit (i.e. with --force) that already was pushed before, push a blank commit (git commit --allow-empty -m "Trigger Build") or rebase to continue.

@elliette

Copy link
Copy Markdown
Member

Thanks for the contribution! You’ve checked boxes in the PR checklist above that are not reflected in this PR, so I’m assuming this is a work in progress and am marking it as a Draft. Please review the checklist, updating the PR as appropriate, and when the state of the PR as posted reflects the checklist please feel free to mark it as ready for review.

@elliette
elliette marked this pull request as draft October 27, 2026 21:24
@hamza-flutterdev hamza-flutterdev changed the title Fix minimum width for Material 3 primary tab indicator [material_ui] Fix minimum width for Material 3 primary tab indicator Oct 28, 2026
@hamza-flutterdev
hamza-flutterdev marked this pull request as ready for review October 28, 2026 05:45

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a minimum width of 24dp for primary tab indicators when using Material 3 with the default label indicator size. It updates the _IndicatorPainter to enforce this minimum width by centering the indicator if its calculated width is smaller than the minimum, and adds a corresponding widget test to verify this behavior. There are no review comments, so no additional feedback is provided.

@hamza-flutterdev

Copy link
Copy Markdown
Contributor Author

Hi @elliette, thanks for the guidance. I’ve updated the PR title and description, added the material_ui pending changelog entry and reviewed the checklist. The PR is now ready for review.

The full material_ui test command passed all four targets. The focused tabs_test.dart run passed all 204 tests, including the new regression test and analysis reported no issues.

@QuncCccccc QuncCccccc added the CICD Run CI/CD label Nov 3, 2026

@QuncCccccc QuncCccccc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Thanks for your contribution! Instead of fixes the issue, I changed it to "part of" because the original issue is also requesting to support secondary tab theme.

@QuncCccccc
QuncCccccc force-pushed the fix/material3-primary-tab-indicator-min-width branch from 1965554 to 25e3e51 Compare November 5, 2026 22:04
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Nov 5, 2026
@QuncCccccc QuncCccccc added the CICD Run CI/CD label Nov 5, 2026

@QuncCccccc QuncCccccc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should update the doc accordingy.

Comment thread packages/material_ui/lib/src/tabs.dart Resolved
Clarify that the 24dp minimum applies to the default Material 3 primary TabBar indicator. Note that custom indicators retain their previous sizing.

Co-authored-by: Qun Cheng <[email protected]>
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Nov 6, 2026
@hamza-flutterdev

Copy link
Copy Markdown
Contributor Author

@QuncCccccc I’ve applied your suggested changelog change and resolved the conversation. Could you please take another look and approve the PR if everything else looks good?

@QuncCccccc QuncCccccc added the CICD Run CI/CD label Nov 6, 2026
@QuncCccccc

Copy link
Copy Markdown
Contributor

Thank you! Please wait for a second review and then we are good to go:)

@elliette elliette left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thank you!

@elliette elliette added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 6, 2026
@auto-submit
auto-submit Bot merged commit 2a9ec69 into flutter:main Nov 6, 2026
14 checks passed
definev pushed a commit to definev/flutter that referenced this pull request Nov 9, 2026
…6210)

flutter/packages@63881f9...565c657

2026-11-08 [email protected] Roll Flutter from
e36b370 to acade0f (1 revision) (flutter/packages#13590)
2026-11-07 [email protected] [material_ui] Fix
DropdownMenu losing text cursor when re-enabled (flutter/packages#13179)
2026-11-07 [email protected] Roll Flutter from
09175cd to e36b370 (22 revisions) (flutter/packages#13586)
2026-11-07 [email protected] [material_ui]
Add Material motion springs (flutter/packages#13338)
2026-11-06 [email protected] [material_ui] Paint
the active RoundedRectSliderTrackShape segment on top in RTL
(flutter/packages#13225)
2026-11-06 [email protected] [pigeon] Replace Experimental with
Preview (flutter/packages#13579)
2026-11-06 [email protected] [material_ui] Fix minimum width
for Material 3 primary tab indicator (flutter/packages#13322)
2026-11-06 [email protected]
[material_ui] Dispose drag-end CurvedAnimation in modal bottom sheet
(flutter/packages#13167)
2026-11-06 [email protected] [camera_web] Re: Support for camera
stream on web (flutter/packages#7950)
2026-11-06 [email protected] Roll Flutter from
3623d2d to 09175cd (61 revisions) (flutter/packages#13578)

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

To file a bug in Flutter:
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 CICD Run CI/CD p: material_ui triage-design Should be looked at in design triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants