首页 > 解决方案 > 每次我回到这里时如何刷新页面?

问题描述

我使用添加按钮添加列表视图。当我单击按钮时,它会将我推到另一个屏幕。我可以添加另一个列表。但是当我返回那里时,此页面不会自动刷新。每次我从任何地方来时,我都需要刷新这个页面

这是添加按钮

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),
            ),
          )

标签: flutterdart

解决方案


推荐阅读