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

@@ -1,3 +1,5 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:gymlink_module_web/components/app_bar.dart';
import 'package:gymlink_module_web/components/heading.dart';
@@ -44,11 +46,17 @@ class HistoryPage extends StatefulWidget {
class _HistoryPageState extends State<HistoryPage> {
List<Map<String, String>> my_orders = [];
late Timer _updateTimer;
@override
void initState() {
super.initState();
my_orders = orders;
ordersRefresh();
}
void ordersRefresh() {
_updateTimer = Timer.periodic(const Duration(minutes: 1), _onRefresh);
}
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));
debugPrint('refreshed');
}
@override
@@ -86,7 +101,7 @@ class _HistoryPageState extends State<HistoryPage> {
scrollOffset: 200,
child: RefreshIndicator(
edgeOffset: 55,
onRefresh: _onRefresh,
onRefresh: () => _onRefresh(_updateTimer),
child: Stack(
children: [
ListView.builder(