fix error screen

feature/passo/PASSO-#1-Sync-data-from-device-to-postgre-and-vice-versa
unknown 2023-10-08 20:12:49 +08:00
parent 8dc0529646
commit b1ea70b9ab
2 changed files with 23 additions and 17 deletions

View File

@ -5,8 +5,8 @@ import 'package:unit2/utils/global_context.dart';
import '../../../../theme-data.dart/colors.dart'; import '../../../../theme-data.dart/colors.dart';
import '../../../../utils/global.dart'; import '../../../../utils/global.dart';
Widget getTile( Widget getTile(IconData icondata, String title, String route,
IconData icondata, String title, String route, BuildContext context,UserData userData) { BuildContext context, UserData userData) {
return ListTile( return ListTile(
dense: true, dense: true,
leading: Icon( leading: Icon(
@ -19,25 +19,31 @@ Widget getTile(
), ),
onTap: () async { onTap: () async {
if (title.toLowerCase() == "logout") { if (title.toLowerCase() == "logout") {
confirmAlert(context, () async{ confirmAlert(context, () async {
await CREDENTIALS!.clear(); await CREDENTIALS!.clear();
await CREDENTIALS!.deleteAll(['username','password','saved']); await OFFLINE!.clear();
Navigator.pushReplacementNamed (NavigationService.navigatorKey.currentContext!,"/"); await CREDENTIALS!.deleteAll(['username', 'password', 'saved']);
},"Logout","Are You sure you want to logout?"); Navigator.pushReplacementNamed(
}if(title.toLowerCase() == 'profile'){ NavigationService.navigatorKey.currentContext!, "/");
ProfileArguments profileArguments = ProfileArguments(token: userData.user!.login!.token!, userID:userData.user!.login!.user!.profileId!); }, "Logout", "Are You sure you want to logout?");
Navigator.pushNamed(context, route,arguments: profileArguments); }
}if(title.toLowerCase() == 'basic info'){ if (title.toLowerCase() == 'profile') {
ProfileArguments profileArguments = ProfileArguments(
token: userData.user!.login!.token!,
userID: userData.user!.login!.user!.profileId!);
Navigator.pushNamed(context, route, arguments: profileArguments);
}
if (title.toLowerCase() == 'basic info') {
Navigator.pushNamed(context, '/basic-info'); Navigator.pushNamed(context, '/basic-info');
}if(title.toLowerCase() == 'request sos'){ }
if (title.toLowerCase() == 'request sos') {
Navigator.pushNamed(context, '/sos'); Navigator.pushNamed(context, '/sos');
} }
}, },
); );
} }
class ProfileArguments{ class ProfileArguments {
final int userID; final int userID;
final String token; final String token;
const ProfileArguments({required this.token, required this.userID}); const ProfileArguments({required this.token, required this.userID});

View File

@ -5,8 +5,8 @@ class Url {
String host() { String host() {
// return '192.168.10.183:3000'; // return '192.168.10.183:3000';
// return 'agusandelnorte.gov.ph'; return 'agusandelnorte.gov.ph';
return "192.168.10.219:3000"; // return "192.168.10.219:3000";
// return "192.168.10.241"; // return "192.168.10.241";
// return "192.168.10.221:3004"; // return "192.168.10.221:3004";
// return "playweb.agusandelnorte.gov.ph"; // return "playweb.agusandelnorte.gov.ph";