harry248
07/08/2021, 7:45 AMCicero
07/08/2021, 7:48 AMharry248
07/08/2021, 8:17 AMif (showBottomNavigation) {
Scaffold(bottomBar = { ... }
} else { Scaffold() }
instead of
Scaffold(bottomBar={if(showBottomNavigation) { BottomNavigation() }}
?
That actually works but seems so wrong.Cicero
07/08/2021, 8:29 AM@Composable
fun AppScaffold(
topBar: @Composable () -> Unit = {},
bottomBar: @Composable () -> Unit = {},
content: @Composable (PaddingValues) -> Unit
) {
Scaffold(
topBar = {
topBar.invoke()
},
bottomBar = {
bottomBar.invoke()
},
) {
content.invoke(it)
}
}
harry248
07/08/2021, 8:43 AMZach Klippenstein (he/him) [MOD]
07/08/2021, 2:30 PMCicero
07/08/2021, 2:34 PM@Composable
fun ProcessTemplate(
onClickNext: (() -> Unit),
onClickBack: (() -> Unit),
step: Int,
title: String,
maximumSteps: Float = 9f,
enabled: Boolean,
bottomButtonHeaderId: Int? = null,
content: @Composable (PaddingValues) -> Unit
) {
AppTopAndBottomBar(
icon = painterResource(id = R.drawable.ic_back_arrow),
title = title,
onClickBack = onClickBack,
enabled = enabled,
onClick = onClickNext,
bottomButtonHeaderId = bottomButtonHeaderId
) {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier
.fillMaxWidth()
.background(AppColor.Smoke)
) {
Spacer(modifier = Modifier.padding(top = gu3))
ProgressBar(step = step, totalSteps = maximumSteps)
Spacer(modifier = Modifier.padding(top = gu2_5))
content.invoke(it)
}
}
}
Where ProgressBar has an animated progress bar and AppTopAndBottomBar is as the name describes an implementation of Scaffold that has some default implementation that relates to my general project usageCicero
07/08/2021, 2:37 PMZach Klippenstein (he/him) [MOD]
07/08/2021, 2:45 PMCicero
07/08/2021, 2:59 PMZach Klippenstein (he/him) [MOD]
07/08/2021, 3:10 PMZach Klippenstein (he/him) [MOD]
07/08/2021, 3:13 PMharry248
07/08/2021, 3:27 PM