first step from add footer for all pages

merge-requests/369/head
Elham Rababh 3 years ago
parent 57864f949d
commit 8626b4f269

@ -32,6 +32,8 @@ class _BookingOptionsState extends State<BookingOptions> {
return AppScaffold(
isShowAppBar: widget.isAppbar,
isShowDecPage: false,
isShowBottomNavBar: false,
appBarTitle: TranslationBase.of(context).bookAppo,
body: Container(
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,
imagesInfo: imagesInfo,
description: TranslationBase.of(context).familyInfo,
isShowBottomNavBar: false,
body: Scaffold(
extendBodyBehindAppBar: true,
appBar: PreferredSize(

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

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

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

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

Loading…
Cancel
Save