소스 검색

主题色设置

chendeben 1 년 전
부모
커밋
22ce85f5ec
1개의 변경된 파일22개의 추가작업 그리고 22개의 파일을 삭제
  1. 22 22
      entry/src/main/ets/view/TitleBar.ets

+ 22 - 22
entry/src/main/ets/view/TitleBar.ets

@@ -21,7 +21,7 @@ export struct TitleBar {
           space: type == TitleBar.BothSidesLayoutType.LEFT ? this.model.leftTitleSpace : this.model.rightTitleSpace
         }) {
           if ((type == TitleBar.BothSidesLayoutType.LEFT && this.model.leftIcon)
-          || (type == TitleBar.BothSidesLayoutType.RIGHT && this.model.rightIcon)) {
+            || (type == TitleBar.BothSidesLayoutType.RIGHT && this.model.rightIcon)) {
             Image(type == TitleBar.BothSidesLayoutType.LEFT ? this.model.leftIcon : this.model.rightIcon)
               .objectFit(ImageFit.Auto)
               .opacity(type == TitleBar.BothSidesLayoutType.LEFT ?this.model.opacityLeft:1)
@@ -47,7 +47,7 @@ export struct TitleBar {
             .fontWeight(type == TitleBar.BothSidesLayoutType.LEFT ? this.model.leftTitleFontWeight : this.model.rightTitleFontWeight)
             .fontColor(type == TitleBar.BothSidesLayoutType.LEFT ? this.model.leftTitleFontColor : this.model.rightTitleFontColor)
           if ((type == TitleBar.BothSidesLayoutType.LEFT && this.model.leftIcon)
-          || (type == TitleBar.BothSidesLayoutType.RIGHT && this.model.rightIcon)) {
+            || (type == TitleBar.BothSidesLayoutType.RIGHT && this.model.rightIcon)) {
             Image(type == TitleBar.BothSidesLayoutType.LEFT ? this.model.leftIcon : this.model.rightIcon)
               .objectFit(ImageFit.Auto)
               .opacity(type == TitleBar.BothSidesLayoutType.LEFT ?this.model.opacityLeft:1)
@@ -63,7 +63,7 @@ export struct TitleBar {
           space: type == TitleBar.BothSidesLayoutType.LEFT ? this.model.leftTitleSpace : this.model.rightTitleSpace
         }) {
           if ((type == TitleBar.BothSidesLayoutType.LEFT && this.model.leftIcon)
-          || (type == TitleBar.BothSidesLayoutType.RIGHT && this.model.rightIcon)) {
+            || (type == TitleBar.BothSidesLayoutType.RIGHT && this.model.rightIcon)) {
             Image(type == TitleBar.BothSidesLayoutType.LEFT ? this.model.leftIcon : this.model.rightIcon)
               .objectFit(ImageFit.Auto)
               .opacity(type == TitleBar.BothSidesLayoutType.LEFT ?this.model.opacityLeft:1)
@@ -89,7 +89,7 @@ export struct TitleBar {
             .fontWeight(type == TitleBar.BothSidesLayoutType.LEFT ? this.model.leftTitleFontWeight : this.model.rightTitleFontWeight)
             .fontColor(type == TitleBar.BothSidesLayoutType.LEFT ? this.model.leftTitleFontColor : this.model.rightTitleFontColor)
           if ((type == TitleBar.BothSidesLayoutType.LEFT && this.model.leftIcon)
-          || (type == TitleBar.BothSidesLayoutType.RIGHT && this.model.rightIcon)) {
+            || (type == TitleBar.BothSidesLayoutType.RIGHT && this.model.rightIcon)) {
             Image(type == TitleBar.BothSidesLayoutType.LEFT ? this.model.leftIcon : this.model.rightIcon)
               .objectFit(ImageFit.Auto)
               .opacity(type == TitleBar.BothSidesLayoutType.LEFT ?this.model.opacityLeft:1)
@@ -120,7 +120,7 @@ export struct TitleBar {
     })
     .onClick(() => {
 
-        type == TitleBar.BothSidesLayoutType.LEFT ? this.model.onLeftClickListener() : this.model.onRightClickListener();
+      type == TitleBar.BothSidesLayoutType.LEFT ? this.model.onLeftClickListener() : this.model.onRightClickListener();
 
     })
   }
@@ -170,7 +170,7 @@ export struct TitleBar {
       else {
         Text(this.model.titleName)
           .maxLines(1)
-          // .opacity(this.model.opacityLeft)
+            // .opacity(this.model.opacityLeft)
           .fontSize(this.model.titleFontSize)
           .fontColor(this.model.titleFontColor)
           .fontWeight(this.model.titleFontWeight)
@@ -291,9 +291,9 @@ export struct TitleBar {
 export namespace TitleBar {
 
 
-/**
- * 标题栏样式
- */
+  /**
+   * 标题栏样式
+   */
   export enum BarStyle {
     // 日间主题样式
     LIGHT = 1,
@@ -509,7 +509,7 @@ export namespace TitleBar {
 
     setTitleBarBackground(value: ResourceColor): Model {
       this.titleBarBackground = value;
-      console.log('Heanup: TitleBar背景色:'+(value.toString()))
+      console.log('Heanup: TitleBar背景色:'+JSON.stringify(value))
       return this;
     }
 
@@ -835,18 +835,18 @@ export namespace TitleBar {
      */
     private barStyleTransform(value: BarStyle) {
 
-        // this.setTitleBarBackground($r('app.color.title_bar_bg'));
-        // this.setTitleFontColor($r('app.color.title_text'));
-        // this.setTitleBarBottomLineColor($r('app.color.title_bar_bottom_line'));
-        //
-        // this.setLeftTitleStateNormalStyleColor($r('app.color.title_bar_bg'));
-        // this.setLeftTitleStatePressedStyleColor($r('app.color.title_bar_pressed'));
-        // this.setLeftIcon($r('app.media.left_back_black'));
-        // this.setLeftTitleFontColor($r('app.color.title_left_text'));
-        //
-        // this.setRightTitleStateNormalStyleColor($r('app.color.title_bar_bg'));
-        // this.setRightTitleStatePressedStyleColor($r('app.color.title_bar_pressed'));
-        // this.setRightTitleFontColor($r('app.color.title_right_text'));
+      this.setTitleBarBackground($r('app.color.title_bar_bg'));
+      this.setTitleFontColor($r('app.color.title_text'));
+      this.setTitleBarBottomLineColor($r('app.color.title_bar_bottom_line'));
+
+      this.setLeftTitleStateNormalStyleColor($r('app.color.title_bar_bg'));
+      this.setLeftTitleStatePressedStyleColor($r('app.color.title_bar_pressed'));
+      this.setLeftIcon($r('app.media.left_back_black'));
+      this.setLeftTitleFontColor($r('app.color.title_left_text'));
+
+      this.setRightTitleStateNormalStyleColor($r('app.color.title_bar_bg'));
+      this.setRightTitleStatePressedStyleColor($r('app.color.title_bar_pressed'));
+      this.setRightTitleFontColor($r('app.color.title_right_text'));
 
     }
   }