【发布时间】:2020-07-21 08:11:41
【问题描述】:
我正在尝试找出如何在 PageView 页面之间淡入淡出。
这是我的页面视图:
PageView(
controller: controller,
children: [
Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/image4.jpg"),
fit: BoxFit.cover),
),
child: Center(
child: Text(
'myText',
style: TextStyle(color: Colors.white, fontSize: 40.0),
)),
),
Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/image2.jpg"),
fit: BoxFit.cover),
),
child: Center(
child: Text(
'myText',
style: TextStyle(color: Colors.white, fontSize: 40.0),
)),
),
Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/image3.jpg"),
fit: BoxFit.cover),
),
child: Center(
child: Text(
'myText',
style: TextStyle(color: Colors.white, fontSize: 40.0),
)),
),
],
),
是否可以实现淡入淡出过渡?我搜索了堆栈溢出,但我唯一能找到的是这个包: https://pub.dev/packages/transformer_page_view#-readme-tab-
问题是它没有控制器,所以我的 smoothPageIndactor 无法工作。 (https://pub.dev/packages/smooth_page_indicator)
谢谢!
【问题讨论】:
-
您尝试过 AnimatedOpacity 小部件吗?
-
我阅读了有关它的信息,但它可以在这个用例中实现吗?因为我似乎找不到与 PageView 结合使用的特定示例/信息