first step from add footer for all pages

merge-update-with-lab-changes
Elham Rababh 5 years ago
parent 57864f949d
commit 8626b4f269

@ -32,6 +32,8 @@ class _BookingOptionsState extends State<BookingOptions> {
return AppScaffold( return AppScaffold(
isShowAppBar: widget.isAppbar, isShowAppBar: widget.isAppbar,
isShowDecPage: false, isShowDecPage: false,
isShowBottomNavBar: false,
appBarTitle: TranslationBase.of(context).bookAppo, appBarTitle: TranslationBase.of(context).bookAppo,
body: Container( body: Container(
margin: EdgeInsets.fromLTRB(10.0, 20.0, 10.0, 10.0), margin: EdgeInsets.fromLTRB(10.0, 20.0, 10.0, 10.0),

@ -92,6 +92,8 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
isShowAppBar: widget.isAppbarVisible, isShowAppBar: widget.isAppbarVisible,
imagesInfo: imagesInfo, imagesInfo: imagesInfo,
description: TranslationBase.of(context).familyInfo, description: TranslationBase.of(context).familyInfo,
isShowBottomNavBar: false,
body: Scaffold( body: Scaffold(
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
appBar: PreferredSize( appBar: PreferredSize(

@ -81,6 +81,8 @@ class _ToDoState extends State<ToDo> {
isShowAppBar: widget.isShowAppBar, isShowAppBar: widget.isShowAppBar,
isShowDecPage: true, isShowDecPage: true,
description: TranslationBase.of(context).infoTodo, description: TranslationBase.of(context).infoTodo,
isShowBottomNavBar: false,
body: SingleChildScrollView( body: SingleChildScrollView(
child: Column( child: Column(
children: <Widget>[ children: <Widget>[

@ -51,6 +51,7 @@ class _HomePageState extends State<HomePage> {
builder: (_, model, wi) => AppScaffold( builder: (_, model, wi) => AppScaffold(
isShowDecPage: false, isShowDecPage: false,
isHelp: true, isHelp: true,
isShowBottomNavBar: false,
body: Container( body: Container(
width: double.infinity, width: double.infinity,
child: SingleChildScrollView( child: SingleChildScrollView(

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

@ -72,6 +72,8 @@ class _MedicalProfilePageState extends State<MedicalProfilePage> {
isShowDecPage: false, isShowDecPage: false,
baseViewModel: model, baseViewModel: model,
isHelp: true, isHelp: true,
isShowBottomNavBar: false,
body: Container( body: Container(
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(

@ -12,7 +12,9 @@ import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.da
import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/routes.dart';
import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/bottom_navigation/bottom_nav_bar.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/drawer/app_drawer_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/bottom_bar.dart'; import 'package:diplomaticquarterapp/widgets/others/bottom_bar.dart';
import 'package:diplomaticquarterapp/widgets/progress_indicator/app_loader_widget.dart'; import 'package:diplomaticquarterapp/widgets/progress_indicator/app_loader_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
@ -44,6 +46,7 @@ class AppScaffold extends StatelessWidget {
final BaseViewModel baseViewModel; final BaseViewModel baseViewModel;
final bool isBottomBar; final bool isBottomBar;
final Widget floatingActionButton; final Widget floatingActionButton;
final FloatingActionButtonLocation floatingActionButtonLocation;
final bool isPharmacy; final bool isPharmacy;
final bool isOfferPackages; final bool isOfferPackages;
final bool showPharmacyCart; final bool showPharmacyCart;
@ -58,10 +61,19 @@ class AppScaffold extends StatelessWidget {
final List<Widget> appBarIcons; final List<Widget> appBarIcons;
final List<ImagesInfo> imagesInfo; final List<ImagesInfo> imagesInfo;
final bool isHelp; final bool isHelp;
final int currentTab;
final bool isShowBottomNavBar;
final bool isFromLandingPage;
final bool isShowDrawer;
final Function(int tab) changeTab;
final Widget leading;
AuthenticatedUserObject authenticatedUserObject = AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>(); locator<AuthenticatedUserObject>();
AppBarWidget appBar; AppBarWidget appBar;
AppScaffold( AppScaffold(
{@required this.body, {@required this.body,
this.appBarTitle = '', this.appBarTitle = '',
@ -85,7 +97,14 @@ class AppScaffold extends StatelessWidget {
this.infoList, this.infoList,
this.isHelp = false, this.isHelp = false,
this.showHomeAppBarIcon = true, this.showHomeAppBarIcon = true,
this.imagesInfo}); this.imagesInfo,
this.currentTab,
this.isShowBottomNavBar = true,
this.isFromLandingPage = false,
this.changeTab,
this.floatingActionButtonLocation,
this.leading,
this.isShowDrawer = false});
AppScaffold setOnAppBarCartClick(VoidCallback onClick) { AppScaffold setOnAppBarCartClick(VoidCallback onClick) {
_onCartClick = onClick; _onCartClick = onClick;
@ -98,6 +117,7 @@ class AppScaffold extends StatelessWidget {
return Scaffold( return Scaffold(
backgroundColor: backgroundColor:
backgroundColor ?? Theme.of(context).scaffoldBackgroundColor, backgroundColor ?? Theme.of(context).scaffoldBackgroundColor,
drawer: isShowDrawer ? SafeArea(child: AppDrawer()) : null,
appBar: isShowAppBar appBar: isShowAppBar
? appBar = AppBarWidget( ? appBar = AppBarWidget(
appBarTitle: appBarTitle, appBarTitle: appBarTitle,
@ -108,9 +128,16 @@ class AppScaffold extends StatelessWidget {
isOfferPackages: isOfferPackages, isOfferPackages: isOfferPackages,
showOfferPackagesCart: showOfferPackagesCart, showOfferPackagesCart: showOfferPackagesCart,
isShowDecPage: isShowDecPage, isShowDecPage: isShowDecPage,
leading: leading,
) )
: null, : null,
bottomSheet: bottomSheet, bottomSheet: bottomSheet,
bottomNavigationBar: isShowBottomNavBar
? BottomNavBar(
changeIndex: changeCurrentTab,
index: currentTab,
)
: null,
body: SafeArea( body: SafeArea(
top: true, top: true,
bottom: true, bottom: true,
@ -131,6 +158,7 @@ class AppScaffold extends StatelessWidget {
: buildBodyWidget(context), : buildBodyWidget(context),
), ),
floatingActionButton: floatingActionButton, floatingActionButton: floatingActionButton,
floatingActionButtonLocation: floatingActionButtonLocation,
); );
} }
@ -142,6 +170,20 @@ class AppScaffold extends StatelessWidget {
return Stack( return Stack(
children: <Widget>[body, isHelp == true ? RobotIcon() : Container()]); children: <Widget>[body, isHelp == true ? RobotIcon() : Container()]);
} }
void changeCurrentTab(int value) {
if (isFromLandingPage) {
changeTab(value);
// call the nav funcion
} else {
// navigate to langing page with index
Navigator.pushAndRemoveUntil(
AppGlobal.context,
MaterialPageRoute(
builder: (context) => LandingPage(currentTabLocal: value)),
(Route<dynamic> r) => false);
}
}
} }
class AppBarWidget extends StatefulWidget with PreferredSizeWidget { class AppBarWidget extends StatefulWidget with PreferredSizeWidget {
@ -159,6 +201,8 @@ class AppBarWidget extends StatefulWidget with PreferredSizeWidget {
Function(String) badgeUpdater; Function(String) badgeUpdater;
final Widget leading;
AppBarWidget( AppBarWidget(
{this.appBarTitle, {this.appBarTitle,
this.showHomeAppBarIcon, this.showHomeAppBarIcon,
@ -167,7 +211,8 @@ class AppBarWidget extends StatefulWidget with PreferredSizeWidget {
this.showPharmacyCart = true, this.showPharmacyCart = true,
this.isOfferPackages = false, this.isOfferPackages = false,
this.showOfferPackagesCart = false, this.showOfferPackagesCart = false,
this.isShowDecPage = true}); this.isShowDecPage = true,
this.leading});
@override @override
State<StatefulWidget> createState() => AppBarWidgetState(); State<StatefulWidget> createState() => AppBarWidgetState();
@ -178,6 +223,7 @@ class AppBarWidget extends StatefulWidget with PreferredSizeWidget {
class AppBarWidgetState extends State<AppBarWidget> { class AppBarWidgetState extends State<AppBarWidget> {
String badgeText = "0"; String badgeText = "0";
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
widget.badgeUpdater = badgeUpdateBlock; widget.badgeUpdater = badgeUpdateBlock;
@ -210,11 +256,12 @@ class AppBarWidgetState extends State<AppBarWidget> {
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Theme.of(context).textTheme.headline1.color, color: Theme.of(context).textTheme.headline1.color,
fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans')), fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans')),
leading: Builder( leading: widget.leading ??
builder: (BuildContext context) { Builder(
return ArrowBack(); builder: (BuildContext context) {
}, return ArrowBack();
), },
),
centerTitle: true, centerTitle: true,
actions: <Widget>[ actions: <Widget>[
(widget.isPharmacy && widget.showPharmacyCart) (widget.isPharmacy && widget.showPharmacyCart)
@ -364,10 +411,10 @@ class _RobotIcon extends State<RobotIcon> {
bottom: -15); bottom: -15);
} }
// setAnimation() async { // setAnimation() async {
// /// await sharedPref.getBool(IS_ROBOT_VISIBLE) || // /// await sharedPref.getBool(IS_ROBOT_VISIBLE) ||
// // var animation = // // var animation =
// // IS_TEXT_COMPLETED == ? true : false; // // IS_TEXT_COMPLETED == ? true : false;
// } // }
} }

Loading…
Cancel
Save