简体   繁体   English

如何从 Flutter App 中的另一个选项卡更改按钮单击选项卡

[英]How to change tab on button click from another tab in Flutter App

After the form was filled, the tab did not change and it was expected to automatically switch back to the home page.填完表单后,tab没有变化,预计会自动切换回首页。

Did you use setState?你用过setState吗? Changing a variable does not cause a rebuild.更改变量不会导致重建。 SetState needs to be called in order to have your StatefulWidget's build method re-run, with the changed variables taken into account.需要调用 SetState 才能重新运行 StatefulWidget 的构建方法,并考虑更改的变量。

https://api.flutter.dev/flutter/widgets/State/setState.html https://api.flutter.dev/flutter/widgets/State/setState.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM