flutter - 每次我回到这里时如何刷新页面?
问题描述
我使用添加按钮添加列表视图。当我单击按钮时,它会将我推到另一个屏幕。我可以添加另一个列表。但是当我返回那里时,此页面不会自动刷新。每次我从任何地方来时,我都需要刷新这个页面
这是添加按钮
FloatingActionButton(
backgroundColor: Colors.black,
onPressed: () {
Route route = MaterialPageRoute(builder: (context) => addPlan());
Navigator.of(context)
.push(new MaterialPageRoute<String>(maintainState: true))
.then((String value) {
print(value);
});
},
child: Icon(Icons.add),
),
这是我添加新列表时的按钮
RaisedButton(
color: Colors.black,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10)),
onPressed: () {
clickadd();
},
child: Text(
'Add Plan',
style: TextStyle(color: Colors.white),
),
)
解决方案
推荐阅读
- python - 将一个数字四舍五入到一个数字范围 Python
- python - Django Rest Framework (DRF) 中的 Python/DJango 'django.db.utils.OperationalError: no such table'
- javascript - 前端和后端验证协同
- docker - 使用多个 compose 文件时使用 docker-compose 拉取最新的 docker 镜像
- python - 查找字符串中缺少左括号的术语
- r - 在没有 R 的情况下生成 bupaR 流程图可视化
- python - 如何在 ModelForm 上使用额外的 ModelChoiceField?
- java - Java 8+ 中 CompletableFuture 的异步执行/操作
- kotlin - 撰写导航标题未更新
- javascript - 替换方法添加$1而不是匹配的子字符串和粗体文本