pull to refresh page
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.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.dart';
|
||||||
import 'package:patient_manager/mih_objects/business_user.dart';
|
import 'package:patient_manager/mih_objects/business_user.dart';
|
||||||
import 'package:patient_manager/mih_objects/notification.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 {
|
class MIHHome extends StatefulWidget {
|
||||||
final AppUser signedInUser;
|
final AppUser signedInUser;
|
||||||
@@ -793,26 +793,27 @@ class _MIHHomeState extends State<MIHHome> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> refreshNotifications() async {
|
Future<void> refreshNotifications() async {
|
||||||
var responseNotification = await http.get(Uri.parse(
|
html.window.location.reload();
|
||||||
"$baseAPI/notifications/${widget.signedInUser.app_id}?amount=$amount"));
|
// var responseNotification = await http.get(Uri.parse(
|
||||||
List<MIHNotification> notifi;
|
// "$baseAPI/notifications/${widget.signedInUser.app_id}?amount=$amount"));
|
||||||
if (responseNotification.statusCode == 200) {
|
// List<MIHNotification> notifi;
|
||||||
String body = responseNotification.body;
|
// if (responseNotification.statusCode == 200) {
|
||||||
// var decodedData = jsonDecode(body);
|
// String body = responseNotification.body;
|
||||||
// MIHNotification notifications = MIHNotification.fromJson(decodedData);
|
// // var decodedData = jsonDecode(body);
|
||||||
|
// // 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() {
|
||||||
|
|||||||
Reference in New Issue
Block a user