You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CupertinoNavigationBar/CupertinoSliverNavigationBar previous route title replacement logic differs from native iOS #40583
Currently, the back button title is replaced with "Back" only when the previous route title is longer than 12 characters, which doesn't seem to match the native iOS logic.
The attached screenshots demonstrate how native iOS navigation bar replaces the previous route title only when there's not enough room to fit the title.
A common parent route:
Back button title is "Back" instead of "Keyboards" since there's not enough room to fit it:
Back button title is "Keyboards" since there's enough room to fit it:
Activity
justinmc commentedon Sep 24, 2019
I see this behavior as well. It seems to be hardcoded to use "Back" when the string is over 12 characters:
flutter/packages/flutter/lib/src/cupertino/nav_bar.dart
Lines 1392 to 1394 in 4815b26
Here's a quick app I wrote to demo the problem:
https://gist.github.com/justinmc/818dfffdf3fa21939d0160c7bb510ff2
I guess ideally Flutter should only change it to "Back" if it collides with the center label? Can anyone confirm that's what native iOS does?
markusaksli-nc commentedon Sep 15, 2020
Native seems to try to truncate the title first?
In any case this remains hardcoded and doesn't match native
flutter/packages/flutter/lib/src/cupertino/nav_bar.dart
Lines 1439 to 1441 in 37b03ec
Freelenzer commentedon Feb 10, 2021
This should at least be documented.
Same issue as here:
#50941
maheshj01 commentedon Dec 9, 2022
The issue reproduces on stable 3.3 and masters 3.7,
Notice that in Native behavior when the title is too long the leading has a back button icon only
Screen.Recording.2022-12-09.at.1.43.52.PM.mov
Screen.Recording.2022-12-09.at.1.45.37.PM.mov
code sample
flutter doctor -v (mac)