命名参数 'onTap' 未在我的代码中定义

The named parameter 'onTap' isn't defined in my code

我目前正在学习 Flutter,我对它还很陌生。我想在点击此文本时转到另一个页面,但不好,它给了我这个错误。

  return Expanded(
    flex: 1,
    child: Row(
      mainAxisAlignment: MainAxisAlignment.spaceBetween,
      children: <Widget>[
        GestureDetector(
          oneTap: () { // i got error here
            Navigator.push(context, MaterialPageRoute(builder: (context) => SingUpPage()));
          },
          child: Text(
            'Sing up',
            style: GoogleFonts.openSans(
                fontSize: 18,
                fontWeight: FontWeight.w700,
                decoration: TextDecoration.underline),
          ),
        ),
        Text(
          'Forgot Password',
          style: GoogleFonts.openSans(
              fontSize: 18,
              fontWeight: FontWeight.w700,
              decoration: TextDecoration.underline),
        )
      ],
    ),
  );
}

你的意思是“onTap”而不是“oneTap”

 onTap: () { // <--- this one
            Navigator.push(context, MaterialPageRoute(builder: (context) => SingUpPage()));
          }

重命名 onTap 而不是 oneTap

onTap: () { // here change needed
            Navigator.push(context, MaterialPageRoute(builder: (context) => SingUpPage()));
          },

您正在 oneTap 上制作 typo/mistake,请将其更改为 onTap