OnPay operations
This commit is contained in:
@@ -18,7 +18,7 @@ class MyExampleApp extends StatelessWidget {
|
|||||||
title: 'GymLink Example App',
|
title: 'GymLink Example App',
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
home: const ExampleMainPage(),
|
home: const ExampleMainPage(),
|
||||||
theme: ThemeData.dark(useMaterial3: true),
|
theme: ThemeData.light(useMaterial3: true),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -75,7 +75,7 @@ class _ExamplePageState extends State<ExamplePage> {
|
|||||||
() => context.read<GymLinkProvider>().onTokenReceived('token123'));
|
() => context.read<GymLinkProvider>().onTokenReceived('token123'));
|
||||||
Future.microtask(() => context
|
Future.microtask(() => context
|
||||||
.read<GymLinkProvider>()
|
.read<GymLinkProvider>()
|
||||||
.setTheme(ThemeData.dark(useMaterial3: true)));
|
.setTheme(ThemeData.light(useMaterial3: true)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -84,6 +84,7 @@ class _ExamplePageState extends State<ExamplePage> {
|
|||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text('GymLink Example App'),
|
title: const Text('GymLink Example App'),
|
||||||
),
|
),
|
||||||
|
resizeToAvoidBottomInset: false,
|
||||||
drawer: getDrawer(context),
|
drawer: getDrawer(context),
|
||||||
body: Column(
|
body: Column(
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@@ -240,6 +240,7 @@ class _MainPageState extends State<MainPage> {
|
|||||||
onPressed: () => Navigator.of(context).push(CustomPageRoute(
|
onPressed: () => Navigator.of(context).push(CustomPageRoute(
|
||||||
builder: (context) => const BasketPage(),
|
builder: (context) => const BasketPage(),
|
||||||
)),
|
)),
|
||||||
|
highlightElevation: 0,
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
child: CircleAvatar(
|
child: CircleAvatar(
|
||||||
|
|||||||
@@ -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/app_bar.dart';
|
||||||
import 'package:gymlink_module_web/components/heading.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/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/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 = [
|
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@@ -140,17 +152,15 @@ class _OrderConfirmationPageState extends State<OrderConfirmationPage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () async {
|
||||||
debugPrint('debugprint');
|
_goToPage();
|
||||||
// if (kIsWeb) {
|
await clearCart();
|
||||||
// Navigator.of(context).push(
|
Provider.of<CartProvider>(context, listen: false)
|
||||||
// MaterialPageRoute(
|
.updateCartLength();
|
||||||
// builder: (context) => const OrderPayPage(),
|
Navigator.of(context).pushAndRemoveUntil(
|
||||||
// ),
|
CustomPageRoute(
|
||||||
// );
|
builder: (context) => const HistoryPage()),
|
||||||
// } else {
|
(route) => route.isFirst);
|
||||||
// debugPrint('test');
|
|
||||||
// }
|
|
||||||
},
|
},
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor: Theme.of(context).primaryColor,
|
backgroundColor: Theme.of(context).primaryColor,
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:gymlink_module_web/components/app_bar.dart';
|
import 'package:gymlink_module_web/components/app_bar.dart';
|
||||||
import 'package:gymlink_module_web/components/heading.dart';
|
import 'package:gymlink_module_web/components/heading.dart';
|
||||||
@@ -44,11 +46,17 @@ class HistoryPage extends StatefulWidget {
|
|||||||
|
|
||||||
class _HistoryPageState extends State<HistoryPage> {
|
class _HistoryPageState extends State<HistoryPage> {
|
||||||
List<Map<String, String>> my_orders = [];
|
List<Map<String, String>> my_orders = [];
|
||||||
|
late Timer _updateTimer;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
my_orders = orders;
|
my_orders = orders;
|
||||||
|
ordersRefresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ordersRefresh() {
|
||||||
|
_updateTimer = Timer.periodic(const Duration(minutes: 1), _onRefresh);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onLoad() async {
|
void _onLoad() async {
|
||||||
@@ -65,8 +73,15 @@ class _HistoryPageState extends State<HistoryPage> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _onRefresh() async {
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_updateTimer.cancel();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _onRefresh(Timer timer) async {
|
||||||
await Future.delayed(const Duration(milliseconds: 1000));
|
await Future.delayed(const Duration(milliseconds: 1000));
|
||||||
|
debugPrint('refreshed');
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -86,7 +101,7 @@ class _HistoryPageState extends State<HistoryPage> {
|
|||||||
scrollOffset: 200,
|
scrollOffset: 200,
|
||||||
child: RefreshIndicator(
|
child: RefreshIndicator(
|
||||||
edgeOffset: 55,
|
edgeOffset: 55,
|
||||||
onRefresh: _onRefresh,
|
onRefresh: () => _onRefresh(_updateTimer),
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
ListView.builder(
|
ListView.builder(
|
||||||
|
|||||||
Reference in New Issue
Block a user