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 system nav bar color #1614

Merged
merged 2 commits into from
Nov 27, 2024
Merged

Conversation

micahmo
Copy link
Member

@micahmo micahmo commented Nov 27, 2024

Alright, I believe I've finally fixed the issue of the system nav bar color! See this comment and this comment for more context.

The clue came from this comment: rydmike/flex_color_scheme#178 (comment) Doing what they suggested fixed the issue!

Before

qemu-system-x86_64_4xXkaCSTqb.mp4

After

qemu-system-x86_64_q4p316Xmbn.mp4

Note that there is one subtle difference now. On pages that don't have the in-app nav area at the bottom, you can see that the system nav bar is completely transparent, whereas before it was white. (To be honest, I would've expected it to always be transparent, given what we were setting it to.) That said, I'm not sure if it's a big deal. It's probably all part of Google/Flutter's push to make apps truly edge-to-edge. For reference, Sync and Relay also both have a completely tranparent system nav bar. (I'm curious what Thunder looks like on iOS.) What do you think?

Before (white nav bar in comments)

qemu-system-x86_64_hsrGBkbRD9.mp4

After (transparent nav bar in comments)

qemu-system-x86_64_EdJVzTEyUd.mp4

Please review with whitespace off.

P.S. It's possible we don't need this code any more, but I left it anyway.

thunder/lib/main.dart

Lines 238 to 242 in 61c9392

SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle(
systemNavigationBarColor: Colors.black.withOpacity(0.0001),
),
);

@micahmo micahmo requested a review from hjiangsu November 27, 2024 19:22
@micahmo micahmo changed the title Fix system navbar color Fix system nav bar color Nov 27, 2024
@hjiangsu
Copy link
Member

Wow, great find! I took a look at the links you mentioned, and also found a possible suggestion/improvement (up to you whether you want to implement it though!) flex_color_scheme exposes a static function that allows us to customize the system navigation bar a bit further: FlexColorScheme.themedSystemNavigationBar.

Thoughts on switching to this rather than specifying our own SystemUiOverlayStyle as its probably more robust?

For example:

SystemUiOverlayStyle systemUiOverlayStyle = FlexColorScheme.themedSystemNavigationBar(context, systemNavBarStyle: FlexSystemNavBarStyle.transparent);

AnnotatedRegion<SystemUiOverlayStyle>(
    value: systemUiOverlayStyle,
    child: ...
)

@micahmo
Copy link
Member Author

micahmo commented Nov 27, 2024

I'm good with doing that! My only concern is that it only allows us to set the value of navigation bar. I'm also working on fixing the color of the status bar, and I might have to do it in the same area, which means specify a custom SystemUiOverlayStyle. But I'll cross that bridge when I come to it. I just pushed your suggested change, and I went ahead and removed the old code that probably isn't needed. Should be good to go, if it looks good to you!

Copy link
Member

@hjiangsu hjiangsu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks again for finding this fix!

@hjiangsu hjiangsu merged commit d8bb721 into thunder-app:develop Nov 27, 2024
1 check passed
@micahmo micahmo deleted the fix/navbar-color branch November 27, 2024 20:28
@micahmo micahmo mentioned this pull request Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants