Skip to content

Center Floating Snackbar with custom width when direction is RTL - #140215

Merged
auto-submit[bot] merged 2 commits into
flutter:masterfrom
NevercodeHQ:center_snackbar_when_textdirection_is_rtl
Dec 16, 2023
Merged

auto-submit[bot] merged 2 commits into
flutter:masterfrom
NevercodeHQ:center_snackbar_when_textdirection_is_rtl

Conversation

@bleroux

@bleroux bleroux commented Dec 15, 2023

Copy link
Copy Markdown
Contributor

Description

This PR fixes the positionning of a floating snackbar when the text direction is RTL.

Related Issue

Fixes #140125.

Tests

Adds 1 test.

@github-actions github-actions Bot added framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages labels Dec 15, 2023
@bleroux
bleroux requested a review from HansMuller December 15, 2023 15:16

@HansMuller HansMuller 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

@HansMuller HansMuller added the autosubmit Merge PR when tree becomes green via auto submit App label Dec 15, 2023
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Dec 15, 2023
@auto-submit

auto-submit Bot commented Dec 15, 2023

Copy link
Copy Markdown
Contributor

auto label is removed for flutter/flutter/140215, due to - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label.

@HansMuller

Copy link
Copy Markdown
Contributor

auto-submit failed because "[Fri, 15 Dec 2023 21:44:16 UTC] An infra error occurred while running Google testing"

@HansMuller

Copy link
Copy Markdown
Contributor

@bleroux - I tried pressing the "re-run" button but Google testing hasn't restarted. You'll want to push an empty commit to get everything to restart.

@bleroux
bleroux force-pushed the center_snackbar_when_textdirection_is_rtl branch from 1d7b135 to 1742916 Compare December 16, 2023 12:12
@bleroux
bleroux force-pushed the center_snackbar_when_textdirection_is_rtl branch from 1742916 to 279ab85 Compare December 16, 2023 12:50
@bleroux bleroux added the autosubmit Merge PR when tree becomes green via auto submit App label Dec 16, 2023
@auto-submit
auto-submit Bot merged commit 596d9b6 into flutter:master Dec 16, 2023
@bleroux
bleroux deleted the center_snackbar_when_textdirection_is_rtl branch December 16, 2023 20:03
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 17, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 17, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 18, 2023
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Dec 18, 2023
flutter/flutter@2407f69...cdc83e5

2023-12-18 [email protected] Roll Flutter Engine from b3de65a6d3ea to 7f1a81d5545a (1 revision) (flutter/flutter#140309)
2023-12-18 [email protected] refactored cli tool ipa method name to support --export-options-plist (flutter/flutter#138555)
2023-12-18 [email protected] Restore and fix flavors_test_macos (flutter/flutter#139841)
2023-12-18 [email protected] Roll Flutter Engine from 626c93260f79 to b3de65a6d3ea (1 revision) (flutter/flutter#140308)
2023-12-17 [email protected] Roll Flutter Engine from f9c7aa27f13a to 626c93260f79 (1 revision) (flutter/flutter#140291)
2023-12-17 [email protected] Roll Flutter Engine from 726a137e3f99 to f9c7aa27f13a (1 revision) (flutter/flutter#140289)
2023-12-16 [email protected] Roll Flutter Engine from c5fc179cf0b3 to 726a137e3f99 (1 revision) (flutter/flutter#140280)
2023-12-16 [email protected] Roll Flutter Engine from a8d8fbbcef22 to c5fc179cf0b3 (1 revision) (flutter/flutter#140277)
2023-12-16 [email protected] Center Floating Snackbar with custom width when direction is RTL (flutter/flutter#140215)
2023-12-16 [email protected] Roll Flutter Engine from 6752398c2f54 to a8d8fbbcef22 (1 revision) (flutter/flutter#140274)
2023-12-16 [email protected] Use `SemanticsUpdateBuilder` again, remove all references to temporary `SemanticsUpdateBuilderNew` (flutter/flutter#139942)
2023-12-16 [email protected] Roll Flutter Engine from 7d300e5b9587 to 6752398c2f54 (1 revision) (flutter/flutter#140270)
2023-12-16 [email protected] Roll Flutter Engine from 832238a3b493 to 7d300e5b9587 (1 revision) (flutter/flutter#140268)
2023-12-16 [email protected] Roll Flutter Engine from 34d427aa009c to 832238a3b493 (1 revision) (flutter/flutter#140265)
2023-12-16 [email protected] Roll Flutter Engine from 74e4965a2845 to 34d427aa009c (1 revision) (flutter/flutter#140263)
2023-12-16 [email protected] Roll Flutter Engine from ca329dd84207 to 74e4965a2845 (4 revisions) (flutter/flutter#140262)
2023-12-16 [email protected] [github actions] minor PR to test latest github actions (flutter/flutter#140252)
2023-12-16 [email protected] Roll Flutter Engine from 6e3a04874be5 to ca329dd84207 (3 revisions) (flutter/flutter#140255)
2023-12-15 [email protected] Remove usage of testWidgetsWithLeakTracking. (flutter/flutter#140239)
2023-12-15 [email protected] Roll Flutter Engine from a8d861b53db1 to 6e3a04874be5 (1 revision) (flutter/flutter#140244)
2023-12-15 [email protected] Roll Flutter Engine from c48b08ac4682 to a8d861b53db1 (1 revision) (flutter/flutter#140240)
2023-12-15 [email protected] Use new `enabledFeature` param for `Analytics` (flutter/flutter#139934)
2023-12-15 [email protected] Roll Flutter Engine from db98451b063c to c48b08ac4682 (2 revisions) (flutter/flutter#140236)
2023-12-15 [email protected] Reorganize dependencies on leak_tracker. (flutter/flutter#140233)
2023-12-15 [email protected] [macOS,iOS] CocoaPods recommended version: 1.13.0 (flutter/flutter#135447)
2023-12-15 [email protected] Roll Flutter Engine from b36374085c4b to db98451b063c (1 revision) (flutter/flutter#140230)
2023-12-15 [email protected] Roll Flutter Engine from e89b7ed8812b to b36374085c4b (1 revision) (flutter/flutter#140228)
2023-12-15 [email protected] Roll Flutter Engine from 986a6fe198dc to e89b7ed8812b (1 revision) (flutter/flutter#140224)

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 [email protected],[email protected],[email protected] 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://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
@joelrose2

Copy link
Copy Markdown

When will this fix be incorporated into the stable channel? I just updated to Flutter version 3.16.9 and this fix is still not there. Thank you.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 16, 2024
@bleroux

bleroux commented Feb 17, 2024

Copy link
Copy Markdown
Contributor Author

This fix is included in 3.19.0 stable release.

auto-submit Bot pushed a commit that referenced this pull request May 8, 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.
creatorpiyush pushed a commit to creatorpiyush/packages that referenced this pull request Jun 10, 2026
flutter/flutter@2407f69...cdc83e5

2023-12-18 [email protected] Roll Flutter Engine from b3de65a6d3ea to 7f1a81d5545a (1 revision) (flutter/flutter#140309)
2023-12-18 [email protected] refactored cli tool ipa method name to support --export-options-plist (flutter/flutter#138555)
2023-12-18 [email protected] Restore and fix flavors_test_macos (flutter/flutter#139841)
2023-12-18 [email protected] Roll Flutter Engine from 626c93260f79 to b3de65a6d3ea (1 revision) (flutter/flutter#140308)
2023-12-17 [email protected] Roll Flutter Engine from f9c7aa27f13a to 626c93260f79 (1 revision) (flutter/flutter#140291)
2023-12-17 [email protected] Roll Flutter Engine from 726a137e3f99 to f9c7aa27f13a (1 revision) (flutter/flutter#140289)
2023-12-16 [email protected] Roll Flutter Engine from c5fc179cf0b3 to 726a137e3f99 (1 revision) (flutter/flutter#140280)
2023-12-16 [email protected] Roll Flutter Engine from a8d8fbbcef22 to c5fc179cf0b3 (1 revision) (flutter/flutter#140277)
2023-12-16 [email protected] Center Floating Snackbar with custom width when direction is RTL (flutter/flutter#140215)
2023-12-16 [email protected] Roll Flutter Engine from 6752398c2f54 to a8d8fbbcef22 (1 revision) (flutter/flutter#140274)
2023-12-16 [email protected] Use `SemanticsUpdateBuilder` again, remove all references to temporary `SemanticsUpdateBuilderNew` (flutter/flutter#139942)
2023-12-16 [email protected] Roll Flutter Engine from 7d300e5b9587 to 6752398c2f54 (1 revision) (flutter/flutter#140270)
2023-12-16 [email protected] Roll Flutter Engine from 832238a3b493 to 7d300e5b9587 (1 revision) (flutter/flutter#140268)
2023-12-16 [email protected] Roll Flutter Engine from 34d427aa009c to 832238a3b493 (1 revision) (flutter/flutter#140265)
2023-12-16 [email protected] Roll Flutter Engine from 74e4965a2845 to 34d427aa009c (1 revision) (flutter/flutter#140263)
2023-12-16 [email protected] Roll Flutter Engine from ca329dd84207 to 74e4965a2845 (4 revisions) (flutter/flutter#140262)
2023-12-16 [email protected] [github actions] minor PR to test latest github actions (flutter/flutter#140252)
2023-12-16 [email protected] Roll Flutter Engine from 6e3a04874be5 to ca329dd84207 (3 revisions) (flutter/flutter#140255)
2023-12-15 [email protected] Remove usage of testWidgetsWithLeakTracking. (flutter/flutter#140239)
2023-12-15 [email protected] Roll Flutter Engine from a8d861b53db1 to 6e3a04874be5 (1 revision) (flutter/flutter#140244)
2023-12-15 [email protected] Roll Flutter Engine from c48b08ac4682 to a8d861b53db1 (1 revision) (flutter/flutter#140240)
2023-12-15 [email protected] Use new `enabledFeature` param for `Analytics` (flutter/flutter#139934)
2023-12-15 [email protected] Roll Flutter Engine from db98451b063c to c48b08ac4682 (2 revisions) (flutter/flutter#140236)
2023-12-15 [email protected] Reorganize dependencies on leak_tracker. (flutter/flutter#140233)
2023-12-15 [email protected] [macOS,iOS] CocoaPods recommended version: 1.13.0 (flutter/flutter#135447)
2023-12-15 [email protected] Roll Flutter Engine from b36374085c4b to db98451b063c (1 revision) (flutter/flutter#140230)
2023-12-15 [email protected] Roll Flutter Engine from e89b7ed8812b to b36374085c4b (1 revision) (flutter/flutter#140228)
2023-12-15 [email protected] Roll Flutter Engine from 986a6fe198dc to e89b7ed8812b (1 revision) (flutter/flutter#140224)

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 [email protected],[email protected],[email protected] 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://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
chunhtai pushed a commit to chunhtai/packages that referenced this pull request Jun 12, 2026
## Description

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

In flutter/flutter#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 flutter/flutter#147838.

## Tests

Adds 1 test.
bisor0627 pushed a commit to bisor0627/packages that referenced this pull request Jun 19, 2026
flutter/flutter@2407f69...cdc83e5

2023-12-18 [email protected] Roll Flutter Engine from b3de65a6d3ea to 7f1a81d5545a (1 revision) (flutter/flutter#140309)
2023-12-18 [email protected] refactored cli tool ipa method name to support --export-options-plist (flutter/flutter#138555)
2023-12-18 [email protected] Restore and fix flavors_test_macos (flutter/flutter#139841)
2023-12-18 [email protected] Roll Flutter Engine from 626c93260f79 to b3de65a6d3ea (1 revision) (flutter/flutter#140308)
2023-12-17 [email protected] Roll Flutter Engine from f9c7aa27f13a to 626c93260f79 (1 revision) (flutter/flutter#140291)
2023-12-17 [email protected] Roll Flutter Engine from 726a137e3f99 to f9c7aa27f13a (1 revision) (flutter/flutter#140289)
2023-12-16 [email protected] Roll Flutter Engine from c5fc179cf0b3 to 726a137e3f99 (1 revision) (flutter/flutter#140280)
2023-12-16 [email protected] Roll Flutter Engine from a8d8fbbcef22 to c5fc179cf0b3 (1 revision) (flutter/flutter#140277)
2023-12-16 [email protected] Center Floating Snackbar with custom width when direction is RTL (flutter/flutter#140215)
2023-12-16 [email protected] Roll Flutter Engine from 6752398c2f54 to a8d8fbbcef22 (1 revision) (flutter/flutter#140274)
2023-12-16 [email protected] Use `SemanticsUpdateBuilder` again, remove all references to temporary `SemanticsUpdateBuilderNew` (flutter/flutter#139942)
2023-12-16 [email protected] Roll Flutter Engine from 7d300e5b9587 to 6752398c2f54 (1 revision) (flutter/flutter#140270)
2023-12-16 [email protected] Roll Flutter Engine from 832238a3b493 to 7d300e5b9587 (1 revision) (flutter/flutter#140268)
2023-12-16 [email protected] Roll Flutter Engine from 34d427aa009c to 832238a3b493 (1 revision) (flutter/flutter#140265)
2023-12-16 [email protected] Roll Flutter Engine from 74e4965a2845 to 34d427aa009c (1 revision) (flutter/flutter#140263)
2023-12-16 [email protected] Roll Flutter Engine from ca329dd84207 to 74e4965a2845 (4 revisions) (flutter/flutter#140262)
2023-12-16 [email protected] [github actions] minor PR to test latest github actions (flutter/flutter#140252)
2023-12-16 [email protected] Roll Flutter Engine from 6e3a04874be5 to ca329dd84207 (3 revisions) (flutter/flutter#140255)
2023-12-15 [email protected] Remove usage of testWidgetsWithLeakTracking. (flutter/flutter#140239)
2023-12-15 [email protected] Roll Flutter Engine from a8d861b53db1 to 6e3a04874be5 (1 revision) (flutter/flutter#140244)
2023-12-15 [email protected] Roll Flutter Engine from c48b08ac4682 to a8d861b53db1 (1 revision) (flutter/flutter#140240)
2023-12-15 [email protected] Use new `enabledFeature` param for `Analytics` (flutter/flutter#139934)
2023-12-15 [email protected] Roll Flutter Engine from db98451b063c to c48b08ac4682 (2 revisions) (flutter/flutter#140236)
2023-12-15 [email protected] Reorganize dependencies on leak_tracker. (flutter/flutter#140233)
2023-12-15 [email protected] [macOS,iOS] CocoaPods recommended version: 1.13.0 (flutter/flutter#135447)
2023-12-15 [email protected] Roll Flutter Engine from b36374085c4b to db98451b063c (1 revision) (flutter/flutter#140230)
2023-12-15 [email protected] Roll Flutter Engine from e89b7ed8812b to b36374085c4b (1 revision) (flutter/flutter#140228)
2023-12-15 [email protected] Roll Flutter Engine from 986a6fe198dc to e89b7ed8812b (1 revision) (flutter/flutter#140224)

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 [email protected],[email protected],[email protected] 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://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 framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flutter snackbar position incorrect when useMaterial3=true and locale=he (suspected Flutter framework bug)

3 participants