addProductInformation
This commit is contained in:
@@ -29,101 +29,21 @@ class _PaymentWebViewState extends State<PaymentWebView> {
|
||||
webViewController = controller;
|
||||
},
|
||||
onLoadStop: (controller, url) async {
|
||||
print("Payment page loaded: $url");
|
||||
|
||||
// ✅ Check if payment is successful
|
||||
if (url.toString().contains("success")) {
|
||||
|
||||
if (url.toString().contains("success"))
|
||||
{
|
||||
context.push(MyRoutes.SUCCESSPAYMENT);
|
||||
|
||||
print("kjdsfkjghdfhgkjdfhgkjdf");
|
||||
// Navigator.pop(context, true);
|
||||
|
||||
} else if (url.toString().contains("failure")) {
|
||||
context.push(MyRoutes.PAYMENTFAILD);
|
||||
|
||||
print("faild");
|
||||
// Navigator.pop(context, false);
|
||||
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
|
||||
// class PaymentWebView extends StatefulWidget {
|
||||
// final String paymentUrl;
|
||||
|
||||
// PaymentWebView({required this.paymentUrl});
|
||||
|
||||
// @override
|
||||
// _PaymentWebViewState createState() => _PaymentWebViewState();
|
||||
// }
|
||||
|
||||
// class _PaymentWebViewState extends State<PaymentWebView> {
|
||||
// InAppWebViewController? webViewController;
|
||||
// bool isErrorPage = false; // Track error state
|
||||
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return Scaffold(
|
||||
// appBar: AppBar(title: Text("Complete Your Payment")),
|
||||
// body: Stack(
|
||||
// children: [
|
||||
// Visibility(
|
||||
// visible: !isErrorPage, // Show WebView only if there's no error
|
||||
// child: InAppWebView(
|
||||
// initialUrlRequest:
|
||||
// URLRequest(url: WebUri.uri(Uri.parse(widget.paymentUrl))),
|
||||
// onWebViewCreated: (controller) {
|
||||
// webViewController = controller;
|
||||
// },
|
||||
// onLoadStop: (controller, url) async {
|
||||
// print("Payment page loaded: $url");
|
||||
|
||||
// // ✅ Check if payment is successful
|
||||
// if (url.toString().contains("success")) {
|
||||
// Navigator.pop(context, true); // Send success result
|
||||
// } else if (url.toString().contains("failure")) {
|
||||
// Navigator.pop(context, false); // Send failure result
|
||||
// }
|
||||
// },
|
||||
// onReceivedHttpError: (controller, request, response) {
|
||||
// if (response.statusCode == 404) {
|
||||
// setState(() {
|
||||
// isErrorPage = true;
|
||||
// });
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// if (isErrorPage) _buildErrorPage(context), // Show custom error page
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
|
||||
// Widget _buildErrorPage(BuildContext context) {
|
||||
// return Center(
|
||||
// child: Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// children: [
|
||||
// Icon(Icons.error_outline, color: Colors.red, size: 80),
|
||||
// SizedBox(height: 10),
|
||||
// Text("Payment Failed",
|
||||
// style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold)),
|
||||
// SizedBox(height: 10),
|
||||
// Text("Something went wrong. Please try again.",
|
||||
// textAlign: TextAlign.center),
|
||||
// SizedBox(height: 20),
|
||||
// ElevatedButton(
|
||||
// onPressed: () {
|
||||
// Navigator.pop(context); // Navigate back to previous screen
|
||||
// },
|
||||
// child: Text("Go Back"),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user