OnPay operations

This commit is contained in:
2024-05-21 22:36:42 +03:00
parent 986a9d9bd5
commit 9ac9813244
4 changed files with 42 additions and 15 deletions

View File

@@ -3,7 +3,12 @@ import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:gymlink_module_web/components/app_bar.dart';
import 'package:gymlink_module_web/components/heading.dart';
import 'package:gymlink_module_web/components/order_confirm_item_card.dart';
import 'package:gymlink_module_web/pages/order_history.dart';
import 'package:gymlink_module_web/providers/cart.dart';
import 'package:gymlink_module_web/tools/prefs.dart';
import 'package:gymlink_module_web/tools/routes.dart';
import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';
List<Map<String, dynamic>> cart = [
{
@@ -71,6 +76,13 @@ class _OrderConfirmationPageState extends State<OrderConfirmationPage> {
});
}
Future<void> _goToPage() async {
final Uri url = Uri.parse('https://google.com');
if (!await launchUrl(url, webOnlyWindowName: '_blank')) {
throw 'Could not launch $url';
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
@@ -140,17 +152,15 @@ class _OrderConfirmationPageState extends State<OrderConfirmationPage> {
),
),
ElevatedButton(
onPressed: () {
debugPrint('debugprint');
// if (kIsWeb) {
// Navigator.of(context).push(
// MaterialPageRoute(
// builder: (context) => const OrderPayPage(),
// ),
// );
// } else {
// debugPrint('test');
// }
onPressed: () async {
_goToPage();
await clearCart();
Provider.of<CartProvider>(context, listen: false)
.updateCartLength();
Navigator.of(context).pushAndRemoveUntil(
CustomPageRoute(
builder: (context) => const HistoryPage()),
(route) => route.isFirst);
},
style: ElevatedButton.styleFrom(
backgroundColor: Theme.of(context).primaryColor,