Skip to content

ymkiux/compose-reference

Repository files navigation

official project Latest release

compose-reference

作为一个compose常用组件封装示例

简单使用

dropdownMenu

val selectListInfo by DataViewModel.uiState.collectAsState()
val selectIndex by remember { mutableStateOf(mutableListOf(0)) }
dropdownMenu(selectListInfo, selectIndex) { _, s ->
    selectIndex[0] = s
}
注释
DataViewModel类uiState为StateFlow状态流 使用之后后者数据集显示随之改变

radioButton

仅有一个
var oneSelectState by remember { mutableStateOf(false) }
radioButton(
    listOf<UiState>(
        UiState(
            "单数据测试",
            oneSelectState
        )
    ), oneSetSelectState = {
        oneSelectState = it
    })
多组选位
val moreSelectState by RadioInfoViewModel.uiState.collectAsState()
radioButton(
    moreSelectState
) { index, state ->
    //实现单选或者多选逻辑皆可自定义
    RadioInfo.update(index, state)
}

Notification

初始化
fun main() = application {
    initNotification(
        appName,
        painterResource(wxData[0].selectedPath)
    )
}
通知事件
NotificationKt.sendNotification("消息内容")

ToolTip

tooltip(ToolTipInfo("本地测试")) {
   Text("DEBUG", color = Color.White)
}

RecycleView

作为垂直滚动列表的可组合控件 详情使用看注释即可

About

As a compose common component encapsulation example

Topics

Resources

License

Stars

Watchers

Forks

Languages