【问题标题】:Change the container screen from button in the same screen in flutter在颤动中从同一屏幕中的按钮更改容器屏幕
【发布时间】:2020-11-27 16:35:26
【问题描述】:

我正在制作一个带有自定义底栏的应用程序。我制作了一个屏幕,堆栈中有两个容器,一个容器是换屏器,第二个容器是底部菜单栏。我正在从bottomMenuBar 容器轻松更改屏幕,但在其中一个子屏幕内我想通过按钮更改整个屏幕。请帮忙!

enter image description here

【问题讨论】:

  • 您可以使用布尔变量并有条件地显示 2 个屏幕,例如: showFirstScreen ?第一屏:第二屏。点击按钮,切换 showFirstScreen 的值。

标签: flutter


【解决方案1】:

使用这个语句:

FlatButton(
  child: Text('Third Screen'),
  onPressed: () {
    Navigator.of(context).push(MaterialPageRoute(builder: (_) => ThirdScreen()));
  },
),

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-03-30
    • 2020-09-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-27
    • 2016-06-09
    • 2022-07-03
    相关资源
    最近更新 更多