merge-requests/296/head
Sultan Khan 4 years ago
parent f2c5c93e2a
commit 8e255f1f22

@ -87,7 +87,7 @@ class AppScaffold extends StatelessWidget {
this.showHomeAppBarIcon = true, this.showHomeAppBarIcon = true,
this.imagesInfo}); this.imagesInfo});
AppScaffold setOnAppBarCartClick(VoidCallback onClick){ AppScaffold setOnAppBarCartClick(VoidCallback onClick) {
_onCartClick = onClick; _onCartClick = onClick;
return this; return this;
} }
@ -112,21 +112,23 @@ class AppScaffold extends StatelessWidget {
: null, : null,
bottomSheet: bottomSheet, bottomSheet: bottomSheet,
body: SafeArea( body: SafeArea(
top: true, bottom: true, top: true,
child: (!Provider.of<ProjectViewModel>(context, listen: false).isLogin && bottom: true,
isShowDecPage) child:
? NotAutPage( (!Provider.of<ProjectViewModel>(context, listen: false).isLogin &&
title: title ?? appBarTitle, isShowDecPage)
description: description, ? NotAutPage(
infoList: infoList, title: title ?? appBarTitle,
imagesInfo: imagesInfo, description: description,
) infoList: infoList,
: baseViewModel != null imagesInfo: imagesInfo,
? NetworkBaseView( )
child: buildBodyWidget(context), : baseViewModel != null
baseViewModel: baseViewModel, ? NetworkBaseView(
) child: buildBodyWidget(context),
: buildBodyWidget(context), baseViewModel: baseViewModel,
)
: buildBodyWidget(context),
), ),
); );
} }
@ -173,8 +175,7 @@ class AppBarWidget extends StatefulWidget with PreferredSizeWidget {
Size get preferredSize => Size(double.maxFinite, 60); Size get preferredSize => Size(double.maxFinite, 60);
} }
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) {
@ -182,7 +183,7 @@ class AppBarWidgetState extends State<AppBarWidget>{
return buildAppBar(context); return buildAppBar(context);
} }
badgeUpdateBlock(String value){ badgeUpdateBlock(String value) {
setState(() { setState(() {
badgeText = value; badgeText = value;
}); });
@ -192,8 +193,9 @@ class AppBarWidgetState extends State<AppBarWidget>{
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return AppBar( return AppBar(
elevation: 0, elevation: 0,
backgroundColor: backgroundColor: widget.isPharmacy
widget.isPharmacy ? Colors.green : Theme.of(context).appBarTheme.color, ? Colors.green
: Theme.of(context).appBarTheme.color,
textTheme: TextTheme( textTheme: TextTheme(
headline6: TextStyle( headline6: TextStyle(
color: Theme.of(context).textTheme.headline1.color, color: Theme.of(context).textTheme.headline1.color,
@ -216,38 +218,32 @@ class AppBarWidgetState extends State<AppBarWidget>{
actions: <Widget>[ actions: <Widget>[
(widget.isPharmacy && widget.showPharmacyCart) (widget.isPharmacy && widget.showPharmacyCart)
? IconButton( ? IconButton(
icon: Badge( icon: Badge(
badgeContent: Text( badgeContent: Text(badgeText),
badgeText child: Icon(Icons.shopping_cart)),
), color: Colors.white,
child: Icon(Icons.shopping_cart) onPressed: () {
), Navigator.of(context).popUntil(ModalRoute.withName('/'));
color: Colors.white, })
onPressed: () {
Navigator.of(context).popUntil(ModalRoute.withName('/'));
})
: Container(), : Container(),
(widget.isOfferPackages && widget.showOfferPackagesCart) (widget.isOfferPackages && widget.showOfferPackagesCart)
? IconButton( ? IconButton(
icon: Badge( icon: Badge(
position: BadgePosition.topStart(top: -15, start: -10),
position: BadgePosition.topStart(top: -15,start: -10), badgeContent: Text(
badgeContent: Text( badgeText,
badgeText, style: TextStyle(
style: TextStyle(fontSize: 9,color: Colors.white, fontWeight: FontWeight.normal), fontSize: 9,
), color: Colors.white,
child: Icon(Icons.shopping_cart) fontWeight: FontWeight.normal),
), ),
color: Colors.white, child: Icon(Icons.shopping_cart)),
onPressed: () { color: Colors.white,
// Cart Click Event onPressed: () {
if(_onCartClick != null) // Cart Click Event
_onCartClick(); if (_onCartClick != null) _onCartClick();
})
})
: Container(), : Container(),
if (widget.showHomeAppBarIcon) if (widget.showHomeAppBarIcon)
IconButton( IconButton(
icon: Icon(FontAwesomeIcons.home), icon: Icon(FontAwesomeIcons.home),
@ -256,11 +252,10 @@ class AppBarWidgetState extends State<AppBarWidget>{
Navigator.pushAndRemoveUntil( Navigator.pushAndRemoveUntil(
context, context,
MaterialPageRoute(builder: (context) => LandingPage()), MaterialPageRoute(builder: (context) => LandingPage()),
(Route<dynamic> r) => false); (Route<dynamic> r) => false);
// Cart Click Event // Cart Click Event
if(_onCartClick != null) if (_onCartClick != null) _onCartClick();
_onCartClick();
}, },
), ),
if (widget.appBarIcons != null) ...widget.appBarIcons if (widget.appBarIcons != null) ...widget.appBarIcons
@ -356,7 +351,7 @@ class _RobotIcon extends State<RobotIcon> {
], ],
), ),
right: -30, right: -30,
bottom: 50); bottom: -15);
} }
// setAnimation() async { // setAnimation() async {

Loading…
Cancel
Save