Skip to content
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 floating SnackBar is not centered when RTL and Material 2 #147861

Conversation

bleroux
Copy link
Contributor

@bleroux bleroux commented May 6, 2024

Description

This PR fixes floating SnackBar positioning when the text direction is RTL and the theme uses Material 2.

In #140215, I fixed the SnackBar position for M3/RTL, but while doing so I broke the positioning for M2/RTL... Unfortunately, there was no existing test for this case.
The solution is to not rely on TextDirection to compute the SnackBar position: the SnackBar is centered in both cases so the text direction has no impact on its positioning (it had some impact in the SnackBar content, but this is managed correctly).

Related Issue

Fixes #147838.

Tests

Adds 1 test.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels May 6, 2024
@bleroux bleroux requested a review from Piinks May 6, 2024 14:14
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.

Nice fix for a regression! LGTM!

@bleroux bleroux added the autosubmit Merge PR when tree becomes green via auto submit App label May 8, 2024
@auto-submit auto-submit bot merged commit 86a2613 into flutter:master May 8, 2024
72 checks passed
@bleroux bleroux deleted the fix_floating_snackbar_not_centered_when_rtl_and_M2 branch May 8, 2024 07:35
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 8, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 8, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 8, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 8, 2024
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 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.

[M2] Snackbar is not properly aligned when using RTL Directionality
2 participants