Skip to content

[material_ui] Ensure textScaler is taken into account for SnackBar action overflow - #12737

Open
matasb-google wants to merge 1 commit into
flutter:mainfrom
matasb-google:port-pr-181959-snackbar
Open

[material_ui] Ensure textScaler is taken into account for SnackBar action overflow#12737
matasb-google wants to merge 1 commit into
flutter:mainfrom
matasb-google:port-pr-181959-snackbar

Conversation

@matasb-google

Copy link
Copy Markdown

Port of flutter/flutter#181959 to flutter/packages as part of the Material decoupling effort (flutter/flutter#188444).

Ensure textScalling is taken into account for Sizing overflow.

Fixes flutter/flutter#192232
Fixes flutter/flutter#181959
Part of flutter/flutter#188444

Description

  • Ensure textScalling is taken into account for Sizing overflow: passes MediaQuery.textScalerOf(context) to actionTextPainter so that actionAndIconWidth properly scales with accessibility text scaling.
  • Removes SizedBox(width: snackBarWidth * 0.4) when the action overflows, eliminating unintended blank space on the right of multi-line content.
  • Adds unit tests in snack_bar_test.dart verifying textScaler overflow calculation and layout.
  • Adds pending changelog entry.

Pre-Review Checklist

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

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2

…tion overflow

Port of flutter/flutter#181959 to flutter/packages as part of the Material decoupling effort (flutter/flutter#188444).

- Ensure MediaQuery's textScaler is passed to actionTextPainter so that action button width calculation scales appropriately.
- Remove SizedBox(width: snackBarWidth * 0.4) when action overflows, eliminating unintended blank space on the right of multi-line content.
- Add unit tests verifying textScaler overflow calculation and layout.
- Add pending changelog entry.
@github-actions github-actions Bot added p: material_ui triage-design Should be looked at in design triage labels Sep 3, 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 updates the SnackBar implementation to respect the MediaQuery's TextScaler when calculating action overflow, and removes the unnecessary 40% blank right spacing in multi-line layouts. It also adds corresponding widget tests to verify these behaviors. There are no review comments, so I have no feedback to provide.

@matasb-google

Copy link
Copy Markdown
Author

@Piinks This has now been ported over from flutter/flutter#181959 with unit tests and pending changelog following #188444. Ready for review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

[material_ui] SnackBar action overflow calculation does not account for MediaQuery textScaler

1 participant