【问题标题】:why i can not navigate to another screen the text button is working but i can't navigate为什么我无法导航到另一个屏幕文本按钮正在工作但我无法导航
【发布时间】:2022-11-03 16:35:34
【问题描述】:

为什么我无法导航到另一个屏幕文本按钮正在工作但我无法导航

TextButton(
                    onPressed: () {
                      Navigator.push(
                        context,
                        MaterialPageRoute(builder: (context) => Status()),
                      );
                    },
                    child: Text(
                      'STATUS',
                      style: TextStyle(
                        fontSize: 20,
                        color: Colors.white,
                      ),
                    ),
                  ),

【问题讨论】:

    标签: flutter flutter-layout


    【解决方案1】:

    你可以用这个代替那个

     Navigator.push(context, MaterialPageRoute(builder: (context) {
                return SecondScreen();
              },));
    

    SecondScreen() 是您要在您的情况下导航的文件名 Status() 确保导入文件

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-12-30
      • 1970-01-01
      • 2020-05-31
      • 2021-01-30
      • 2019-09-20
      • 2020-12-05
      • 1970-01-01
      相关资源
      最近更新 更多