accompanist
accompanist copied to clipboard
[Insets] Scaffold bottomBar cutout is not working
Hello! I've noticed that if I replace basic Scaffold with a new one from Insets library my cutout shape disappears.
Steps to reproduce Just replace default Scaffold with a new one.
Expected behavior Cutout shape should be applied.
Additional context
Hi Zeliret! For the basic Scaffold that does work (the one that isn't provided by Accompanist), is that a material
Scaffold or a material3
scaffold?
Hi. It is material.
Best regards, Artem
On Thu, Feb 3, 2022, 02:10 Alex Vanyo @.***> wrote:
Hi Zeliret! For the basic Scaffold that does work (the one that isn't provided by Accompanist), is that a material Scaffold or a material3 scaffold?
— Reply to this email directly, view it on GitHub https://github.com/google/accompanist/issues/958#issuecomment-1028509000, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHOFJR7YYSDXAC3U3RLIR3UZHIYZANCNFSM5MCZCZLA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you authored the thread.Message ID: @.***>
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
Still doesn't work. =(
Seeing this with 0.24.9-beta
@alexvanyo could you check if this could be fixed, please?
When debugging, it seems that LocalFabPlacement
yields null
in the BottomBar
, altough it gets correctly assigned.
I was able to track down what's happening here:
There ends up being two LocalFabPlacement
compositions locals.
One that is defined by androidx.compose.material
, here.
And the other that is defined by accompanist/insets-ui
.
Unfortunately, both of them are internal
, which means that they can't be read by components outside of the respective libraries. In particular, the androidx.compose.material.BottomAppBar
is reading its androidx.compose.material.LocalFabPlacement
, but only the com.google.accompanist.insets.ui.LocalFabPlacement
is being set by the accompanist Scaffold
.
The fix for this on the accompanist side would look like duplicating all of BottomBar
and its dependencies, so that the right LocalFabPlacement
is used. That solution is also what the workaround would be right now for you: fork Scaffold
and BottomBar
yourself, and ensure your own LocalFabPlacement
is being used.
Alternatively the only reason why Scaffold
needed to be used was for passing the height of the top app bar to the content padding. If you aren't making use of that, or you can switch to material3
, then you won't need to use the accompanist version of Scaffold
.
I saw that compose supports insets and migrated to it. And now I can use the original scaffold without any problem.
As @Zeliret pointed out, compose foundation supports insets since 1.2.0-alpha03.
This yields visually the same result as with accompanist Scaffold with working FAB cut-out:
import androidx.compose.material.Scaffold
import androidx.compose.foundation.layout.statusBarsPadding
Scaffold(
modifier = Modifier.statusBarsPadding(),
// ...
) { scaffoldContentPadding ->
// ...
}
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
A change was just made to material3
that will include inset support for Scaffold
, the BottomNavBar
and Fab
, so I'm going to close this issue as not planned.
A version of acccompanist/insets-ui
for material3
should be unnecessary, as the relevant changes needed have been upstreamed.