소스 검색

improved widget

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana 2 년 전
부모
커밋
64d827e9dd
1개의 변경된 파일10개의 추가작업 그리고 10개의 파일을 삭제
  1. 10 10
      Widget/Nextcloud/NextcloudWidgetView.swift

+ 10 - 10
Widget/Nextcloud/NextcloudWidgetView.swift

@@ -35,7 +35,7 @@ struct NextcloudWidgetView: View {
                         .scaledToFit()
                         .frame(width: 20, height: 20)
                         .cornerRadius(5)
-                    Text(NCBrandOptions.shared.brand + "")
+                    Text(NCBrandOptions.shared.brand)
                         .font(.system(size: 12))
                         .textCase(.uppercase)
                 }
@@ -77,9 +77,9 @@ struct NextcloudWidgetView: View {
                         Image("buttonAddImage")
                             .resizable()
                             .renderingMode(.template)
-                            .foregroundColor(Color(NCBrandColor.shared.brandText))
+                            .foregroundColor(entry.isPlaceholder ? Color(white: 0.8) : Color(NCBrandColor.shared.brandText))
                             .padding(10)
-                            .background(Color(NCBrandColor.shared.brand))
+                            .background(entry.isPlaceholder ? Color(white: 0.8) : Color(NCBrandColor.shared.brand))
                             .clipShape(Circle())
                             .scaledToFit()
                             .frame(width: geo.size.width/4, height: 50)
@@ -89,9 +89,9 @@ struct NextcloudWidgetView: View {
                         Image("buttonAddScan")
                             .resizable()
                             .renderingMode(.template)
-                            .foregroundColor(Color(NCBrandColor.shared.brandText))
+                            .foregroundColor(entry.isPlaceholder ? Color(white: 0.8) : Color(NCBrandColor.shared.brandText))
                             .padding(10)
-                            .background(Color(NCBrandColor.shared.brand))
+                            .background(entry.isPlaceholder ? Color(white: 0.8) : Color(NCBrandColor.shared.brand))
                             .clipShape(Circle())
                             .scaledToFit()
                             .frame(width: geo.size.width/4, height: 50)
@@ -101,9 +101,9 @@ struct NextcloudWidgetView: View {
                         Image("note.text")
                             .resizable()
                             .renderingMode(.template)
-                            .foregroundColor(Color(NCBrandColor.shared.brandText))
+                            .foregroundColor(entry.isPlaceholder ? Color(white: 0.8) : Color(NCBrandColor.shared.brandText))
                             .padding(10)
-                            .background(Color(NCBrandColor.shared.brand))
+                            .background(entry.isPlaceholder ? Color(white: 0.8) : Color(NCBrandColor.shared.brand))
                             .clipShape(Circle())
                             .scaledToFit()
                             .frame(width: geo.size.width/4, height: 50)
@@ -113,9 +113,9 @@ struct NextcloudWidgetView: View {
                         Image("microphone")
                             .resizable()
                             .renderingMode(.template)
-                            .foregroundColor(Color(NCBrandColor.shared.brandText))
+                            .foregroundColor(entry.isPlaceholder ? Color(white: 0.8) : Color(NCBrandColor.shared.brandText))
                             .padding(10)
-                            .background(Color(NCBrandColor.shared.brand))
+                            .background(entry.isPlaceholder ? Color(white: 0.8) : Color(NCBrandColor.shared.brand))
                             .clipShape(Circle())
                             .scaledToFit()
                             .frame(width: geo.size.width/4, height: 50)
@@ -143,7 +143,7 @@ struct NextcloudWidgetView: View {
 
 struct NextcloudWidget_Previews: PreviewProvider {
     static var previews: some View {
-        let entry = NextcloudDataEntry(date: Date(), recentDatas: recentDatasTest, isPlaceholder: false, footerImage: "checkmark.icloud", footerText: NCBrandOptions.shared.brand + " widget")
+        let entry = NextcloudDataEntry(date: Date(), recentDatas: recentDatasTest, isPlaceholder: true, footerImage: "checkmark.icloud", footerText: NCBrandOptions.shared.brand + " widget")
         NextcloudWidgetView(entry: entry).previewContext(WidgetPreviewContext(family: .systemLarge))
     }
 }