From 63150d140242770f21c26a041476c44f842264f2 Mon Sep 17 00:00:00 2001 From: yaso Date: Tue, 12 Nov 2024 13:07:11 +0200 Subject: [PATCH] pull to refresh page --- .../lib/mih_packages/mih_home/mih_home.dart | 43 ++++++++++--------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/Frontend/patient_manager/lib/mih_packages/mih_home/mih_home.dart b/Frontend/patient_manager/lib/mih_packages/mih_home/mih_home.dart index b71b6a3e..8b9e1f96 100644 --- a/Frontend/patient_manager/lib/mih_packages/mih_home/mih_home.dart +++ b/Frontend/patient_manager/lib/mih_packages/mih_home/mih_home.dart @@ -1,5 +1,4 @@ import 'dart:async'; -import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -29,7 +28,8 @@ import 'package:patient_manager/mih_objects/arguments.dart'; import 'package:patient_manager/mih_objects/business.dart'; import 'package:patient_manager/mih_objects/business_user.dart'; import 'package:patient_manager/mih_objects/notification.dart'; -import 'package:supertokens_flutter/http.dart' as http; +//import 'package:supertokens_flutter/http.dart' as http; +import "package:universal_html/html.dart" as html; class MIHHome extends StatefulWidget { final AppUser signedInUser; @@ -793,26 +793,27 @@ class _MIHHomeState extends State { } Future refreshNotifications() async { - var responseNotification = await http.get(Uri.parse( - "$baseAPI/notifications/${widget.signedInUser.app_id}?amount=$amount")); - List notifi; - if (responseNotification.statusCode == 200) { - String body = responseNotification.body; - // var decodedData = jsonDecode(body); - // MIHNotification notifications = MIHNotification.fromJson(decodedData); + html.window.location.reload(); + // var responseNotification = await http.get(Uri.parse( + // "$baseAPI/notifications/${widget.signedInUser.app_id}?amount=$amount")); + // List notifi; + // if (responseNotification.statusCode == 200) { + // String body = responseNotification.body; + // // var decodedData = jsonDecode(body); + // // MIHNotification notifications = MIHNotification.fromJson(decodedData); - Iterable l = jsonDecode(body); - //print("Here2"); - List notifications = List.from( - l.map((model) => MIHNotification.fromJson(model))); - notifi = notifications; - } else { - notifi = []; - } - setState(() { - notifiList = notifi; - }); - notificationPopUp(); + // Iterable l = jsonDecode(body); + // //print("Here2"); + // List notifications = List.from( + // l.map((model) => MIHNotification.fromJson(model))); + // notifi = notifications; + // } else { + // notifi = []; + // } + // setState(() { + // notifiList = notifi; + // }); + // notificationPopUp(); } void notificationPopUp() {