|
|
|
@ -12,20 +12,27 @@ import 'package:diplomaticquarterapp/pages/BookAppointment/BookingOptions.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/livecare/incoming_call.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/medical/medical_profile_page.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/medical/my_admissions_page.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/CalendarUtils.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/LocalNotification.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/bottom_navigation/bottom_nav_bar.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/buttons/floatingActionButton.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/drawer/app_drawer_widget.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/transitions/slide_up_page.dart';
|
|
|
|
|
import 'package:firebase_messaging/firebase_messaging.dart';
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
|
|
|
|
import 'package:flutter_svg/svg.dart';
|
|
|
|
|
import 'package:permission_handler/permission_handler.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:rxdart/rxdart.dart';
|
|
|
|
|
|
|
|
|
|
import '../../locator.dart';
|
|
|
|
|
import 'home_page.dart';
|
|
|
|
@ -43,6 +50,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
int currentTab = 0;
|
|
|
|
|
PageController pageController;
|
|
|
|
|
ProjectViewModel projectProvider;
|
|
|
|
|
|
|
|
|
|
///inject the user data
|
|
|
|
|
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
|
|
|
|
|
|
|
|
|
@ -125,137 +133,137 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
AppGlobal.context = context;
|
|
|
|
|
});
|
|
|
|
|
_requestIOSPermissions();
|
|
|
|
|
pageController = PageController(keepPage: true);
|
|
|
|
|
_firebaseMessaging.setAutoInitEnabled(true);
|
|
|
|
|
|
|
|
|
|
if (Platform.isIOS) {
|
|
|
|
|
_firebaseMessaging.requestNotificationPermissions();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_firebaseMessaging.getToken().then((String token) {
|
|
|
|
|
sharedPref.setString(PUSH_TOKEN, token);
|
|
|
|
|
if (token != null) {
|
|
|
|
|
checkUserStatus(token);
|
|
|
|
|
}
|
|
|
|
|
requestPermissions();
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
print(err);
|
|
|
|
|
});
|
|
|
|
|
pageController = PageController(keepPage: true);
|
|
|
|
|
// _firebaseMessaging.setAutoInitEnabled(true);
|
|
|
|
|
//
|
|
|
|
|
// if (Platform.isIOS) {
|
|
|
|
|
// _firebaseMessaging.requestNotificationPermissions();
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// _firebaseMessaging.getToken().then((String token) {
|
|
|
|
|
// sharedPref.setString(PUSH_TOKEN, token);
|
|
|
|
|
// if (token != null) {
|
|
|
|
|
// checkUserStatus(token);
|
|
|
|
|
// }
|
|
|
|
|
// requestPermissions();
|
|
|
|
|
// }).catchError((err) {
|
|
|
|
|
// print(err);
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
//_firebase Background message handler
|
|
|
|
|
// _firebaseMessaging.configure(
|
|
|
|
|
// onMessage: (Map<String, dynamic> message) async {
|
|
|
|
|
// showDialog("onMessage: $message");
|
|
|
|
|
// print("onMessage: $message");
|
|
|
|
|
// print(message);
|
|
|
|
|
// print(message['name']);
|
|
|
|
|
// print(message['appointmentdate']);
|
|
|
|
|
//
|
|
|
|
|
// if (Platform.isIOS) {
|
|
|
|
|
// if (message['is_call'] == "true") {
|
|
|
|
|
// var route = ModalRoute.of(context);
|
|
|
|
|
//
|
|
|
|
|
// if (route != null) {
|
|
|
|
|
// print(route.settings.name);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// Map<String, dynamic> myMap = new Map<String, dynamic>.from(message);
|
|
|
|
|
// print(myMap);
|
|
|
|
|
// LandingPage.isOpenCallPage = true;
|
|
|
|
|
// LandingPage.incomingCallData = IncomingCallData.fromJson(myMap);
|
|
|
|
|
// if (!isPageNavigated) {
|
|
|
|
|
// isPageNavigated = true;
|
|
|
|
|
// Navigator.push(
|
|
|
|
|
// context,
|
|
|
|
|
// MaterialPageRoute(
|
|
|
|
|
// builder: (context) => IncomingCall(
|
|
|
|
|
// incomingCallData: LandingPage.incomingCallData)))
|
|
|
|
|
// .then((value) {
|
|
|
|
|
// isPageNavigated = false;
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// print("Is Call Not Found iOS");
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// print("Is Call Not Found iOS");
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// if (Platform.isAndroid) {
|
|
|
|
|
// if (message['data'].containsKey("is_call")) {
|
|
|
|
|
// var route = ModalRoute.of(context);
|
|
|
|
|
//
|
|
|
|
|
// if (route != null) {
|
|
|
|
|
// print(route.settings.name);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// Map<String, dynamic> myMap =
|
|
|
|
|
// new Map<String, dynamic>.from(message['data']);
|
|
|
|
|
// print(myMap);
|
|
|
|
|
// LandingPage.isOpenCallPage = true;
|
|
|
|
|
// LandingPage.incomingCallData = IncomingCallData.fromJson(myMap);
|
|
|
|
|
// if (!isPageNavigated) {
|
|
|
|
|
// isPageNavigated = true;
|
|
|
|
|
// Navigator.push(
|
|
|
|
|
// context,
|
|
|
|
|
// MaterialPageRoute(
|
|
|
|
|
// builder: (context) => IncomingCall(
|
|
|
|
|
// incomingCallData: LandingPage.incomingCallData)))
|
|
|
|
|
// .then((value) {
|
|
|
|
|
// isPageNavigated = false;
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// print("Is Call Not Found Android");
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// print("Is Call Not Found Android");
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
// onBackgroundMessage: Platform.isIOS ? null : myBackgroundMessageHandler,
|
|
|
|
|
// onLaunch: (Map<String, dynamic> message) async {
|
|
|
|
|
// print("onLaunch: $message");
|
|
|
|
|
// showDialog("onLaunch: $message");
|
|
|
|
|
// },
|
|
|
|
|
// onResume: (Map<String, dynamic> message) async {
|
|
|
|
|
// print("onResume: $message");
|
|
|
|
|
// print(message);
|
|
|
|
|
// print(message['name']);
|
|
|
|
|
// print(message['appointmentdate']);
|
|
|
|
|
//
|
|
|
|
|
// showDialog("onResume: $message");
|
|
|
|
|
//
|
|
|
|
|
// if (Platform.isIOS) {
|
|
|
|
|
// if (message['is_call'] == "true") {
|
|
|
|
|
// var route = ModalRoute.of(context);
|
|
|
|
|
//
|
|
|
|
|
// if (route != null) {
|
|
|
|
|
// print(route.settings.name);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// Map<String, dynamic> myMap =
|
|
|
|
|
// new Map<String, dynamic>.from(message);
|
|
|
|
|
// print(myMap);
|
|
|
|
|
// LandingPage.isOpenCallPage = true;
|
|
|
|
|
// LandingPage.incomingCallData = IncomingCallData.fromJson(myMap);
|
|
|
|
|
// if (!isPageNavigated) {
|
|
|
|
|
// isPageNavigated = true;
|
|
|
|
|
// Navigator.push(
|
|
|
|
|
// context,
|
|
|
|
|
// MaterialPageRoute(
|
|
|
|
|
// builder: (context) => IncomingCall(
|
|
|
|
|
// incomingCallData: LandingPage.incomingCallData)))
|
|
|
|
|
// .then((value) {
|
|
|
|
|
// isPageNavigated = false;
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// print("Is Call Not Found iOS");
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// print("Is Call Not Found iOS");
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
// _firebaseMessaging.configure(
|
|
|
|
|
// onMessage: (Map<String, dynamic> message) async {
|
|
|
|
|
// showDialog("onMessage: $message");
|
|
|
|
|
// print("onMessage: $message");
|
|
|
|
|
// print(message);
|
|
|
|
|
// print(message['name']);
|
|
|
|
|
// print(message['appointmentdate']);
|
|
|
|
|
//
|
|
|
|
|
// if (Platform.isIOS) {
|
|
|
|
|
// if (message['is_call'] == "true") {
|
|
|
|
|
// var route = ModalRoute.of(context);
|
|
|
|
|
//
|
|
|
|
|
// if (route != null) {
|
|
|
|
|
// print(route.settings.name);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// Map<String, dynamic> myMap = new Map<String, dynamic>.from(message);
|
|
|
|
|
// print(myMap);
|
|
|
|
|
// LandingPage.isOpenCallPage = true;
|
|
|
|
|
// LandingPage.incomingCallData = IncomingCallData.fromJson(myMap);
|
|
|
|
|
// if (!isPageNavigated) {
|
|
|
|
|
// isPageNavigated = true;
|
|
|
|
|
// Navigator.push(
|
|
|
|
|
// context,
|
|
|
|
|
// MaterialPageRoute(
|
|
|
|
|
// builder: (context) => IncomingCall(
|
|
|
|
|
// incomingCallData: LandingPage.incomingCallData)))
|
|
|
|
|
// .then((value) {
|
|
|
|
|
// isPageNavigated = false;
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// print("Is Call Not Found iOS");
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// print("Is Call Not Found iOS");
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// if (Platform.isAndroid) {
|
|
|
|
|
// if (message['data'].containsKey("is_call")) {
|
|
|
|
|
// var route = ModalRoute.of(context);
|
|
|
|
|
//
|
|
|
|
|
// if (route != null) {
|
|
|
|
|
// print(route.settings.name);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// Map<String, dynamic> myMap =
|
|
|
|
|
// new Map<String, dynamic>.from(message['data']);
|
|
|
|
|
// print(myMap);
|
|
|
|
|
// LandingPage.isOpenCallPage = true;
|
|
|
|
|
// LandingPage.incomingCallData = IncomingCallData.fromJson(myMap);
|
|
|
|
|
// if (!isPageNavigated) {
|
|
|
|
|
// isPageNavigated = true;
|
|
|
|
|
// Navigator.push(
|
|
|
|
|
// context,
|
|
|
|
|
// MaterialPageRoute(
|
|
|
|
|
// builder: (context) => IncomingCall(
|
|
|
|
|
// incomingCallData: LandingPage.incomingCallData)))
|
|
|
|
|
// .then((value) {
|
|
|
|
|
// isPageNavigated = false;
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// print("Is Call Not Found Android");
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// print("Is Call Not Found Android");
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
// onBackgroundMessage: Platform.isIOS ? null : myBackgroundMessageHandler,
|
|
|
|
|
// onLaunch: (Map<String, dynamic> message) async {
|
|
|
|
|
// print("onLaunch: $message");
|
|
|
|
|
// showDialog("onLaunch: $message");
|
|
|
|
|
// },
|
|
|
|
|
// onResume: (Map<String, dynamic> message) async {
|
|
|
|
|
// print("onResume: $message");
|
|
|
|
|
// print(message);
|
|
|
|
|
// print(message['name']);
|
|
|
|
|
// print(message['appointmentdate']);
|
|
|
|
|
//
|
|
|
|
|
// showDialog("onResume: $message");
|
|
|
|
|
//
|
|
|
|
|
// if (Platform.isIOS) {
|
|
|
|
|
// if (message['is_call'] == "true") {
|
|
|
|
|
// var route = ModalRoute.of(context);
|
|
|
|
|
//
|
|
|
|
|
// if (route != null) {
|
|
|
|
|
// print(route.settings.name);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// Map<String, dynamic> myMap =
|
|
|
|
|
// new Map<String, dynamic>.from(message);
|
|
|
|
|
// print(myMap);
|
|
|
|
|
// LandingPage.isOpenCallPage = true;
|
|
|
|
|
// LandingPage.incomingCallData = IncomingCallData.fromJson(myMap);
|
|
|
|
|
// if (!isPageNavigated) {
|
|
|
|
|
// isPageNavigated = true;
|
|
|
|
|
// Navigator.push(
|
|
|
|
|
// context,
|
|
|
|
|
// MaterialPageRoute(
|
|
|
|
|
// builder: (context) => IncomingCall(
|
|
|
|
|
// incomingCallData: LandingPage.incomingCallData)))
|
|
|
|
|
// .then((value) {
|
|
|
|
|
// isPageNavigated = false;
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// print("Is Call Not Found iOS");
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// print("Is Call Not Found iOS");
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
// );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -331,55 +339,59 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
// projectProvider = Provider.of(context);
|
|
|
|
|
// checkValue(projectProvider);
|
|
|
|
|
return Scaffold(
|
|
|
|
|
appBar: AppBar(
|
|
|
|
|
elevation: 0,
|
|
|
|
|
textTheme: TextTheme(
|
|
|
|
|
headline6: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
|
|
|
|
|
appBar: AppBar(
|
|
|
|
|
elevation: 0,
|
|
|
|
|
textTheme: TextTheme(
|
|
|
|
|
headline6:
|
|
|
|
|
TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
|
|
|
|
|
),
|
|
|
|
|
title: Texts(getText(currentTab).toUpperCase(),bold: true,color: Colors.white,),
|
|
|
|
|
leading: Builder(
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
return IconButton(
|
|
|
|
|
icon: Icon(Icons.menu),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
onPressed: () => Scaffold.of(context).openDrawer(),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
actions: [
|
|
|
|
|
// IconButton(
|
|
|
|
|
// iconSize: 70,
|
|
|
|
|
// icon: SvgPicture.asset('assets/images/svg/robort_svg.svg',
|
|
|
|
|
// height: 100, width: 100, fit: BoxFit.cover),
|
|
|
|
|
// onPressed: () {
|
|
|
|
|
// triggerRobot();
|
|
|
|
|
// } //do something,
|
|
|
|
|
// )
|
|
|
|
|
],
|
|
|
|
|
centerTitle: true,
|
|
|
|
|
),
|
|
|
|
|
drawer: SafeArea(child: AppDrawer()),
|
|
|
|
|
extendBody: true,
|
|
|
|
|
body: PageView(
|
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
|
controller: pageController,
|
|
|
|
|
children: [
|
|
|
|
|
HomePage(goToMyProfile: () {_changeCurrentTab(1);},),
|
|
|
|
|
MedicalProfilePage(),
|
|
|
|
|
BookingOptions(),
|
|
|
|
|
Container(),
|
|
|
|
|
ToDo(),
|
|
|
|
|
], // Please do not remove the BookingOptions from this array
|
|
|
|
|
),
|
|
|
|
|
title: Text(getText(currentTab).toUpperCase()),
|
|
|
|
|
leading: Builder(
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
return IconButton(
|
|
|
|
|
icon: Icon(Icons.menu),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
onPressed: () => Scaffold.of(context).openDrawer(),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
bottomNavigationBar: BottomNavBar(
|
|
|
|
|
changeIndex: _changeCurrentTab,
|
|
|
|
|
index: currentTab,
|
|
|
|
|
),
|
|
|
|
|
actions: [
|
|
|
|
|
// IconButton(
|
|
|
|
|
// iconSize: 70,
|
|
|
|
|
// icon: SvgPicture.asset('assets/images/svg/robort_svg.svg',
|
|
|
|
|
// height: 100, width: 100, fit: BoxFit.cover),
|
|
|
|
|
// onPressed: () {
|
|
|
|
|
// triggerRobot();
|
|
|
|
|
// } //do something,
|
|
|
|
|
// )
|
|
|
|
|
],
|
|
|
|
|
centerTitle: true,
|
|
|
|
|
),
|
|
|
|
|
drawer: SafeArea(child: AppDrawer()),
|
|
|
|
|
extendBody: true,
|
|
|
|
|
body: PageView(
|
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
|
controller: pageController,
|
|
|
|
|
children: [
|
|
|
|
|
HomePage(goToMyProfile: () {_changeCurrentTab(1);},),
|
|
|
|
|
MedicalProfilePage(),
|
|
|
|
|
BookingOptions(),
|
|
|
|
|
Container(),
|
|
|
|
|
ToDo(),
|
|
|
|
|
|
|
|
|
|
], // Please do not remove the BookingOptions from this array
|
|
|
|
|
),
|
|
|
|
|
bottomNavigationBar: BottomNavBar(changeIndex: _changeCurrentTab, index: currentTab,),
|
|
|
|
|
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
|
|
|
|
floatingActionButton: currentTab ==0? FloatingButton(
|
|
|
|
|
elevation: true,
|
|
|
|
|
onTap: () {
|
|
|
|
|
_changeCurrentTab(2);
|
|
|
|
|
}):null
|
|
|
|
|
);
|
|
|
|
|
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
|
|
|
|
floatingActionButton: currentTab == 0
|
|
|
|
|
? FloatingButton(
|
|
|
|
|
elevation: true,
|
|
|
|
|
onTap: () {
|
|
|
|
|
_changeCurrentTab(2);
|
|
|
|
|
})
|
|
|
|
|
: null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
triggerRobot() {
|
|
|
|
@ -395,10 +407,9 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
case 2:
|
|
|
|
|
return TranslationBase.of(context).bookAppo;
|
|
|
|
|
case 3:
|
|
|
|
|
return TranslationBase.of(context).mySchedule;
|
|
|
|
|
return TranslationBase.of(context).myFamily;
|
|
|
|
|
case 4:
|
|
|
|
|
return TranslationBase.of(context).services;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|