SaltUI(UI for Salt Player) 是提取自椒盐音乐 UI 风格、适用于 Android Jetpack Compose 的组件,用以快速生成椒盐音乐风格用户界面。
本库将会广泛用以椒盐系列 App 开发,以达到快速开发目的。
详细介绍和文档请访问(正在改进):https://github.com/Moriafly/SaltUI/wiki 。
allprojects {
repositories {
// ...
maven { url 'https://jitpack.io' }
}
}最新版本⬇️⬇️⬇️
dependencies {
// ...
// 将 <VERSION> 替换为具体的版本号,如 0.1.0-dev04
// 即 implementation 'com.github.Moriafly:SaltUI:0.1.0-dev04'
// 推荐使用上方最新版本或稳定版本(若有)
implementation 'com.github.Moriafly:SaltUI:<VERSION>'
}组件位于 com.moriafly.salt.ui 包下,下面分为主题、页面、文本、按钮和点击。
演示项目(DEMO)在 app 模块。
由 SaltTheme 下 SaltColors、SaltTextStyles 和 SaltDimens 组成。
DynamicSaltTheme - Material You 配色
SaltTheme - 椒盐经典
| 颜色值 | 说明 |
|---|---|
| highlight | 软件强调色 |
| text | 主文本颜色 |
| subText | 次要文本颜色 |
| background | 用于整个 App 最底层颜色,默认背景色(底层背景色) |
| subBackground | 次要背景色(上层背景色) |
@Composable
fun AppTheme(
content: @Composable () -> Unit
) {
val colors = if (isSystemInDarkTheme()) {
darkSaltColors()
} else {
lightSaltColors()
}
SaltTheme(
colors = colors
) {
content()
}
}| 字体 | 说明 |
|---|---|
| main | 主文本样式 |
| sub | 次要文本样式 |
| paragraph | 段落文本样式 |
| 度量 | 说明 |
|---|---|
| corner | 一些元素的圆角 |
| 名称 | 用途 |
|---|---|
| TitleBar | 标题栏 |
| BottomBar | 底部栏 |
| BottomBarItem | 底部栏子项 |
| RoundedColumn | 以 subBackground 为底色构建圆角内容 Column |
以下的元素要使用在 RoundedColumn 中。
| 名称 | 用途 |
|---|---|
| ItemTitle | 构建内容界面标题 |
| ItemText | 构建内容界面说明文本 |
| Item | 默认列表项目(可设置图标、标题和副标题) |
| ItemSwitcher | 默认开关项目(可设置图标、标题和副标题) |
| ItemCheck | 选中项目 |
| ItemValue | 类似 Key - Value |
| ItemEdit | 默认文本框 |
| ItemSpacer | 默认内部的竖向间隔 |
| ItemContainer | 在内容界面构建拥有内部边距的容器,方便使用在内部添加如按钮等自定义元素 |
| 名称 | 用途 |
|---|---|
| ItemOuterTitle | 外部标题(如实现椒盐音乐中的猜你在找) |
| ItemOuterLargeTitle | 外部大标题附带说明(适用于如椒盐音乐实验室) |
| ItemOuter | 外部默认列表项目(仅文字,实现如页面链接访问等) |
| ItemOuterTextButton | 适用于 Item 的外部文本按钮 |
| 名称 | 用途 |
|---|---|
| .textDp | 文本单位使用 dp 值 |
| 名称 | 用途 |
|---|---|
| BasicButton | 基本按钮 |
| TextButton | 默认文本按钮 |
| 名称 | 用途 |
|---|---|
| Modifier.noRippleClickable | 没有涟漪扩散的点击效果 |
| Modifier.fadeClickable | 减淡点击效果(添加透明度效果) |
YesDialog 和 YesNoDialog 最新版本对各部分边距进行了调优,达到更好的视觉效果
| 名称 | 用途 |
|---|---|
| BottomSheetDialog | 默认底部对话框 |
| YesDialog | 确认对话框(类似默认通知) |
| YesNoDialog | 请求确认对话框 |
| InputDialog | 输入文本对话框 |
| 名称 | 用途 |
|---|---|
| PopupMenu | 弹出菜单 |
| PopupMenuItem | 弹出菜单选项 |
LGPL-2.1 License,详见 LICENSE 。
使用开源库:AOSP、Kotlin 等,如 Web 来自 Google Accompanist ,详细请见具体文件注释说明。
SaltUI
Copyright (C) 2023 Moriafly
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.