Flutter app displayed in a FlutterFragment is not displaying within the application's SafeArea

67 views
Skip to first unread message

Wes Ehrlichman

unread,
Jul 29, 2020, 7:20:11 PM7/29/20
to Flutter Development (flutter-dev)
In our team's app we are using the Add-to-app feature to display a FlutterFragment as one of the tabs within an Activity that has a BottomNavigationView that allows you to switch tabs.

We can't figure out how to get the AppBar at the top of the page to include the area of the device's status bar in a clean way. The SafeArea doesn't seem to include the space that is reserved for the Status Bar. Is there any way to fix this?

I've been experimenting with the renderer's ViewportMetrics, but that doesn't seem to change anything. Is there a way to modify the SafeArea programmatically from the Android side?


Note: This is a rephrasing of https://groups.google.com/forum/#!topic/flutter-dev/yTYLd8z-Zdg to attempt to make it more clear what the nature of the problem is

Souvik Dutta

unread,
Jul 29, 2020, 9:40:57 PM7/29/20
to Wes Ehrlichman, Flutter Development (flutter-dev)
Expected. Using mediaquery doesn't return the padding of the whole screen rather it returns the padding of the area flutter is drawing on. How about using a native media query? That is calling a media query or related from native code side. This might help https://stackoverflow.com/questions/3407256/height-of-status-bar-in-android

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/9b5c6e17-4c6d-4994-b540-534d22ab95d9o%40googlegroups.com.

Souvik Dutta

unread,
Jul 29, 2020, 9:44:06 PM7/29/20
to Wes Ehrlichman, Flutter Development (flutter-dev)
By the way do you have a scaffold in your app? Probably a scaffold should have done this already. 

Wes Ehrlichman

unread,
Jul 29, 2020, 10:20:54 PM7/29/20
to Souvik Dutta, Flutter Development (flutter-dev)
Yes, we do. The scaffold doesn’t recognize the SafeArea, so the AppBar shows up behind the status bar. The only solution we can think of is passing the status bar height through a method channel from the Android App to the Flutter app and then doing messy things with the AppBar to have it display correctly.

-Wes
Reply all
Reply to author
Forward
Message has been deleted
0 new messages