|
|
|
@ -13,8 +13,6 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.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';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/robo-search/robosearch.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/robo-search/search.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
|
|
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|
|
|
@ -48,74 +46,79 @@ class AppScaffold extends StatelessWidget {
|
|
|
|
|
final List<ImagesInfo> imagesInfo;
|
|
|
|
|
|
|
|
|
|
AuthenticatedUserObject authenticatedUserObject =
|
|
|
|
|
locator<AuthenticatedUserObject>();
|
|
|
|
|
locator<AuthenticatedUserObject>();
|
|
|
|
|
|
|
|
|
|
AppScaffold(
|
|
|
|
|
{@required this.body,
|
|
|
|
|
this.appBarTitle = '',
|
|
|
|
|
this.isLoading = false,
|
|
|
|
|
this.isShowAppBar = false,
|
|
|
|
|
this.hasAppBarParam,
|
|
|
|
|
this.bottomSheet,
|
|
|
|
|
this.baseViewModel,
|
|
|
|
|
this.floatingActionButton,
|
|
|
|
|
this.isPharmacy = false,
|
|
|
|
|
this.title,
|
|
|
|
|
this.description,
|
|
|
|
|
this.isShowDecPage = true,
|
|
|
|
|
this.isBottomBar,
|
|
|
|
|
this.backgroundColor,
|
|
|
|
|
this.preferredSize = 0.0,
|
|
|
|
|
this.appBarIcons,
|
|
|
|
|
this.infoList, this.imagesInfo});
|
|
|
|
|
this.appBarTitle = '',
|
|
|
|
|
this.isLoading = false,
|
|
|
|
|
this.isShowAppBar = false,
|
|
|
|
|
this.hasAppBarParam,
|
|
|
|
|
this.bottomSheet,
|
|
|
|
|
this.baseViewModel,
|
|
|
|
|
this.floatingActionButton,
|
|
|
|
|
this.isPharmacy = false,
|
|
|
|
|
this.title,
|
|
|
|
|
this.description,
|
|
|
|
|
this.isShowDecPage = true,
|
|
|
|
|
this.isBottomBar,
|
|
|
|
|
this.backgroundColor,
|
|
|
|
|
this.preferredSize = 0.0,
|
|
|
|
|
this.appBarIcons,
|
|
|
|
|
this.infoList,
|
|
|
|
|
this.imagesInfo});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
AppGlobal.context = context;
|
|
|
|
|
return Scaffold(
|
|
|
|
|
backgroundColor:
|
|
|
|
|
backgroundColor ?? Theme.of(context).scaffoldBackgroundColor,
|
|
|
|
|
appBar: isShowAppBar? AppBarWidget(
|
|
|
|
|
appBarTitle:appBarTitle,
|
|
|
|
|
appBarIcons:appBarIcons,
|
|
|
|
|
isPharmacy: isPharmacy,
|
|
|
|
|
isShowDecPage: isShowDecPage,
|
|
|
|
|
):null,
|
|
|
|
|
backgroundColor ?? Theme.of(context).scaffoldBackgroundColor,
|
|
|
|
|
appBar: isShowAppBar
|
|
|
|
|
? AppBarWidget(
|
|
|
|
|
appBarTitle: appBarTitle,
|
|
|
|
|
appBarIcons: appBarIcons,
|
|
|
|
|
isPharmacy: isPharmacy,
|
|
|
|
|
isShowDecPage: isShowDecPage,
|
|
|
|
|
)
|
|
|
|
|
: null,
|
|
|
|
|
bottomSheet: bottomSheet,
|
|
|
|
|
body: (!Provider.of<ProjectViewModel>(context, listen: false).isLogin &&
|
|
|
|
|
isShowDecPage)
|
|
|
|
|
isShowDecPage)
|
|
|
|
|
? NotAutPage(
|
|
|
|
|
title: title ?? appBarTitle,
|
|
|
|
|
description: description,
|
|
|
|
|
infoList: infoList,
|
|
|
|
|
imagesInfo: imagesInfo,
|
|
|
|
|
)
|
|
|
|
|
title: title ?? appBarTitle,
|
|
|
|
|
description: description,
|
|
|
|
|
infoList: infoList,
|
|
|
|
|
imagesInfo: imagesInfo,
|
|
|
|
|
)
|
|
|
|
|
: baseViewModel != null
|
|
|
|
|
? NetworkBaseView(
|
|
|
|
|
child: body,
|
|
|
|
|
baseViewModel: baseViewModel,
|
|
|
|
|
)
|
|
|
|
|
: body,
|
|
|
|
|
? NetworkBaseView(
|
|
|
|
|
child: body,
|
|
|
|
|
baseViewModel: baseViewModel,
|
|
|
|
|
)
|
|
|
|
|
: body,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
buildAppLoaderWidget(bool isLoading) {
|
|
|
|
|
return isLoading ? AppLoaderWidget() : Container();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class AppBarWidget extends StatelessWidget with PreferredSizeWidget {
|
|
|
|
|
final AuthenticatedUserObject authenticatedUserObject =
|
|
|
|
|
locator<AuthenticatedUserObject>();
|
|
|
|
|
locator<AuthenticatedUserObject>();
|
|
|
|
|
|
|
|
|
|
final String appBarTitle;
|
|
|
|
|
final List<Widget> appBarIcons;
|
|
|
|
|
final bool isPharmacy;
|
|
|
|
|
final bool isShowDecPage;
|
|
|
|
|
|
|
|
|
|
AppBarWidget({this.appBarTitle, this.appBarIcons,
|
|
|
|
|
this.isPharmacy = true, this.isShowDecPage = true});
|
|
|
|
|
AppBarWidget(
|
|
|
|
|
{this.appBarTitle,
|
|
|
|
|
this.appBarIcons,
|
|
|
|
|
this.isPharmacy = true,
|
|
|
|
|
this.isShowDecPage = true});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
@ -127,10 +130,9 @@ class AppBarWidget extends StatelessWidget with PreferredSizeWidget {
|
|
|
|
|
return AppBar(
|
|
|
|
|
elevation: 0,
|
|
|
|
|
backgroundColor:
|
|
|
|
|
isPharmacy ? Colors.green : Theme.of(context).appBarTheme.color,
|
|
|
|
|
isPharmacy ? Colors.green : Theme.of(context).appBarTheme.color,
|
|
|
|
|
textTheme: TextTheme(
|
|
|
|
|
headline6:
|
|
|
|
|
TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
|
|
|
|
|
headline6: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
|
|
|
|
|
),
|
|
|
|
|
title: Text(
|
|
|
|
|
authenticatedUserObject.isLogin || !isShowDecPage
|
|
|
|
@ -139,8 +141,7 @@ class AppBarWidget extends StatelessWidget with PreferredSizeWidget {
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontFamily:
|
|
|
|
|
projectViewModel.isArabic ? 'Cairo' : 'WorkSans')),
|
|
|
|
|
fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans')),
|
|
|
|
|
leading: Builder(
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
return ArrowBack();
|
|
|
|
@ -150,27 +151,24 @@ class AppBarWidget extends StatelessWidget with PreferredSizeWidget {
|
|
|
|
|
actions: <Widget>[
|
|
|
|
|
isPharmacy
|
|
|
|
|
? IconButton(
|
|
|
|
|
icon: Icon(Icons.shopping_cart),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.of(context)
|
|
|
|
|
.popUntil(ModalRoute.withName('/'));
|
|
|
|
|
})
|
|
|
|
|
icon: Icon(Icons.shopping_cart),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.of(context).popUntil(ModalRoute.withName('/'));
|
|
|
|
|
})
|
|
|
|
|
: Container(),
|
|
|
|
|
IconButton(
|
|
|
|
|
IconButton(
|
|
|
|
|
icon: Icon(FontAwesomeIcons.home),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.pushAndRemoveUntil(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) => LandingPage()),
|
|
|
|
|
(Route<dynamic> r) => false);
|
|
|
|
|
MaterialPageRoute(builder: (context) => LandingPage()),
|
|
|
|
|
(Route<dynamic> r) => false);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
if (appBarIcons != null) ...appBarIcons
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|