|
|
|
@ -47,6 +47,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
int currentTab = 0;
|
|
|
|
|
PageController pageController;
|
|
|
|
|
ProjectViewModel projectProvider;
|
|
|
|
|
var notificationCount = '';
|
|
|
|
|
|
|
|
|
|
///inject the user data
|
|
|
|
|
AuthenticatedUserObject authenticatedUserObject =
|
|
|
|
@ -87,33 +88,33 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//setState(() {
|
|
|
|
|
print("didChangeAppLifecycleState");
|
|
|
|
|
print('state = $state');
|
|
|
|
|
AppGlobal.context = context;
|
|
|
|
|
if (state == AppLifecycleState.resumed) {
|
|
|
|
|
print(LandingPage.isOpenCallPage);
|
|
|
|
|
if (LandingPage.isOpenCallPage) {
|
|
|
|
|
if (!isPageNavigated) {
|
|
|
|
|
isPageNavigated = true;
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) => IncomingCall(
|
|
|
|
|
incomingCallData: LandingPage.incomingCallData)))
|
|
|
|
|
.then((value) {
|
|
|
|
|
isPageNavigated = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
print("didChangeAppLifecycleState");
|
|
|
|
|
print('state = $state');
|
|
|
|
|
AppGlobal.context = context;
|
|
|
|
|
if (state == AppLifecycleState.resumed) {
|
|
|
|
|
print(LandingPage.isOpenCallPage);
|
|
|
|
|
if (LandingPage.isOpenCallPage) {
|
|
|
|
|
if (!isPageNavigated) {
|
|
|
|
|
isPageNavigated = true;
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) => IncomingCall(
|
|
|
|
|
incomingCallData: LandingPage.incomingCallData)))
|
|
|
|
|
.then((value) {
|
|
|
|
|
isPageNavigated = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (state == AppLifecycleState.paused) {
|
|
|
|
|
isPageNavigated = false;
|
|
|
|
|
}
|
|
|
|
|
if (state == AppLifecycleState.paused) {
|
|
|
|
|
isPageNavigated = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (state == AppLifecycleState.inactive) {
|
|
|
|
|
isPageNavigated = false;
|
|
|
|
|
}
|
|
|
|
|
if (state == AppLifecycleState.inactive) {
|
|
|
|
|
isPageNavigated = false;
|
|
|
|
|
}
|
|
|
|
|
//});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -128,8 +129,8 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
super.initState();
|
|
|
|
|
WidgetsBinding.instance.addObserver(this);
|
|
|
|
|
//setState(() {
|
|
|
|
|
AppGlobal.context = context;
|
|
|
|
|
// });
|
|
|
|
|
AppGlobal.context = context;
|
|
|
|
|
// });
|
|
|
|
|
_requestIOSPermissions();
|
|
|
|
|
pageController = PageController(keepPage: true);
|
|
|
|
|
_firebaseMessaging.setAutoInitEnabled(true);
|
|
|
|
@ -140,7 +141,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
|
|
|
|
|
_firebaseMessaging.getToken().then((String token) {
|
|
|
|
|
sharedPref.setString(PUSH_TOKEN, token);
|
|
|
|
|
if (token != null && DEVICE_TOKEN =="") {
|
|
|
|
|
if (token != null && DEVICE_TOKEN == "") {
|
|
|
|
|
DEVICE_TOKEN = token;
|
|
|
|
|
checkUserStatus(token);
|
|
|
|
|
}
|
|
|
|
@ -344,34 +345,69 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
),
|
|
|
|
|
title: Text(
|
|
|
|
|
getText(currentTab).toUpperCase(),
|
|
|
|
|
style: TextStyle(fontWeight: FontWeight.bold,color: Colors.white,fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans'),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans'),
|
|
|
|
|
// bold: true,
|
|
|
|
|
// color: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
leading: Builder(
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
return IconButton(
|
|
|
|
|
icon: Icon(Icons.menu),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
onPressed: () => Scaffold.of(context).openDrawer(),
|
|
|
|
|
return new Stack(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
IconButton(
|
|
|
|
|
icon: Icon(Icons.menu),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
onPressed: () => Scaffold.of(context).openDrawer(),
|
|
|
|
|
),
|
|
|
|
|
notificationCount != ''
|
|
|
|
|
? new Positioned(
|
|
|
|
|
right: 0,
|
|
|
|
|
top: 10,
|
|
|
|
|
child: new Container(
|
|
|
|
|
padding: EdgeInsets.all(4),
|
|
|
|
|
decoration: new BoxDecoration(
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
borderRadius: BorderRadius.circular(20),
|
|
|
|
|
),
|
|
|
|
|
constraints: BoxConstraints(
|
|
|
|
|
minWidth: 20,
|
|
|
|
|
minHeight: 20,
|
|
|
|
|
),
|
|
|
|
|
child: new Text(
|
|
|
|
|
notificationCount,
|
|
|
|
|
style: new TextStyle(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontSize: 9,
|
|
|
|
|
),
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: SizedBox()
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
actions: [
|
|
|
|
|
IconButton(
|
|
|
|
|
//iconSize: 70,
|
|
|
|
|
icon: Icon(projectViewModel.isLogin?Icons.settings : Icons.login,color: Colors.white,),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
if(projectViewModel.isLogin)
|
|
|
|
|
//iconSize: 70,
|
|
|
|
|
icon: Icon(
|
|
|
|
|
projectViewModel.isLogin ? Icons.settings : Icons.login,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
if (projectViewModel.isLogin)
|
|
|
|
|
Navigator.of(context).pushNamed(
|
|
|
|
|
SETTINGS,
|
|
|
|
|
);
|
|
|
|
|
else
|
|
|
|
|
Navigator.of(context).pushNamed(
|
|
|
|
|
SETTINGS ,
|
|
|
|
|
WELCOME_LOGIN,
|
|
|
|
|
);
|
|
|
|
|
else
|
|
|
|
|
Navigator.of(context).pushNamed(
|
|
|
|
|
WELCOME_LOGIN ,
|
|
|
|
|
);
|
|
|
|
|
}, //do something,
|
|
|
|
|
)
|
|
|
|
|
}, //do something,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
centerTitle: true,
|
|
|
|
|
),
|
|
|
|
@ -388,7 +424,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
),
|
|
|
|
|
MedicalProfilePage(),
|
|
|
|
|
BookingOptions(),
|
|
|
|
|
MyFamily(isAppbarVisible:false),
|
|
|
|
|
MyFamily(isAppbarVisible: false),
|
|
|
|
|
ToDo(),
|
|
|
|
|
], // Please do not remove the BookingOptions from this array
|
|
|
|
|
),
|
|
|
|
@ -432,11 +468,17 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
if (await sharedPref.getObject(USER_PROFILE) != null) {
|
|
|
|
|
var data =
|
|
|
|
|
AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE));
|
|
|
|
|
if (data != null)
|
|
|
|
|
if (data != null) {
|
|
|
|
|
authService
|
|
|
|
|
.registeredAuthenticatedUser(data, token, 0, 0)
|
|
|
|
|
.then((res) => {print(res)});
|
|
|
|
|
|
|
|
|
|
authService.getDashboard().then((value) => {
|
|
|
|
|
setState(() {
|
|
|
|
|
notificationCount = value['List_PatientDashboard']
|
|
|
|
|
[0]['UnreadPatientNotificationCount'].toString();
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|