|
|
@@ -87,6 +87,7 @@ export struct SettingPage {
|
|
|
})
|
|
|
.setTitleBarNormalPadding(0)
|
|
|
@State verName: string = ''
|
|
|
+ @StorageProp('themeColor') themeColor: string = PreferencesUtil.getStringSync('THEME_COLOR', '#FF4081');
|
|
|
|
|
|
apiDialogController: CustomDialogController = new CustomDialogController({
|
|
|
builder: CustomContentDialog({
|
|
|
@@ -214,9 +215,34 @@ export struct SettingPage {
|
|
|
Line().width('100%').height('100%')
|
|
|
}
|
|
|
.height(this.isPhoneLan()?0:px2vp(AppUtil.getStatusBarHeight()))
|
|
|
- .backgroundColor($r('app.color.title_bar_bg'))
|
|
|
+ .backgroundColor(this.themeColor)
|
|
|
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
|
|
|
- TitleBar({ model: $titleBarModel })
|
|
|
+ // 自定义标题栏
|
|
|
+ Stack() {
|
|
|
+ // 居中标题
|
|
|
+ Text('通用设置')
|
|
|
+ .fontSize(20)
|
|
|
+ .fontColor(Color.White)
|
|
|
+ .align(Alignment.Center)
|
|
|
+ // 左侧返回按钮
|
|
|
+ Row() {
|
|
|
+ Image($r('app.media.left_back_white'))
|
|
|
+ .width(32)
|
|
|
+ .height(32)
|
|
|
+ .margin({ left: 12, right: 8 })
|
|
|
+ .onClick(() => {
|
|
|
+ router.back();
|
|
|
+ })
|
|
|
+ Blank().flexGrow(1)
|
|
|
+ Blank().width(32)
|
|
|
+ }
|
|
|
+ .height(48)
|
|
|
+ .width('100%')
|
|
|
+ .alignItems(VerticalAlign.Center)
|
|
|
+ }
|
|
|
+ .height(48)
|
|
|
+ .width('100%')
|
|
|
+ .backgroundColor(this.themeColor)
|
|
|
Scroll() {
|
|
|
Column() {
|
|
|
// 主题设置分组
|
|
|
@@ -261,6 +287,34 @@ export struct SettingPage {
|
|
|
}
|
|
|
.height(55)
|
|
|
|
|
|
+ // 主题色选择
|
|
|
+ Row() {
|
|
|
+ Text('主题色')
|
|
|
+ .margin({ left: 18 })
|
|
|
+ .fontSize(15)
|
|
|
+ .fontColor(Color.Gray)
|
|
|
+ .fontWeight(480)
|
|
|
+ .layoutWeight(1)
|
|
|
+ Row() {
|
|
|
+ ForEach(SettingPage.THEME_COLOR_LIST, (color: string, index: number) => {
|
|
|
+ Blank()
|
|
|
+ .width(32)
|
|
|
+ .height(32)
|
|
|
+ .backgroundColor(color)
|
|
|
+ .borderRadius(16)
|
|
|
+ .border({ width: this.themeColor === color ? 3 : 1, color: this.themeColor === color ? Color.Black : Color.Gray })
|
|
|
+ .margin({ right: 8 })
|
|
|
+ .onClick(() => {
|
|
|
+ this.themeColor = color
|
|
|
+ PreferencesUtil.put(SettingPage.THEME_COLOR_KEY, color)
|
|
|
+ AppStorage.setOrCreate('themeColor', color)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ .margin({ right: 18 })
|
|
|
+ }
|
|
|
+ .height(55)
|
|
|
+
|
|
|
Line().width('100%').height(0.3).backgroundColor($r('app.color.index_tab_unselected_font_color'))
|
|
|
|
|
|
Row() {
|
|
|
@@ -826,4 +880,13 @@ export struct SettingPage {
|
|
|
.margin({ bottom: 30 })
|
|
|
}
|
|
|
|
|
|
+ public static THEME_COLOR_KEY: string = 'THEME_COLOR';
|
|
|
+ public static THEME_COLOR_LIST: Array<string> = [
|
|
|
+ '#FF4081', // 默认
|
|
|
+ '#0A59F7', // 蓝
|
|
|
+ '#64BB5C', // 绿
|
|
|
+ '#ED6F21', // 橙
|
|
|
+ '#5BA854' // 青
|
|
|
+ ];
|
|
|
+
|
|
|
}
|