簡體   English   中英

flutter - 可左右滾動(類似卡片)小部件

[英]flutter - scrollable left and right (card like) widget

所以我有以下 SwiftUI 代碼,我現在想將它轉換為顫振。

ScrollView(.horizontal, showsIndicators: false) {
                                        HStack(alignment: .bottom, spacing: 10) {
                                            ForEach(self.lifeshows) { post in
                                                //return
                                                NavigationLink(destination: Podcasts(post: post)){
                                               
                                                 KFImage(URL(string: post.icon),  options: [.processor(ResizingImageProcessor(referenceSize: .init(width: geo.size.width / 4,height:geo.size.width / 4)))])
                                                    .resizable()
                                                    .renderingMode(.original)
                                                    .frame(width:geo.size.width / 4, height:geo.size.width / 4)
                                                }
                                            }
                                            
                                            

                                        }.frame(height: geo.size.width / 4)
                                    }.frame(height: geo.size.width / 4)

我知道這不是簡單的復制和過去,圖像(KFImage)在 Flutter 中會有所不同(因為我相信 Flutter 可以處理)

但是有人可以告訴我在 Flutter 中的視圖是什么樣子的,正如我所理解的 Lists 但是如何使列表可以左右滾動。

在顫振中,您可以使用

SingleChildScrollView(scrollDirection: Axis.horizontal, child: ...)

或者

ListView( scrollDirection: Axis.horizontal, children: <Widget>[...]);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM