繁体   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