-
Notifications
You must be signed in to change notification settings - Fork 27.7k
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
[Android Q] Transparent navigation bar with extended scaffold #34678
Comments
While this has been a hot topic now, Google is recommending to use transparent navigation bar everywhere, not only in Q. Since users in Q will be able to choose between the new and the old navigation bar, we should just use the entire display for most apps and add a bottom padding to lists. |
This is related to #32748, just adding this in to tie all Android Q issues together |
Actually, I believe removing the bottom navigation bar is already possible with SystemChrome. setEnabledSystemUIOverlays. What you have to do is import
The main piece that's missing is how to determine the system |
There is a problem. You don't want this: On Android it's recommended that you keep FAB and etc at relative 16 (i.e. in the safe area) because.. well, as you saw there, you don't know the height of the bar. On iOS, Google has been using absolute 16 because the bar height is always the same. |
Any updates on this? |
What is the particular ask? It's already currently possible to set a transparent navigation bar using the SystemChrome API |
So, I am able to make the navigation bar transparent but I cannot draw a layout behind the navigation bar. |
I will close this for now, since it seems like it is possible to create a transparent navigation bar that allows the Scaffold to extend behind the Android Q nav bar using SystemChrome.setEnabledSystemUIOverlays. However, if there seems to be more precise asks, please feel free to file new issues so that we can track individual needs. Every contribution to this issue seems to be asking for slightly different things (ie transparent Android Q nav bar, making the nav bar transparent while still exposing system windows insets regardless of Android SDK version, etc). |
Hey @shihaohong how about post-Lollipop and pre-Q devices? |
I'm thinking that just setting the navigation bar to transparent using SystemChrome.setEnabledSystemUIOverlays doesn't create the padding (for lists and more). |
As per my original comment, please file a new issue with reproducible samples for unique, specific asks. It's hard to keep track of what needs to be done to account for full screen navigation when there are different permutations of needs by different developers. |
@shihaohong SystemChrome.setEnabledSystemUIOverlay this is a hack, I don't want a semi-fullscreen app... |
Reading all the comments here and having struggled wit this too, I think it is fairly obvious what is asked for. A way to to make a fully transparent Android system navigation bar where only the Android navigation buttons are opaque (or semi transparent) that also plays nice with other bottom widgets used in Flutter. Meaning e.g a FAB or a bottom navigation bar should remain above the transparent navigation button area if used, but the scaffold content should paint (scroll) behind them all. It might be a good idea to have it as an option that the bottom navbars and FAB can optionally start from the "true" bottom too, then you will of course get the situation that was shown in the screenshot above, which in some special design cases might be desired or at least a needed starting point for the layout. More discussion on the topic Combined with the Scaffold's extendBody property and the new extendBodyBehindAppBar #39156 property, that now also extends the body behind the top system statusbar icons, we can now in Flutter easily make "fullscreen" designs that have become fairly popular, for certain apps at least. The AppBar overlay on the top system statusbar can already be made fully or semi transparent, and now the scaffold body content can then scroll nicely behind the transparent/semitransparent (like in #39156) or even use a partial appbar, like e.g. the floating search appbar in the Android GMail app. For a fully nice full screen look it should be possible to extend the same look and design at the bottom too behind the navigation button and nav area, as many android apps with newer designs do. Currently it is as far as I can tell impossible to do this in Flutter on Android. It seem impossible to make the Android navigation bar transparent and have correctly colored buttons in flutter and keeping the Flutter widgets that deal with the bottom area correctly. I have tried a solution that was based on how to modify the AndroidManifest, this got me close to the desired outcome. If I recall correctly I got a semitransparent navigation bar area, but not a fully transparent one, not on the Pixel 3XL emulator at least. Additionally Flutter's widgets got a bit confused with this approach concerning e.g. its own bottom navigation bar buttons, that then got drawn under the (semi)transparent system navigation bar and its opaque buttons, making it impossible to tap and use the Flutter bottom navigation bar buttons. I'm sure the Flutter bottom navbar could be modified or just build your own that you can move up a bit, but it becomes a bit complex to figure out on which devices it is needs to move where. It would be helpful and useful if there was a clear and easy approach for solving this built into the framework. There is now a nice solution for the top area, but as far as I can tell the navbar area still requires some improvements to make it fully baked. Finally, if there is some working solution I would be happy and eager to learn about it, because so far I have not found one. |
Hi @rydmike, thank you for the detail of your ask and issues surrounding creating a transparent/translucent navigation bar. This will certainly help with figuring out what needs to be done. I've been doing preliminary investigations into this through #40974 and unfortunately do not have a solution that achieves the desired effect (I also tried playing around with the AndroidManifest, as well as writing some Android-specific code for a Flutter project). I'm planning on exploring this further after I'm done with helping implement the Android 10 activity animation. Edit: I might create several new issues that properly covers the different permutations of needs surrounding hiding system UI. The problem here is that it gets really tricky - these are just some of the examples of cases that need to be considered:
All of these cases have to do also consider how laying out widgets like the FAB and the bottom navigation bar will be affected and how to handle this in Flutter based on devices, which has been eluded to in the prior comment. |
To handle the position of some widgets, I think maybe we should modify the |
Thanks @shihaohong for picking up this issue again. The edits you added also make a lot of sense to me, I was planning to add similar observations and comments, but you beat me to it. I'm sure there are more critical Flutter issues than this one, however with Android Q out, where this type of design is used almost predominantly, it has in my opinion bumped this issue up a few notches. I experiment frequently with Windows Desktop builds and to do so I stay a lot on master branch, so whenever some solution for this lands on master, it I'd be happy to try it out. |
@shihaohong To give everybody the technical perspective of the android side of things (API 21+): Capability:
v21+
v23+
v27+
Flutter's current behaviour:
|
any news? Gesture Navigation: Going edge-to-edge |
This work for me #40974 (comment) |
Can we have the transparent nav bar in 2021 ? |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
In Android Q, when using the new full gesture navigation, if an app has a transparent navigation bar, the gestural navigation area is floating over the app, and no black or white navigation bar is shown.
As stated by Dave Burke: https://twitter.com/davey_burke/status/1126878112170405888
Seems to be an easy addition but right now I didn't manage to make it work. I tried to set transparent navigation bar but it is not working properly as the navigation bar is still black or white (in Android Q). If the navigation bar is enabled, the Scaffold may also need to be extended a bit more so it is shown under de gestures area.
The text was updated successfully, but these errors were encountered: