交换小部件以使小部件已固定
我有一个带有Carouselslider的创建非常简单的滑动视图Pager:
return Scaffold(
body: CarouselSlider(
options: CarouselOptions(
viewportFraction: 1,
// aspectRatio: 1,
height: double.maxFinite,
// enlargeCenterPage: true,
),
items: List.generate(
10,
(i) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Container(
color: (i % 2 == 0) ? Colors.red : Colors.green,
),
),
Text('text $i', style: TextStyle(fontSize: 16.0)),
],
)),
));
这是其结果:
但是您可以看到下一个容器连接到第一个小部件,我希望当第一个窗口部门在左边交换时, ,下一个小部件出现在第一个小部件下面,而不是旁边的第一个小部件。看起来以下小部件已固定,我们删除了顶部的小部件。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用称为 pageview 在使用中。
示例snippet:
注意:您可以使用属性
scroldirection
内部pageview.builder()
内部控制滚动轴。具有axis.vertical
或axis.horizontal
的值。You can use a package called stacked_page_view, it is very simple, lightweight, and similar to the same original
PageView
in usage.Example Snippet:
Note: You can control the scroll axis with the property
scrollDirection
insidePageView.builder()
with values ofAxis.vertical
orAxis.horizontal
.我终于找到了一种创建堆栈页面视图的方法,这是一个完整的代码:
}
是结果:
及其参考;
I finally find a way to create stack page view, This is a full codes:
}
it's result :
and its reference;
您可以使用一个称为 pageView 相同的参数。
You can use a package called expandable_page_view, it is a
PageView
widget adjusting its height to currently displayed page. It accepts the same parameters as classicPageView
.