Scaffold是Compose的脚手架,基本实现了基本材料设计的可视化布局结构,包括顶部应用程序栏和底部栏、抽屉和浮动操作按钮等。
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.material.*
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.unit.Dp
@OptIn(ExperimentalMaterialApi::class)
@Composable
fun ComposeScaffold(
modifier: Modifier = Modifier,
scaffoldState: ScaffoldState = rememberScaffoldState(),
topBar: @Composable (() -> Unit) = {},
bottomBar: @Composable (() -> Unit) = {},
snackbarHost: @Composable (SnackbarHostState) -> Unit = { SnackbarHost(it) },
floatingActionButton: @Composable (() -> Unit) = {},
floatingActionButtonPosition: FabPosition = FabPosition.End,
isFl