This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Responsive Chips Selection | |
// See Also: https://youtu.be/T82izB2XBMA?si=Cnf6rGdyisG8ZWoX | |
import SwiftUI | |
struct Tag: Hashable { | |
var name: String | |
var color: Color | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Declarative Navigation | |
* A simple declarative navigation system for Flutter. | |
* https://gist.github.com/PlugFox/aaa2a1ab4ab71b483b736530ebb03894 | |
* https://dartpad.dev?id=aaa2a1ab4ab71b483b736530ebb03894 | |
* Mike Matiunin <[email protected]>, 14 March 2025 | |
*/ | |
import 'dart:async'; | |
import 'dart:collection'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
extension Color { | |
static var random: Self { | |
Color( | |
hue: .random(in: 0..<1), | |
saturation: .random(in: (0.9)..<1), | |
brightness: .random(in: (0.9)..<1) | |
) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct CardView: View { | |
var item: ItemData | |
var animation: Namespace.ID | |
var body: some View { | |
HStack { | |
Circle() | |
.frame(width: 75) | |
.foregroundColor(item.color) | |
.overlay { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*: | |
# EnvironmentValuesはSubViewに伝搬するしカスタムなKeyも指定できる | |
- EnvironmentValuesは特定のKeyに対して値を設定できる | |
- 標準のKey | |
- https://developer.apple.com/documentation/swiftui/environmentvalues | |
- EnvironmentValuesが特定のViewの項目にそのまま紐付いている | |
- 例えば標準のKeyである\.fontはView上のTextのfontと結びついている | |
- Keyの値がView暗黙的にバインディングされている感じ |