|
|
|
|
@ -52,6 +52,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
ProjectViewModel projectViewModel;
|
|
|
|
|
var notificationCount = '';
|
|
|
|
|
var themeNotifier;
|
|
|
|
|
|
|
|
|
|
///inject the user data
|
|
|
|
|
AuthenticatedUserObject authenticatedUserObject =
|
|
|
|
|
locator<AuthenticatedUserObject>();
|
|
|
|
|
@ -75,8 +76,9 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
LocationUtils locationUtils;
|
|
|
|
|
_changeCurrentTab(int tab) {
|
|
|
|
|
setState(() {
|
|
|
|
|
currentTab = tab;
|
|
|
|
|
pageController.jumpToPage(tab);
|
|
|
|
|
currentTab = tab;
|
|
|
|
|
pageController.jumpToPage(tab);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -140,18 +142,17 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
_firebaseMessaging.setAutoInitEnabled(true);
|
|
|
|
|
|
|
|
|
|
locationUtils =
|
|
|
|
|
new LocationUtils(isShowConfirmDialog: true, context: context);
|
|
|
|
|
new LocationUtils(isShowConfirmDialog: true, context: context);
|
|
|
|
|
WidgetsBinding.instance
|
|
|
|
|
.addPostFrameCallback((_) => locationUtils.getCurrentLocation());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (Platform.isIOS) {
|
|
|
|
|
_firebaseMessaging.requestNotificationPermissions();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_firebaseMessaging.getToken().then((String token) async {
|
|
|
|
|
sharedPref.setString(PUSH_TOKEN, token);
|
|
|
|
|
if (token != null && await sharedPref.getObject(USER_PROFILE) ==null) {
|
|
|
|
|
if (token != null && await sharedPref.getObject(USER_PROFILE) == null) {
|
|
|
|
|
DEVICE_TOKEN = token;
|
|
|
|
|
checkUserStatus(token);
|
|
|
|
|
}
|
|
|
|
|
@ -392,7 +393,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
notificationCount,
|
|
|
|
|
style: new TextStyle(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontSize: projectViewModel.isArabic ? 8 : 9,
|
|
|
|
|
fontSize: projectViewModel.isArabic ? 8 : 9,
|
|
|
|
|
),
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
),
|
|
|
|
|
@ -416,7 +417,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
SETTINGS,
|
|
|
|
|
);
|
|
|
|
|
else
|
|
|
|
|
login();
|
|
|
|
|
login();
|
|
|
|
|
}, //do something,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
@ -430,7 +431,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
children: [
|
|
|
|
|
HomePage(
|
|
|
|
|
goToMyProfile: () {
|
|
|
|
|
_changeCurrentTab(1);
|
|
|
|
|
// _changeCurrentTab(1);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
MedicalProfilePage(),
|
|
|
|
|
@ -471,45 +472,46 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
return TranslationBase.of(context).bookAppo;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
setTheme() async{
|
|
|
|
|
//
|
|
|
|
|
// defaultTheme =
|
|
|
|
|
// ThemeData(
|
|
|
|
|
// fontFamily:projectViewModel.isArabic ? 'Cairo' : 'WorkSans',
|
|
|
|
|
// primarySwatch: Colors.blue,
|
|
|
|
|
// visualDensity: VisualDensity.adaptivePlatformDensity,
|
|
|
|
|
// brightness: Brightness.light,
|
|
|
|
|
// pageTransitionsTheme: const PageTransitionsTheme(
|
|
|
|
|
// builders: {
|
|
|
|
|
// TargetPlatform.android: ZoomPageTransitionsBuilder(),
|
|
|
|
|
// TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// hintColor: Colors.grey[400],
|
|
|
|
|
// disabledColor: Colors.grey[300],
|
|
|
|
|
// errorColor: Color.fromRGBO(235, 80, 60, 1.0),
|
|
|
|
|
// scaffoldBackgroundColor: Color(0xffEEEEEE),
|
|
|
|
|
// textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5),
|
|
|
|
|
// textSelectionHandleColor: Colors.grey,
|
|
|
|
|
// canvasColor: Colors.white,
|
|
|
|
|
// backgroundColor: Colors.white,
|
|
|
|
|
// highlightColor: Colors.grey[100].withOpacity(0.4),
|
|
|
|
|
// splashColor: Colors.transparent,
|
|
|
|
|
// primaryColor: Color(0xff40ACC9),
|
|
|
|
|
// bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)),
|
|
|
|
|
// cursorColor: Colors.grey,
|
|
|
|
|
// cardColor: Colors.white,
|
|
|
|
|
// iconTheme: IconThemeData(),
|
|
|
|
|
// appBarTheme: AppBarTheme(
|
|
|
|
|
// color: Color(0xff40ACC9),
|
|
|
|
|
// brightness: Brightness.dark,
|
|
|
|
|
// elevation: 10.0,
|
|
|
|
|
// actionsIconTheme: IconThemeData(
|
|
|
|
|
// color: Color(0xff40ACC9),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// );
|
|
|
|
|
// themeNotifier.setTheme(defaultTheme);
|
|
|
|
|
|
|
|
|
|
setTheme() async {
|
|
|
|
|
//
|
|
|
|
|
// defaultTheme =
|
|
|
|
|
// ThemeData(
|
|
|
|
|
// fontFamily:projectViewModel.isArabic ? 'Cairo' : 'WorkSans',
|
|
|
|
|
// primarySwatch: Colors.blue,
|
|
|
|
|
// visualDensity: VisualDensity.adaptivePlatformDensity,
|
|
|
|
|
// brightness: Brightness.light,
|
|
|
|
|
// pageTransitionsTheme: const PageTransitionsTheme(
|
|
|
|
|
// builders: {
|
|
|
|
|
// TargetPlatform.android: ZoomPageTransitionsBuilder(),
|
|
|
|
|
// TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// hintColor: Colors.grey[400],
|
|
|
|
|
// disabledColor: Colors.grey[300],
|
|
|
|
|
// errorColor: Color.fromRGBO(235, 80, 60, 1.0),
|
|
|
|
|
// scaffoldBackgroundColor: Color(0xffEEEEEE),
|
|
|
|
|
// textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5),
|
|
|
|
|
// textSelectionHandleColor: Colors.grey,
|
|
|
|
|
// canvasColor: Colors.white,
|
|
|
|
|
// backgroundColor: Colors.white,
|
|
|
|
|
// highlightColor: Colors.grey[100].withOpacity(0.4),
|
|
|
|
|
// splashColor: Colors.transparent,
|
|
|
|
|
// primaryColor: Color(0xff40ACC9),
|
|
|
|
|
// bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)),
|
|
|
|
|
// cursorColor: Colors.grey,
|
|
|
|
|
// cardColor: Colors.white,
|
|
|
|
|
// iconTheme: IconThemeData(),
|
|
|
|
|
// appBarTheme: AppBarTheme(
|
|
|
|
|
// color: Color(0xff40ACC9),
|
|
|
|
|
// brightness: Brightness.dark,
|
|
|
|
|
// elevation: 10.0,
|
|
|
|
|
// actionsIconTheme: IconThemeData(
|
|
|
|
|
// color: Color(0xff40ACC9),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// );
|
|
|
|
|
// themeNotifier.setTheme(defaultTheme);
|
|
|
|
|
}
|
|
|
|
|
void checkUserStatus(token) async {
|
|
|
|
|
authService
|
|
|
|
|
@ -524,8 +526,9 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
.then((res) => {print(res)});
|
|
|
|
|
authService.getDashboard().then((value) => {
|
|
|
|
|
setState(() {
|
|
|
|
|
notificationCount = value['List_PatientDashboard']
|
|
|
|
|
[0]['UnreadPatientNotificationCount'].toString();
|
|
|
|
|
notificationCount = value['List_PatientDashboard'][0]
|
|
|
|
|
['UnreadPatientNotificationCount']
|
|
|
|
|
.toString();
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
@ -557,6 +560,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
_changeCurrentTab(2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
login() async {
|
|
|
|
|
var data = await sharedPref.getObject(IMEI_USER_DATA);
|
|
|
|
|
sharedPref.remove(REGISTER_DATA_FOR_LOGIIN);
|
|
|
|
|
|