0

你好,我在介绍屏幕底部有一个容器,上面写着“让我们开始吧”,是否可以通过检测点击将用户移动到登录页面,然后使用登录页面的类名将用户移动到登录页面?

            : GestureDetector(
      onTap: (){
        print("Container clicked");
      },

      child : Container(

        alignment: Alignment.center,
        width: MediaQuery.of(context).size.width,
        height: Platform.isIOS ? 70 : 60,
        //-----------------------------------
        //last screen get started box color

        color: Colors.blue,
        child: Text(
          "GET STARTED NOW",

          style: TextStyle(
            //last screen get started text
            color: Colors.white,
            fontWeight: FontWeight.w600,

          ),
        ),
      ),
    )
4

2 回答 2

2

只需使用登录类名称为您的点击添加这个

onTap: () => Navigator.of(context).push(new MaterialPageRoute(
                    builder: (BuildContext context) => new LoginPage())), //your login class name
于 2020-12-24T14:01:28.160 回答
2

您只需要传递您想要导航的类名,只需将此类名替换为LoginScreen()

             GestureDetector(
              onTap: () {
                print("Container clicked");
                Navigator.pushReplacement(
                    context, MaterialPageRoute(builder: (_) => LoginScreen()));
              },
              child: Container(
                alignment: Alignment.center,
                width: MediaQuery.of(context).size.width,
                color: Colors.blue,
                child: Text(
                  "GET STARTED NOW",
                  style: TextStyle(
                    color: Colors.white,
                    fontWeight: FontWeight.w600,
                  ),
                ),
              ),
            ),
于 2020-12-24T13:51:10.977 回答