Compose中MD相關(guān)總結(jié)

BottomSheetScaffold
fun BottomSheetScaffold(
    sheetContent: @Composable ColumnScope.() -> Unit,
    modifier: Modifier = Modifier,
    scaffoldState: BottomSheetScaffoldState = rememberBottomSheetScaffoldState(),
    topBar: (@Composable () -> Unit)? = null,
    snackbarHost: @Composable (SnackbarHostState) -> Unit = { SnackbarHost(it) },
    floatingActionButton: (@Composable () -> Unit)? = null,
    floatingActionButtonPosition: FabPosition = FabPosition.End,
    sheetGesturesEnabled: Boolean = true,
    sheetShape: Shape = MaterialTheme.shapes.large,
    sheetElevation: Dp = BottomSheetScaffoldDefaults.SheetElevation,
    sheetBackgroundColor: Color = MaterialTheme.colors.surface,
    sheetContentColor: Color = contentColorFor(sheetBackgroundColor),
    sheetPeekHeight: Dp = BottomSheetScaffoldDefaults.SheetPeekHeight,
    drawerContent: @Composable (ColumnScope.() -> Unit)? = null,
    drawerGesturesEnabled: Boolean = true,
    drawerShape: Shape = MaterialTheme.shapes.large,
    drawerElevation: Dp = DrawerDefaults.Elevation,
    drawerBackgroundColor: Color = MaterialTheme.colors.surface,
    drawerContentColor: Color = contentColorFor(drawerBackgroundColor),
    drawerScrimColor: Color = DrawerDefaults.scrimColor,
    backgroundColor: Color = MaterialTheme.colors.background,
    contentColor: Color = contentColorFor(backgroundColor),
    content: @Composable (PaddingValues) -> Unit
)
  • sheetContent 底部抽屜的內(nèi)容
  • drawerState可以去控制左邊抽屜的狀態(tài)
  • bottomSheetState 可以去控制底部抽屜的狀態(tài)
  • snackbarHostState 可以控制Snackbar的狀態(tài)
  • topBar 頂部控件
  • floatingActionButton 浮動(dòng)的button
  • floatingActionButtonPosition 設(shè)置floatingActionButton的按鈕的位置胜卤。是在底部居中還是再右下角士鸥,有一半會(huì)蓋在sheetContent上面
  • sheetGesturesEnabled 是否能通過(guò)手指滑動(dòng)去打開(kāi)和關(guān)閉底部的抽屜
  • sheetShape 底部抽屜的形狀
  • sheetElevation 底部抽屜的陰影
  • sheetBackgroundColor 底部抽屜的背景顏色
  • sheetContentColor 底部抽屜的內(nèi)容顏色
  • sheetPeekHeight 是底部抽屜的初始的高度
  • drawerContent 左邊抽屜的內(nèi)容
  • drawerGesturesEnabled 是否能通過(guò)手指拖動(dòng)的形式去打開(kāi)和關(guān)閉左邊的抽屜
  • drawerShape 左邊抽屜的形狀
  • drawerElevation 左邊抽屜的陰影
  • drawerBackgroundColor 左邊抽屜的背景顏色
  • drawerContentColor 左邊抽屜的內(nèi)容的顏色
  • drawerScrimColor 左邊抽屜打開(kāi)的時(shí)候呻征,右邊剩余部分的顏色值
  • backgroundColor BottomSheetScaffold控件的背景顏色
  • contentColor BottomSheetScaffold控件的內(nèi)容的顏色
  • content BottomSheetScaffold控件包含的內(nèi)容
ModalBottomSheetLayout
fun ModalBottomSheetLayout(
    sheetContent: @Composable ColumnScope.() -> Unit,
    modifier: Modifier = Modifier,
    sheetState: ModalBottomSheetState =
        rememberModalBottomSheetState(Hidden),
    sheetShape: Shape = MaterialTheme.shapes.large,
    sheetElevation: Dp = ModalBottomSheetDefaults.Elevation,
    sheetBackgroundColor: Color = MaterialTheme.colors.surface,
    sheetContentColor: Color = contentColorFor(sheetBackgroundColor),
    scrimColor: Color = ModalBottomSheetDefaults.scrimColor,
    content: @Composable () -> Unit
)
  • sheetContent 底部抽屜的內(nèi)容
  • modifier 修飾符
  • sheetState 設(shè)置狀態(tài)。顯示和隱藏底部抽屜
  • 默認(rèn)實(shí)現(xiàn)是rememberModalBottomSheetState(ModalBottomSheetValue.Hidden)叼丑。
  • ModalBottomSheetValue.Hidden是隱藏
  • ModalBottomSheetValue.Expanded打開(kāi)
  • ModalBottomSheetValue.HalfExpanded 打開(kāi)一半
  • sheetShape 設(shè)置底部抽屜形狀
  • sheetElevation 設(shè)置底部抽屜的陰影
  • sheetBackgroundColor 設(shè)置底部抽屜的背景顏色
  • sheetContentColor 設(shè)置底部抽屜內(nèi)容的顏色
  • scrimColor 設(shè)置底部抽屜打開(kāi)的時(shí)候关翎,頂部剩余部分的顏色
  • content ModalBottomSheetLayout的內(nèi)容
BackdropScaffold
fun BackdropScaffold(
    appBar: @Composable () -> Unit,
    backLayerContent: @Composable () -> Unit,
    frontLayerContent: @Composable () -> Unit,
    modifier: Modifier = Modifier,
    scaffoldState: BackdropScaffoldState = rememberBackdropScaffoldState(Concealed),
    gesturesEnabled: Boolean = true,
    peekHeight: Dp = BackdropScaffoldDefaults.PeekHeight,
    headerHeight: Dp = BackdropScaffoldDefaults.HeaderHeight,
    persistentAppBar: Boolean = true,
    stickyFrontLayer: Boolean = true,
    backLayerBackgroundColor: Color = MaterialTheme.colors.primary,
    backLayerContentColor: Color = contentColorFor(backLayerBackgroundColor),
    frontLayerShape: Shape = BackdropScaffoldDefaults.frontLayerShape,
    frontLayerElevation: Dp = BackdropScaffoldDefaults.FrontLayerElevation,
    frontLayerBackgroundColor: Color = MaterialTheme.colors.surface,
    frontLayerContentColor: Color = contentColorFor(frontLayerBackgroundColor),
    frontLayerScrimColor: Color = BackdropScaffoldDefaults.frontLayerScrimColor,
    snackbarHost: @Composable (SnackbarHostState) -> Unit = { SnackbarHost(it) }
)
appBar 頂部的控件,
backLayerContent 顯示在后面被遮擋的內(nèi)容
frontLayerContent 顯示在前面的內(nèi)容
modifier 修飾符
scaffoldState 狀態(tài)鸠信∽萸蓿可以設(shè)置snackbar的狀態(tài)。還可以設(shè)置BackdropScaffoldState的狀態(tài)症副。有BackdropValue.Concealed. 表示隱藏了后一層店雅,而激活了前一層
跟BackdropValue.Revealed 表示后一層顯示政基,前一層隱藏
gesturesEnabled 可否可用通過(guò)手指拖動(dòng)的形式顯示和隱藏前后界面
peekHeight 前面的界面舉例頂部的距離贞铣,也可以理解成后面的界面默認(rèn)露出顯示的高度闹啦。默認(rèn)是56dp
headerHeight
persistentAppBar 當(dāng)為true的時(shí)候,不管顯示還是隱藏后面的界面辕坝,appBar都一直顯示的窍奋。如果值為false,則顯示后面的界面的時(shí)候酱畅,appBar會(huì)隱藏
stickyFrontLayer 當(dāng)為true的時(shí)候琳袄,前面的界面之后下拉到后面界面的內(nèi)容高度位置。為false 的時(shí)候纺酸,前面的界面可以一直下拉到屏幕底部(試試效果就知道)
backLayerBackgroundColor 后面界面的背景顏色
backLayerContentColor 后面界面的內(nèi)容的顏色
frontLayerShape 前面界面的形狀
frontLayerElevation 前面界面的陰影
frontLayerBackgroundColor 前面界面的背景顏色
frontLayerContentColor 前面界面的內(nèi)容的顏色
frontLayerScrimColor 前面界面下拉時(shí)窖逗,頂部預(yù)留出來(lái)的空白的顏色
snackbarHost 設(shè)置Snackbar的
TopAppBar
fun TopAppBar(
    modifier: Modifier = Modifier,
    backgroundColor: Color = MaterialTheme.colors.primarySurface,
    contentColor: Color = contentColorFor(backgroundColor),
    elevation: Dp = AppBarDefaults.TopAppBarElevation,
    contentPadding: PaddingValues = AppBarDefaults.ContentPadding,
    content: @Composable RowScope.() -> Unit
)

backgroundColor 背景顏色

contentColor 內(nèi)容的顏色

elevation 陰影

contentPadding 內(nèi)容邊距

可通過(guò)PaddingValue設(shè)置,也可使用默認(rèn)AppBarDefaults.ContentPadding
content 內(nèi)容控件

BottomAppBar
fun BottomAppBar(
    modifier: Modifier = Modifier,
    backgroundColor: Color = MaterialTheme.colors.primarySurface,
    contentColor: Color = contentColorFor(backgroundColor),
    cutoutShape: Shape? = null,
    elevation: Dp = AppBarDefaults.BottomAppBarElevation,
    contentPadding: PaddingValues = AppBarDefaults.ContentPadding,
    content: @Composable RowScope.() -> Unit
) 

backgroundColor 背景顏色

contentColor 內(nèi)容的顏色

cutoutShape 形狀

elevation 陰影

contentPadding 內(nèi)容邊距

可通過(guò)PaddingValue設(shè)置餐蔬,也可使用默認(rèn)AppBarDefaults.ContentPadding
content 內(nèi)容控件

Snackbar
fun Snackbar(
    modifier: Modifier = Modifier,
    action: @Composable (() -> Unit)? = null,
    actionOnNewLine: Boolean = false,
    shape: Shape = MaterialTheme.shapes.small,
    backgroundColor: Color = SnackbarDefaults.backgroundColor,
    contentColor: Color = MaterialTheme.colors.surface,
    elevation: Dp = 6.dp,
    content: @Composable () -> Unit
)

modifier 修飾符

action 行為的內(nèi)容是什么控件

actionOnNewLine 表示action內(nèi)容是否在新的一行碎紊,為true為另為一行,否則會(huì)和content的內(nèi)容疊在一起

shape形狀 默認(rèn)是MaterialTheme.shapes.small 也就是RoundedCornerShape(4.dp)

backgroundColor 設(shè)置背景顏色

contentColor 設(shè)置內(nèi)容的顏色

elevation設(shè)置陰影

content 內(nèi)容是什么控件

ModalDrawer
fun ModalDrawer(
    drawerContent: @Composable ColumnScope.() -> Unit,
    modifier: Modifier = Modifier,
    drawerState: DrawerState = rememberDrawerState(DrawerValue.Closed),
    gesturesEnabled: Boolean = true,
    drawerShape: Shape = MaterialTheme.shapes.large,
    drawerElevation: Dp = DrawerDefaults.Elevation,
    drawerBackgroundColor: Color = MaterialTheme.colors.surface,
    drawerContentColor: Color = contentColorFor(drawerBackgroundColor),
    scrimColor: Color = DrawerDefaults.scrimColor,
    content: @Composable () -> Unit
)

drawerContent 左邊的內(nèi)容

modifier 修飾符 Modifier用法詳解

drawerState ModalDrawer的狀態(tài) 有DrawerValue.open打開(kāi)樊诺,DrawerValue.Closed關(guān)閉

gesturesEnabled 是否支持手勢(shì)去打開(kāi)和關(guān)閉抽屜

drawerShape 形狀

drawerElevation 陰影

drawerBackgroundColor 背景顏色

drawerContentColor 內(nèi)容的顏色

scrimColor 當(dāng)左邊drawer控件顯示的時(shí)候仗考,右邊余留出來(lái)的顏色

BottomDrawercontent ModalDrawer的內(nèi)容

BottomDrawer
fun BottomDrawer(
    drawerContent: @Composable ColumnScope.() -> Unit,
    modifier: Modifier = Modifier,
    drawerState: BottomDrawerState = rememberBottomDrawerState(BottomDrawerValue.Closed),
    gesturesEnabled: Boolean = true,
    drawerShape: Shape = MaterialTheme.shapes.large,
    drawerElevation: Dp = DrawerDefaults.Elevation,
    drawerBackgroundColor: Color = MaterialTheme.colors.surface,
    drawerContentColor: Color = contentColorFor(drawerBackgroundColor),
    scrimColor: Color = DrawerDefaults.scrimColor,
    content: @Composable () -> Unit
) 

drawerContent 底部抽屜的內(nèi)容

modifier 修飾符

drawerState 抽屜的狀態(tài),BottomDrawerValue.Open 打開(kāi)一半

BottomDrawerValue.Closed 關(guān)閉词爬,BottomDrawerValue.Expanded 是完全打開(kāi)

gesturesEnabled 是否支持手勢(shì)去打開(kāi)和關(guān)閉抽屜

drawerShape 抽屜形狀

drawerElevation 抽屜陰影

drawerBackgroundColor 抽屜背景顏色

drawerContentColor 抽屜內(nèi)容顏色

scrimColor 抽屜打開(kāi)時(shí)候秃嗜,頂部剩余空間的顏色

content BottomDrawer的內(nèi)容

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市顿膨,隨后出現(xiàn)的幾起案子锅锨,更是在濱河造成了極大的恐慌,老刑警劉巖恋沃,帶你破解...
    沈念sama閱讀 221,548評(píng)論 6 515
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件橡类,死亡現(xiàn)場(chǎng)離奇詭異,居然都是意外死亡芽唇,警方通過(guò)查閱死者的電腦和手機(jī)顾画,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 94,497評(píng)論 3 399
  • 文/潘曉璐 我一進(jìn)店門(mén),熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)匆笤,“玉大人研侣,你說(shuō)我怎么就攤上這事∨谂酰” “怎么了庶诡?”我有些...
    開(kāi)封第一講書(shū)人閱讀 167,990評(píng)論 0 360
  • 文/不壞的土叔 我叫張陵,是天一觀的道長(zhǎng)咆课。 經(jīng)常有香客問(wèn)我末誓,道長(zhǎng)扯俱,這世上最難降的妖魔是什么? 我笑而不...
    開(kāi)封第一講書(shū)人閱讀 59,618評(píng)論 1 296
  • 正文 為了忘掉前任喇澡,我火速辦了婚禮迅栅,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘晴玖。我一直安慰自己读存,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 68,618評(píng)論 6 397
  • 文/花漫 我一把揭開(kāi)白布呕屎。 她就那樣靜靜地躺著让簿,像睡著了一般。 火紅的嫁衣襯著肌膚如雪秀睛。 梳的紋絲不亂的頭發(fā)上尔当,一...
    開(kāi)封第一講書(shū)人閱讀 52,246評(píng)論 1 308
  • 那天,我揣著相機(jī)與錄音蹂安,去河邊找鬼椭迎。 笑死,一個(gè)胖子當(dāng)著我的面吹牛藤抡,可吹牛的內(nèi)容都是我干的侠碧。 我是一名探鬼主播,決...
    沈念sama閱讀 40,819評(píng)論 3 421
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼缠黍,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼弄兜!你這毒婦竟也來(lái)了?” 一聲冷哼從身側(cè)響起瓷式,我...
    開(kāi)封第一講書(shū)人閱讀 39,725評(píng)論 0 276
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤替饿,失蹤者是張志新(化名)和其女友劉穎,沒(méi)想到半個(gè)月后贸典,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體视卢,經(jīng)...
    沈念sama閱讀 46,268評(píng)論 1 320
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 38,356評(píng)論 3 340
  • 正文 我和宋清朗相戀三年廊驼,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了据过。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 40,488評(píng)論 1 352
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡妒挎,死狀恐怖绳锅,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情酝掩,我是刑警寧澤鳞芙,帶...
    沈念sama閱讀 36,181評(píng)論 5 350
  • 正文 年R本政府宣布,位于F島的核電站,受9級(jí)特大地震影響原朝,放射性物質(zhì)發(fā)生泄漏驯嘱。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,862評(píng)論 3 333
  • 文/蒙蒙 一喳坠、第九天 我趴在偏房一處隱蔽的房頂上張望鞠评。 院中可真熱鬧,春花似錦丙笋、人聲如沸谢澈。這莊子的主人今日做“春日...
    開(kāi)封第一講書(shū)人閱讀 32,331評(píng)論 0 24
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)。三九已至牛郑,卻和暖如春怠肋,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背淹朋。 一陣腳步聲響...
    開(kāi)封第一講書(shū)人閱讀 33,445評(píng)論 1 272
  • 我被黑心中介騙來(lái)泰國(guó)打工笙各, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人础芍。 一個(gè)月前我還...
    沈念sama閱讀 48,897評(píng)論 3 376
  • 正文 我出身青樓杈抢,卻偏偏與公主長(zhǎng)得像,于是被迫代替她去往敵國(guó)和親仑性。 傳聞我的和親對(duì)象是個(gè)殘疾皇子惶楼,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,500評(píng)論 2 359

推薦閱讀更多精彩內(nèi)容