【发布时间】:2020-12-16 14:50:38
【问题描述】:
我正在尝试获取使用来自网络的数据构建的PageView.Builder。当我尝试从另一个页面滑动到它时,我得到一个白色背景,它似乎充当占位符,直到来自 Future 的网络数据到达。我想要的是原始页面在页面构建之前保持在后台可见。但是,尽管我已经尝试了我能想到的一切,但在Future 到达填充PageView 之前,背景仍然是白色的。在到达之前,我如何才能获得清晰或至少降低不透明度的占位符?
我使用了 CircularProgressIndicator 作为占位符,但它不仅看起来很糟糕(滑动会将其从各个方向炸开),而且背景仍然顽固地不透明和白色。我还尝试了带有透明颜色的Container,但这只是覆盖了未来的白色背景。我怎样才能摆脱像Future 的占位符一样的不透明白色背景?
这就是未来;
FutureBuilder<List<ReplyContent>> replyStage({String replyid}) {
return FutureBuilder<List<ReplyContent>>(
future: downloadReplyJSON(replyid),
builder: (context, snapshot) {
if (snapshot.hasData) {
List<ReplyContent> replycrafts = snapshot.data;
return StageBuilderVR(replycrafts, Globals.masterTitle);
} else if (snapshot.hasError) {
return Text('${snapshot.error}');
}
return
Container(
color: Colors.transparent,
);
}
);
}
【问题讨论】:
标签: flutter dart future flutter-pageview