Skip to content

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
@bleroux bleroux deleted the fix_floating_snackbar_not_centered_when_rtl_and_M2 branch May 8, 2024 07:35
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