Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 付款成功后,我想导航到另一个页面_Flutter_Flutter Layout_Flutter Dependencies_Flutter Animation_Flutter Test - Fatal编程技术网

Flutter 付款成功后,我想导航到另一个页面

Flutter 付款成功后,我想导航到另一个页面,flutter,flutter-layout,flutter-dependencies,flutter-animation,flutter-test,Flutter,Flutter Layout,Flutter Dependencies,Flutter Animation,Flutter Test,我正在开发一个应用程序。付款成功后,我想导航到另一个页面 以下是我的应用程序付款方式的代码 void handlerPaymentSuccess() { Navigator.push(context, MaterialPageRoute(builder: (context) => Itemsbuy())); 我将其编码以浏览该页面,但在付款成功后,不会显示该页面, 但付款完成后,它只显示从razorpay成功付款,而不显示我浏览的页面。付款成功后,它将重定向到第二条路线,而不是重

我正在开发一个应用程序。付款成功后,我想导航到另一个页面

以下是我的应用程序付款方式的代码

void handlerPaymentSuccess() {    Navigator.push(context,  MaterialPageRoute(builder: (context) => Itemsbuy()));
我将其编码以浏览该页面,但在付款成功后,不会显示该页面,
但付款完成后,它只显示从razorpay成功付款,而不显示我浏览的页面。付款成功后,它将重定向到第二条路线,而不是重定向到Itemsbuy()

谢谢

使用该软件包进行导航,而不是使用Navigator.of(上下文)

例如:

void handlerPaymentSuccess() {
     Get.to(Itemsbuy());
}
还要确保使用GetMaterialApp而不是像这样使用MaterialApp

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      home: SplashScreen(),
      color: violet,
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.deepPurple,
      ).copyWith(textTheme: GoogleFonts.montserratTextTheme()),
    );
  }
}
它应该可以工作。

使用该软件包进行导航,而不是使用Navigator。of(上下文)

例如:

void handlerPaymentSuccess() {
     Get.to(Itemsbuy());
}
还要确保使用GetMaterialApp而不是像这样使用MaterialApp

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      home: SplashScreen(),
      color: violet,
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.deepPurple,
      ).copyWith(textTheme: GoogleFonts.montserratTextTheme()),
    );
  }
}

它应该可以工作。

class\u支付扩展状态{ bool paymentDone=false

@override
Widget build(BuildContext context) {
if (paymentDone == true) {
    return NewPage();
}
else{
    return CurrentPage(); 
}
}
void _handlePaymentSuccess(PaymentSuccessResponse response) async {
Fluttertoast.showToast(msg: "SUCCESS: " + response.paymentId, timeInSecForIosWeb: 4);
setState(() {
    paymentDone = true;
);}
}

}class\u支付扩展状态{ bool paymentDone=false

@override
Widget build(BuildContext context) {
if (paymentDone == true) {
    return NewPage();
}
else{
    return CurrentPage(); 
}
}
void _handlePaymentSuccess(PaymentSuccessResponse response) async {
Fluttertoast.showToast(msg: "SUCCESS: " + response.paymentId, timeInSecForIosWeb: 4);
setState(() {
    paymentDone = true;
);}
}

}

您应该开始更好地格式化代码。如果你继续这样下去,以后再看会很糟糕……你真的应该开始更好地格式化你的代码了。如果你继续这样下去,以后再看会很可怕……不,它不起作用。当我点击其他页面时,它显示黑色屏幕不工作,请您以其他方式帮助我付款完成后,它仅显示从razorpay成功付款,但它未显示我导航的mt页面,付款成功后,它将重定向到第二条路线不工作。d当我点击其他页面时,它显示黑色屏幕不工作,您能以其他方式帮助我吗?付款完成后,它仅显示razorpay的付款成功,但它未显示我导航的mt页面,付款成功后,它将重定向到第二条路线。请清楚地编写代码,我没有在哪里类付款来自我有状态小部件作为付款你可以写任何东西所以在状态小部件中我必须给出布尔值对吗???是的………你可以写清楚代码我没有写在类付款来自哪里我有状态小部件作为付款你可以写任何东西所以在状态小部件中我必须给出布尔值我是对的吗???是的。。。。。。。。。。。。