From 9f0065767b13415119b89d9fcea95d4d02850c65 Mon Sep 17 00:00:00 2001 From: linweijian Date: Sun, 20 Oct 2024 16:09:30 +0800 Subject: [PATCH] Delete terminalAPP/.../ets/pages/color_setting.ets --- terminalAPP/.../ets/pages/color_setting.ets | 136 -------------------- 1 file changed, 136 deletions(-) delete mode 100644 terminalAPP/.../ets/pages/color_setting.ets diff --git a/terminalAPP/.../ets/pages/color_setting.ets b/terminalAPP/.../ets/pages/color_setting.ets deleted file mode 100644 index a661421..0000000 --- a/terminalAPP/.../ets/pages/color_setting.ets +++ /dev/null @@ -1,136 +0,0 @@ -import promptAction from '@ohos.promptAction'; -import router from '@ohos.router'; -import { AppUtils } from '../common/AppUtils' - -@Entry -@Component - -struct Index { - - - fontColor: string[] = ['黑','白','黄','绿','红','橙','蓝','灰',] - @State select: number = 0 - @State fontsize: number = 0; - - @State themeColor: Color = AppUtils.getInstance().getThemeColor(); - @State fontWeight: number = AppUtils.getInstance().getFontWeight(); - - onPageShow() { - // 页面显示时,获取 AppUtils 中的当前字体大小 - this.fontsize = AppUtils.getInstance().getFontSize(); - this.themeColor = AppUtils.getInstance().getThemeColor(); - this.fontWeight = AppUtils.getInstance().getFontWeight(); - } - - - getColor(index:number):Color{ - switch (index){ - case 0: - return Color.Black; - case 1: - return Color.White; - case 2: - return Color.Yellow; - case 3: - return Color.Green; - case 4: - return Color.Red; - case 5: - return Color.Orange; - case 6: - return Color.Blue; - case 7: - return Color.Grey; - - default: - return Color.Black; - } - } - - changeFontColor(index: number): void { - const newColor = this.getColor(index); - AppUtils.getInstance().setFontColor(newColor); // 更新 AppUtils 中的字体颜色 - promptAction.showToast({ - message: '您已经成功选择', - duration: 2000, - bottom: 50 - }); - } - - - build() { - Column() { - Row() { - Image($r('app.media.two')) - .width(this.fontsize) - .margin({left:'2%'}) - .onClick(() => { - router.back() - promptAction.showToast({ - message: '已成功返回', - duration: 2000, - bottom: 50 - }); - }) - Text('字体颜色') - .fontWeight(this.fontWeight) - .fontSize(this.fontsize) - .fontColor(AppUtils.getInstance().getFontColor()) - .onClick(() => { - router.back() - promptAction.showToast({ - message: '已成功返回', - duration: 2000, - bottom: 50 - }); - }) - }.width('100%') - .height('90') - // .justifyContent(FlexAlign.Start) - .margin({top: 20,left:40}) - - - - Row() { - Text(this.fontColor[this.select]) - .fontWeight(FontWeight.Bold) - .fontSize(this.fontsize) - .fontColor(AppUtils.getInstance().getFontColor()) - - Button('选择样式') - .fontWeight(this.fontWeight) - .fontSize(this.fontsize) - - .backgroundColor(Color.Orange) - .fontColor(Color.White) - .margin(20) - .onClick(()=>{ - TextPickerDialog.show({ - range:this.fontColor, - selected: this.select, - onAccept: ( value :TextPickerResult)=> { - this.select = value.index; - this.changeFontColor(this.select); - - promptAction.showToast({ - message:'您已经成功选择', - duration:2000, - bottom:50 - }) - }, - onCancel:( )=>{ - console.info('取消选择') - }, - onChange :() => { - console.info('') - } - }) - }) - }.width('100%') - .height('30%') - .justifyContent(FlexAlign.Center) - }.width('100%') - .height('100%') - .backgroundColor(this.themeColor); - } -} \ No newline at end of file