我在(停靠点)行中有路线,如果它们到达屏幕边缘,我想继续在下一行显示它们。你能帮我吗?

@Composable
fun StopView(
stop: Stop
) {
Column {
Text(text = stop.name)
Row{
stop.routes.forEach { route ->
Row (modifier = Modifier.padding(10.dp).align(Alignment.CenterVertically)) {
Image(painterResource(id = **imageName**),route.type.toString(), modifier = Modifier
.height(25.dp)
.width(25.dp))
Spacer(modifier = Modifier.width(5.dp))
Text(text = route.name)
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud) 我在 ScrollView 中有 HStack,并且在 HStack 中有圆圈和文本。我怎样才能在圆圈之间画一条线?(这是巴士路线)
ForEach(stations, id: \.id) { station in
HStack{
Spacer().frame(width: 20)
Circle()
.stroke(Color.black,lineWidth: 4)
.frame(width: 10, height: 10)
Spacer().frame(width: 20)
Text(station.name)
Spacer()
if station.id > 0 {
Text(String(station.id))
}
let time = getNextDepartureTime(id: station.id)
Text("\(time.hour):\(time.minute)")
Spacer().frame(width: 20)
}
}
Run Code Online (Sandbox Code Playgroud) 我想每 5 秒调用一次 ViewModel 的函数。在 Jetpack Compose 中执行此操作的最佳方法是什么?
我在 iOS 14 上使用 SwiftlySearch,在 iOS 15 上使用 .searchable。
struct CompatibleSearchBarModifier: ViewModifier {
@Binding var text: String
@ViewBuilder
func body(content: Content) -> some View {
if #available(iOS 15.0, *) {
content.searchable(text: self.$text, prompt: "Placeholder")
} else {
content.navigationBarSearch(self.$text, placeholder: "Placeholder", hidesSearchBarWhenScrolling: true, cancelClicked: {text = ""})
}
}
}
Run Code Online (Sandbox Code Playgroud)
该应用程序在基于 Crashlytics 的 iOS 14.7.1-14.8 设备上崩溃。不幸的是,我无法在 Xcode 13.2.1 上重现该问题,因为我无法在模拟器上使用这些 iOS 版本(我尝试了这个库但没有成功: https: //github.com/JinjunHan/iOSDeviceSupport)。有什么想法在这种情况下我可以做什么吗?
Crashed: com.apple.main-thread
0 libswiftCore.dylib 0x313dbc swift::ResolveAsSymbolicReference::operator()(swift::Demangle::__runtime::SymbolicReferenceKind, swift::Demangle::__runtime::Directness, int, void const*)
1 libswiftCore.dylib 0x33170c swift::Demangle::__runtime::Demangler::demangleSymbolicReference(unsigned char)
2 libswiftCore.dylib …Run Code Online (Sandbox Code Playgroud)