官方组件Demo Apk可在此处下载 https://www.123865.com/s/hLmDVv-uVi8H
- 标题栏:TitleBar
- 大标题:ItemOuterLargeTitle
- 圆角列:RoundedColumn
- 复选框:ItemCheck
- 按钮:ItemButton
- 文字按钮:TextButton
- 标题:ItemTitle
- 标准项:Item
- 开关:ItemSwitcher
- 提示:ItemTip
- 信息:ItemInfo
- 值:ItemValue
- 输入框:ItemEdit
- 密码框:ItemEditPassword
- 弹出菜单:ItemPopup
- 对话框:YesNoDialog, YesDialog, InputDialog
- 滑块:ItemSlider
- 底部栏:BottomBar
TitleBar(
onBack = { /* 返回按钮回调 */ },
text = "标题"
false//是否显示返回
)
ItemOuterLargeTitle(
text = "Hello, SaltUI 2.0",
sub = "SaltUI(UI for Salt Player) 是提取自椒盐音乐的 UI 风格组件,用以快速生成椒盐音乐风格用户界面。本库将会广泛用以椒盐系列 App 开发,以达到快速开发目的"
)
RoundedColumn {
// 内部放置其他组件
}
ItemCheck(
state = true, //开关启用状态
onChange = {
},
text = "选中按钮"
)
ItemButton(
onClick = {
},
text = "默认按钮 TextButton 默认按钮 TextButton 默认按钮 TextButton",
primary = false//强调色开关
)
TextButton(
onClick = {
}
},
text = "确定",
)
ItemTitle(text = "标题")
Item(
onClick = {},
iconPainter = painterResource(R.drawable.ic_qr_code),
iconColor = SaltTheme.colors.highlight,
text = "标准 Item 控件,带图标(可选),副标题文本(可选)",
sub = "Item 控件的副标题"
)
var switch by remember { mutableStateOf(false) }
ItemSwitcher(
state = switch,
onChange = {
switch = it
},
iconPainter = painterResource(R.drawable.ic_verified),
iconColor = SaltTheme.colors.highlight,
text = "标准开关控件,带图标(可选),副标题文本(可选)",
sub = "开关控件的副标题"
)
}
ItemTip(text = "提示信息")
ItemInfo(
text = "警告信息",
infoType = ItemInfoType.Warning
)
ItemValue(text = "Value 标题", sub = "Value 内容")
var text by remember { mutableStateOf("") }
ItemEdit(
text = text,
onChange = {
text = it
},
hint = "HINT 这是输入框"
)
var text2 by remember { mutableStateOf("") }
ItemEditPassword(
text = text2,
onChange = {
text2 = it
},
hint = "HINT 这是密码输入框"
)
val popupState = rememberPopupState()
ItemPopup(
state = popupState,
text = "Popup Item",
sub = "Value"
) {
PopupMenuItem(
onClick = {
popupState.dismiss()
},
selected = true,
text = "选项一",
sub = "这是选项一的介绍信息"
)//多个重复添加即可
}
//YesNoDialog
var yesNoDialog by remember { mutableStateOf(false) }
if (yesNoDialog) {
YesNoDialog(
onDismissRequest = { yesNoDialog = false },
onConfirm = { yesNoDialog = false },
title = "YesNoDialog",
content = "这是一个是否确认的对话框"
)
}
Item(
onClick = {
yesNoDialog = true
},
text = "YesNoDialog",
arrowType = ItemArrowType.Link
)
//YesDialog
var yesDialog by remember { mutableStateOf(false) }
if (yesDialog) {
YesDialog(
onDismissRequest = { yesDialog = false },
title = "YesDialog",
content = "这是一个是否确认的对话框"
)
}
Item(
onClick = {
yesDialog = true
},
text = "YesDialog"
)
//InputDialog
var inputDialog by remember { mutableStateOf(false) }
if (inputDialog) {
var inputText by remember { mutableStateOf("") }
InputDialog(
onDismissRequest = {
inputDialog = false
},
onConfirm = {
inputDialog = false
},
title = "文本输入",
text = inputText,
onChange = {
inputText = it
}
)
}
var slider by remember { mutableStateOf(0f) }
ItemSlider(
value = slider,
onValueChange = {
slider = it
},
iconPainter = painterResource(R.drawable.ic_qr_code),
iconColor = SaltTheme.colors.text,
text = "Slider 滑块",
// sub = "滑块介绍"
steps = 2
)
BottomBar {
BottomBarItem(
state = true,
onClick = {},
painter = painterResource(R.drawable.ic_qr_code),
text = "二维码"
)
BottomBarItem(
state = false,
onClick = {},
painter = painterResource(R.drawable.ic_verified),
text = "认证"
)//多个自行添加
}