Browse Source

improved widget

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana 2 years ago
parent
commit
b36ea11d71
1 changed files with 6 additions and 1 deletions
  1. 6 1
      Widget/Nextcloud/NextcloudWidgetView.swift

+ 6 - 1
Widget/Nextcloud/NextcloudWidgetView.swift

@@ -50,22 +50,27 @@ struct NextcloudWidgetView: View {
                         let recentDatasCount = CGFloat(entry.recentDatas.count)
                         let recentDatasCount = CGFloat(entry.recentDatas.count)
                         let heightFrame = (geo.size.height - 120) / recentDatasCount
                         let heightFrame = (geo.size.height - 120) / recentDatasCount
                         let addSizeIcon = heightFrame / recentDatasCount
                         let addSizeIcon = heightFrame / recentDatasCount
+                        let spacing = (addSizeIcon - recentDatasCount) / 2
                         
                         
                         ForEach(entry.recentDatas, id: \.id) { element in
                         ForEach(entry.recentDatas, id: \.id) { element in
                             
                             
                             Link(destination: element.url) {
                             Link(destination: element.url) {
                                 
                                 
                                 HStack {
                                 HStack {
+                                    
                                     Image(uiImage: element.image)
                                     Image(uiImage: element.image)
                                         .resizable()
                                         .resizable()
                                         .scaledToFill()
                                         .scaledToFill()
                                         .frame(width: imageSize+addSizeIcon, height: imageSize+addSizeIcon)
                                         .frame(width: imageSize+addSizeIcon, height: imageSize+addSizeIcon)
                                         .clipped()
                                         .clipped()
                                         .cornerRadius(4)
                                         .cornerRadius(4)
-                                    VStack(alignment: .leading) {
+                                    
+                                    VStack(alignment: .leading, spacing: spacing) {
+                                        
                                         Text(element.title)
                                         Text(element.title)
                                             .font(.system(size: 12))
                                             .font(.system(size: 12))
                                             .fontWeight(.regular)
                                             .fontWeight(.regular)
+                                        
                                         Text(element.subTitle)
                                         Text(element.subTitle)
                                             .font(.system(size: CGFloat(10)))
                                             .font(.system(size: CGFloat(10)))
                                             .foregroundColor(Color(white: 0.5))
                                             .foregroundColor(Color(white: 0.5))