|
|
|
@ -32,6 +32,7 @@ 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/others/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:firebase_analytics/observer.dart';
|
|
|
|
|
import 'package:firebase_messaging/firebase_messaging.dart';
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
@ -47,8 +48,11 @@ import 'home_page.dart';
|
|
|
|
|
|
|
|
|
|
class LandingPage extends StatefulWidget {
|
|
|
|
|
static LandingPage shared;
|
|
|
|
|
int currentTab = 0;
|
|
|
|
|
_LandingPageState state;
|
|
|
|
|
LandingPage() {
|
|
|
|
|
|
|
|
|
|
LandingPage({currentTabLocal}) {
|
|
|
|
|
currentTab = currentTabLocal ?? 0;
|
|
|
|
|
LandingPage.shared = this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -67,7 +71,6 @@ class LandingPage extends StatefulWidget {
|
|
|
|
|
class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
var authProvider = new AuthProvider();
|
|
|
|
|
|
|
|
|
|
int currentTab = 0;
|
|
|
|
|
PageController pageController;
|
|
|
|
|
ProjectViewModel projectViewModel;
|
|
|
|
|
var notificationCount = '';
|
|
|
|
@ -99,7 +102,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
|
|
|
|
|
changeCurrentTab(int tab) {
|
|
|
|
|
setState(() {
|
|
|
|
|
if (currentTab > 0 && tab == 2)
|
|
|
|
|
if (widget.currentTab > 0 && tab == 2)
|
|
|
|
|
pageController.jumpToPage(0);
|
|
|
|
|
else if (tab != 0)
|
|
|
|
|
pageController.jumpToPage(tab);
|
|
|
|
@ -107,7 +110,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
IS_VOICE_COMMAND_CLOSED = false;
|
|
|
|
|
pageController.jumpToPage(tab);
|
|
|
|
|
}
|
|
|
|
|
currentTab = tab;
|
|
|
|
|
widget.currentTab = tab;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -166,7 +169,8 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
AppGlobal.context = context;
|
|
|
|
|
|
|
|
|
|
_requestIOSPermissions();
|
|
|
|
|
pageController = PageController(keepPage: true);
|
|
|
|
|
pageController =
|
|
|
|
|
PageController(keepPage: true, initialPage: widget.currentTab);
|
|
|
|
|
_firebaseMessaging.setAutoInitEnabled(true);
|
|
|
|
|
|
|
|
|
|
locationUtils =
|
|
|
|
@ -472,94 +476,84 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
projectViewModel = Provider.of(context);
|
|
|
|
|
|
|
|
|
|
return Scaffold(
|
|
|
|
|
appBar: AppBar(
|
|
|
|
|
elevation: 0,
|
|
|
|
|
textTheme: TextTheme(
|
|
|
|
|
headline6: TextStyle(
|
|
|
|
|
color: Theme.of(context).textTheme.headline1.color,
|
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
|
),
|
|
|
|
|
title: Text(
|
|
|
|
|
getText(currentTab).toUpperCase(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
color: Theme.of(context).textTheme.headline1.color,
|
|
|
|
|
fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans'),
|
|
|
|
|
// bold: true,
|
|
|
|
|
// color: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
leading: Builder(
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
return new Stack(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
currentTab == 0
|
|
|
|
|
? IconButton(
|
|
|
|
|
icon: Icon(Icons.menu),
|
|
|
|
|
color: Theme.of(context).textTheme.headline1.color,
|
|
|
|
|
onPressed: () => Scaffold.of(context).openDrawer(),
|
|
|
|
|
)
|
|
|
|
|
: IconButton(
|
|
|
|
|
icon: Icon(Icons.arrow_back),
|
|
|
|
|
color: Theme.of(context).textTheme.headline1.color,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
currentTab = 0;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
pageController.jumpToPage(0);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
notificationCount != ''
|
|
|
|
|
? new Positioned(
|
|
|
|
|
right: projectViewModel.isArabic ? 35 : 0,
|
|
|
|
|
top: 5,
|
|
|
|
|
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: projectViewModel.isArabic ? 8 : 9,
|
|
|
|
|
),
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
return AppScaffold(
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
showHomeAppBarIcon: false,
|
|
|
|
|
appBarTitle: getText(widget.currentTab).toUpperCase(),
|
|
|
|
|
leading: Builder(
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
return new Stack(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
widget.currentTab == 0
|
|
|
|
|
? IconButton(
|
|
|
|
|
icon: Icon(Icons.menu),
|
|
|
|
|
color: Theme.of(context).textTheme.headline1.color,
|
|
|
|
|
onPressed: () => Scaffold.of(context).openDrawer(),
|
|
|
|
|
)
|
|
|
|
|
: IconButton(
|
|
|
|
|
icon: Icon(Icons.arrow_back),
|
|
|
|
|
color: Theme.of(context).textTheme.headline1.color,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
widget.currentTab = 0;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
pageController.jumpToPage(0);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
notificationCount != ''
|
|
|
|
|
? new Positioned(
|
|
|
|
|
right: projectViewModel.isArabic ? 35 : 0,
|
|
|
|
|
top: 5,
|
|
|
|
|
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: projectViewModel.isArabic ? 8 : 9,
|
|
|
|
|
),
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: SizedBox()
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
actions: [
|
|
|
|
|
IconButton(
|
|
|
|
|
//iconSize: 70,
|
|
|
|
|
icon: Icon(
|
|
|
|
|
projectViewModel.isLogin ? Icons.settings : Icons.login,
|
|
|
|
|
color: Theme.of(context).textTheme.headline1.color,
|
|
|
|
|
),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
if (projectViewModel.isLogin)
|
|
|
|
|
Navigator.of(context).pushNamed(
|
|
|
|
|
SETTINGS,
|
|
|
|
|
);
|
|
|
|
|
else
|
|
|
|
|
login();
|
|
|
|
|
}, //do something,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
centerTitle: true,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: SizedBox()
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
drawer: SafeArea(child: AppDrawer()),
|
|
|
|
|
extendBody: true,
|
|
|
|
|
isShowDrawer: true,
|
|
|
|
|
appBarIcons: [
|
|
|
|
|
IconButton(
|
|
|
|
|
//iconSize: 70,
|
|
|
|
|
icon: Icon(
|
|
|
|
|
projectViewModel.isLogin ? Icons.settings : Icons.login,
|
|
|
|
|
color: Theme.of(context).textTheme.headline1.color,
|
|
|
|
|
),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
if (projectViewModel.isLogin)
|
|
|
|
|
Navigator.of(context).pushNamed(
|
|
|
|
|
SETTINGS,
|
|
|
|
|
);
|
|
|
|
|
else
|
|
|
|
|
login();
|
|
|
|
|
}, //do something,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
// drawer: SafeArea(child: AppDrawer()),
|
|
|
|
|
// extendBody: true,
|
|
|
|
|
isShowDecPage: false,
|
|
|
|
|
changeTab: changeCurrentTab,
|
|
|
|
|
isFromLandingPage: true,
|
|
|
|
|
currentTab: widget.currentTab,
|
|
|
|
|
body: PageView(
|
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
|
controller: pageController,
|
|
|
|
@ -575,13 +569,9 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
ToDo(isShowAppBar: false),
|
|
|
|
|
], // Please do not remove the BookingOptions from this array
|
|
|
|
|
),
|
|
|
|
|
bottomNavigationBar: BottomNavBar(
|
|
|
|
|
changeIndex: changeCurrentTab,
|
|
|
|
|
index: currentTab,
|
|
|
|
|
),
|
|
|
|
|
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
|
|
|
|
floatingActionButton:
|
|
|
|
|
(projectViewModel.havePrivilege(34) && currentTab == 0)
|
|
|
|
|
(projectViewModel.havePrivilege(34) && widget.currentTab == 0)
|
|
|
|
|
? FloatingButton(
|
|
|
|
|
elevation: true,
|
|
|
|
|
onTap: () {
|
|
|
|
|