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