homescreen pull down to refresh app

This commit is contained in:
2024-11-27 20:00:45 +02:00
parent 9674d2b0d0
commit c881689ff8

View File

@@ -11,7 +11,7 @@ import 'package:mobile_scanner/mobile_scanner.dart';
// import 'package:simple_barcode_scanner/simple_barcode_scanner.dart';
import '../../main.dart';
import 'package:supertokens_flutter/http.dart' as http;
// import "package:universal_html/html.dart" as html;
import "package:universal_html/html.dart" as html;
import '../../mih_apis/mih_location_api.dart';
import '../../mih_components/mih_inputs_and_buttons/mih_search_input.dart';
@@ -948,27 +948,27 @@ class _MIHHomeState extends State<MIHHome> {
}
Future<void> refreshNotifications() async {
//html.window.location.reload();
var responseNotification = await http.get(Uri.parse(
"$baseAPI/notifications/${widget.signedInUser.app_id}?amount=$amount"));
List<MIHNotification> 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<MIHNotification> 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<MIHNotification> notifications = List<MIHNotification>.from(
l.map((model) => MIHNotification.fromJson(model)));
notifi = notifications;
} else {
notifi = [];
}
setState(() {
notifiList = notifi;
});
notificationPopUp();
// Iterable l = jsonDecode(body);
// //print("Here2");
// List<MIHNotification> notifications = List<MIHNotification>.from(
// l.map((model) => MIHNotification.fromJson(model)));
// notifi = notifications;
// } else {
// notifi = [];
// }
// setState(() {
// notifiList = notifi;
// });
// notificationPopUp();
}
void notificationPopUp() {