https://kotlinlang.org logo
#compose
Title
# compose
a

amar_1995

01/13/2020, 7:24 AM
VerticalScroller
is not working properly with
ModalDrawerLayout
When
drawerContent
data wrap around verticalScroller whole view moves to center. I had tried to incoperate the samething in
jetnews
app. Updated the
AppDrawer
function
Copy code
@Composable
private fun AppDrawer(
    currentScreen: Screen,
    closeDrawer: () -> Unit
) {
    VerticalScroller() {
        Column(modifier = Expanded) {
            HeightSpacer(24.dp)
            Row(modifier = Spacing(16.dp)) {
                VectorImage(
                    id = R.drawable.ic_jetnews_logo,
                    tint = (+MaterialTheme.colors()).primary
                )
                WidthSpacer(8.dp)
                VectorImage(id = R.drawable.ic_jetnews_wordmark)
            }
            Divider(color = Color(0x14333333))
            DrawerButton(
                icon = R.drawable.ic_home,
                label = "Home",
                isSelected = currentScreen == Screen.Home
            ) {
                navigateTo(Screen.Home)
                closeDrawer()
            }

            DrawerButton(
                icon = R.drawable.ic_interests,
                label = "Interests",
                isSelected = currentScreen == Screen.Interests
            ) {
                navigateTo(Screen.Interests)
                closeDrawer()
            }
        }
    }
}
After adding the vertical scroller
I noticed this issue is occuring only when using in
drawerContent
of
ModalDrawerLayout
.
m

matvei

01/13/2020, 11:54 AM
Oh, I think it's because the Container is centering by default, and Drawer uses it for it's child. Can you file a bug please for this?
a

amar_1995

01/13/2020, 12:36 PM
Okay
m

matvei

01/13/2020, 12:37 PM
(As a workaround, you can add LayoutExpandedHeight modifier to scroller, this should help)
a

amar_1995

01/13/2020, 12:45 PM
m

matvei

01/13/2020, 12:46 PM
Thanks
r

Roar Gronmo

01/13/2020, 1:15 PM
I starred your issuetracker issue
❤️ 1
4 Views