nn-widgets 0.1.5 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/plugin/build/withIosWidget.js +17 -17
package/package.json
CHANGED
|
@@ -927,24 +927,24 @@ struct ${w.name}Provider: TimelineProvider {
|
|
|
927
927
|
|
|
928
928
|
struct ${w.name}FlexCell: View {
|
|
929
929
|
let item: WidgetListItem
|
|
930
|
+
let cellRatio: Double
|
|
930
931
|
let defaultTitleColor: Color
|
|
931
932
|
let defaultDescColor: Color
|
|
932
933
|
let defaultAccentColor: Color
|
|
933
934
|
|
|
934
|
-
//
|
|
935
|
-
// -
|
|
936
|
-
// -
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
item.rightIcon != nil || item.description != nil
|
|
935
|
+
// Display mode based on cell ratio:
|
|
936
|
+
// - ratio == 1.0: list row style (icon left, text right)
|
|
937
|
+
// - ratio < 1.0: card style (icon top, text bottom)
|
|
938
|
+
private var isFullWidth: Bool {
|
|
939
|
+
cellRatio >= 1.0
|
|
940
940
|
}
|
|
941
941
|
|
|
942
942
|
private var isIconOnly: Bool {
|
|
943
|
-
item.title.text.isEmpty
|
|
943
|
+
item.title.text.isEmpty
|
|
944
944
|
}
|
|
945
945
|
|
|
946
946
|
var body: some View {
|
|
947
|
-
if
|
|
947
|
+
if isFullWidth {
|
|
948
948
|
// List row style: [icon] [title + desc] [rightIcon]
|
|
949
949
|
HStack(spacing: 8) {
|
|
950
950
|
if let icon = item.icon {
|
|
@@ -992,21 +992,18 @@ struct ${w.name}FlexCell: View {
|
|
|
992
992
|
WidgetIconView(config: icon, accentColor: defaultAccentColor)
|
|
993
993
|
}
|
|
994
994
|
} else {
|
|
995
|
-
// Card style: icon on top, title below
|
|
995
|
+
// Card style: icon on top, small title below
|
|
996
996
|
VStack(spacing: 4) {
|
|
997
997
|
if let icon = item.icon {
|
|
998
998
|
WidgetIconView(config: icon, accentColor: defaultAccentColor)
|
|
999
999
|
}
|
|
1000
1000
|
|
|
1001
1001
|
Text(item.title.text)
|
|
1002
|
-
.font(
|
|
1003
|
-
.fontWeight(
|
|
1004
|
-
.foregroundColor(
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
: defaultTitleColor
|
|
1008
|
-
)
|
|
1009
|
-
.lineLimit(1)
|
|
1002
|
+
.font(.caption2)
|
|
1003
|
+
.fontWeight(.medium)
|
|
1004
|
+
.foregroundColor(defaultTitleColor)
|
|
1005
|
+
.lineLimit(2)
|
|
1006
|
+
.multilineTextAlignment(.center)
|
|
1010
1007
|
.truncationMode(.tail)
|
|
1011
1008
|
}
|
|
1012
1009
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
@@ -1179,6 +1176,7 @@ struct ${w.name}FlexRow: View {
|
|
|
1179
1176
|
@ViewBuilder
|
|
1180
1177
|
private func cellView(colIndex: Int, width: CGFloat) -> some View {
|
|
1181
1178
|
let index = getItemIndex(rowIndex: rowIndex, colIndex: colIndex)
|
|
1179
|
+
let cellRatio = rowRatios[colIndex]
|
|
1182
1180
|
let verticalAlignment: Alignment = {
|
|
1183
1181
|
switch alignItems {
|
|
1184
1182
|
case .flexStart: return .top
|
|
@@ -1193,6 +1191,7 @@ struct ${w.name}FlexRow: View {
|
|
|
1193
1191
|
Link(destination: url) {
|
|
1194
1192
|
${w.name}FlexCell(
|
|
1195
1193
|
item: item,
|
|
1194
|
+
cellRatio: cellRatio,
|
|
1196
1195
|
defaultTitleColor: titleColor,
|
|
1197
1196
|
defaultDescColor: subtitleColor,
|
|
1198
1197
|
defaultAccentColor: accentColor
|
|
@@ -1202,6 +1201,7 @@ struct ${w.name}FlexRow: View {
|
|
|
1202
1201
|
} else {
|
|
1203
1202
|
${w.name}FlexCell(
|
|
1204
1203
|
item: item,
|
|
1204
|
+
cellRatio: cellRatio,
|
|
1205
1205
|
defaultTitleColor: titleColor,
|
|
1206
1206
|
defaultDescColor: subtitleColor,
|
|
1207
1207
|
defaultAccentColor: accentColor
|