@momo-kits/native-kits 0.167.1-duo.20 → 0.167.1-duo.21
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.
|
@@ -349,20 +349,39 @@ struct Toolkit: View {
|
|
|
349
349
|
}
|
|
350
350
|
|
|
351
351
|
/// Mirrors Compose's `NavigationButton`: the 28pt circular shortcut / more button.
|
|
352
|
-
struct NavigationButton: View {
|
|
352
|
+
public struct NavigationButton: View {
|
|
353
353
|
var disabled: Bool
|
|
354
354
|
var icon: String
|
|
355
355
|
var showBadge: Bool
|
|
356
|
-
var headerColor: HeaderColor
|
|
356
|
+
var headerColor: HeaderColor?
|
|
357
357
|
var onClick: () -> Void
|
|
358
358
|
|
|
359
|
-
|
|
359
|
+
@Environment(\.headerColor) private var barColor
|
|
360
|
+
|
|
361
|
+
/// Colors follow the enclosing header, so it fits a custom header right next to the toolkit.
|
|
362
|
+
public init(icon: String, showBadge: Bool = false, disabled: Bool = false, onClick: @escaping () -> Void) {
|
|
363
|
+
self.init(disabled: disabled, icon: icon, showBadge: showBadge, headerColor: nil, onClick: onClick)
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
init(disabled: Bool, icon: String, showBadge: Bool, headerColor: HeaderColor?, onClick: @escaping () -> Void) {
|
|
367
|
+
self.disabled = disabled
|
|
368
|
+
self.icon = icon
|
|
369
|
+
self.showBadge = showBadge
|
|
370
|
+
self.headerColor = headerColor
|
|
371
|
+
self.onClick = onClick
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
private var colors: HeaderColor {
|
|
375
|
+
headerColor ?? barColor ?? getHeaderColor(isAnimated: false, isSurface: true, opacity: 1, tintColor: nil)
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
public var body: some View {
|
|
360
379
|
SwiftUI.Button(action: onClick) {
|
|
361
380
|
ZStack {
|
|
362
381
|
Circle()
|
|
363
|
-
.fill(
|
|
364
|
-
.overlay(Circle().stroke(
|
|
365
|
-
Icon(source: icon, size: 20, color:
|
|
382
|
+
.fill(colors.backgroundButton)
|
|
383
|
+
.overlay(Circle().stroke(colors.borderColor, lineWidth: 0.2))
|
|
384
|
+
Icon(source: icon, size: 20, color: colors.tintIconColor)
|
|
366
385
|
}
|
|
367
386
|
.frame(width: 28, height: 28)
|
|
368
387
|
.overlay(alignment: .topTrailing) {
|