remove the custom scaffold

merge-update-with-lab-changes
Elham Rababh 4 years ago
parent e20e90c20c
commit bb96201c2e

@ -0,0 +1,29 @@
import 'package:flutter/material.dart';
class IconWithBg extends StatelessWidget {
final IconData icon;
final Color color;
final Function onPress;
const IconWithBg({Key key, this.icon, this.color, this.onPress})
: super(key: key);
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.only(left: 25),
width: 40,
height: 40,
decoration: BoxDecoration(
color: Colors.grey[300],
borderRadius: BorderRadius.circular(30),
),
child: IconButton(
icon: Icon(icon),
color: color,
onPressed: () async {
onPress();
},
));
}
}

@ -0,0 +1,66 @@
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import '../cart-order-page.dart';
import 'CustomIcon.dart';
class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
@override
Widget build(BuildContext context) {
return Container(
color: Colors.white,
child: Column(
children: [
SizedBox(
height: 30,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
IconWithBg(
icon: Icons.arrow_back_ios,
color: Colors.grey,
onPress: () {
Navigator.pop(context);
},
),
],
),
Row(
children: [
IconWithBg(
icon: Icons.shopping_cart,
color: Colors.grey,
onPress: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => CartOrderPage()),
);
}),
IconWithBg(
icon: FontAwesomeIcons.ellipsisV,
color: Colors.grey,
onPress: () {
//TODO Elham*
// settingModalBottomSheet(context);
},
),
],
)
],
),
],
),
);
}
@override
// TODO: implement preferredSize
@override
Size get preferredSize => Size(double.maxFinite, 50);
}

@ -25,6 +25,7 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_mo
import '../cart-order-page.dart'; import '../cart-order-page.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'ProductAppBar.dart';
import 'availability_info.dart'; import 'availability_info.dart';
import 'details_info.dart'; import 'details_info.dart';
import 'discount_description.dart'; import 'discount_description.dart';
@ -106,11 +107,12 @@ class __ProductDetailPageState extends State<ProductDetailPage>
final screenSize = MediaQuery.of(context).size; final screenSize = MediaQuery.of(context).size;
return customerId != null return customerId != null
? DetailPageScafold( ? AppScaffold(
appBarTitle: TranslationBase.of(context).productDetails, appBarTitle: TranslationBase.of(context).productDetails,
isShowAppBar: true, isShowAppBar: true,
isPharmacy: true, isPharmacy: true,
isShowDecPage: false, isShowDecPage: false,
customAppBar: ProductAppBar(),
body: SingleChildScrollView( body: SingleChildScrollView(
child: Column( child: Column(
children: [ children: [
@ -119,14 +121,14 @@ class __ProductDetailPageState extends State<ProductDetailPage>
color: Colors.white, color: Colors.white,
child: Column( child: Column(
children: [ children: [
if(widget.product.images.isNotEmpty) if (widget.product.images.isNotEmpty)
Container( Container(
height: MediaQuery.of(context).size.height*.40, height: MediaQuery.of(context).size.height * .40,
child: Image.network( child: Image.network(
widget.product.images[0].src.trim(), widget.product.images[0].src.trim(),
fit: BoxFit.contain, fit: BoxFit.contain,
),
), ),
),
if (widget.product.discountDescription != null) if (widget.product.discountDescription != null)
DiscountDescription(product: widget.product) DiscountDescription(product: widget.product)
], ],
@ -157,7 +159,8 @@ class __ProductDetailPageState extends State<ProductDetailPage>
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Container(
padding: EdgeInsets.symmetric(vertical: 15, horizontal: 10), padding: EdgeInsets.symmetric(
vertical: 15, horizontal: 10),
child: Texts( child: Texts(
TranslationBase.of(context).specification, TranslationBase.of(context).specification,
fontSize: 15, fontSize: 15,
@ -273,7 +276,9 @@ class __ProductDetailPageState extends State<ProductDetailPage>
color: Colors.white, color: Colors.white,
), ),
CustomDivider( CustomDivider(
color: isDetails ? Colors.green : Colors.transparent, color: isDetails
? Colors.green
: Colors.transparent,
) )
], ],
), ),
@ -298,8 +303,10 @@ class __ProductDetailPageState extends State<ProductDetailPage>
), ),
color: Colors.white, color: Colors.white,
), ),
CustomDivider( CustomDivider(
color: isReviews ? Colors.green : Colors.transparent, color: isReviews
? Colors.green
: Colors.transparent,
), ),
], ],
), ),
@ -324,8 +331,10 @@ class __ProductDetailPageState extends State<ProductDetailPage>
), ),
color: Colors.white, color: Colors.white,
), ),
CustomDivider( CustomDivider(
color: isAvailability ? Colors.green : Colors.transparent, color: isAvailability
? Colors.green
: Colors.transparent,
), ),
], ],
), ),
@ -367,7 +376,9 @@ class __ProductDetailPageState extends State<ProductDetailPage>
// ), // ),
// RecommendedProducts(product: widget.product) // RecommendedProducts(product: widget.product)
SizedBox(height: 80,) SizedBox(
height: 80,
)
], ],
), ),
), ),

@ -8,6 +8,8 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart'; import 'package:rating_bar/rating_bar.dart';
import 'CustomIcon.dart';
class ProductNameAndPrice extends StatefulWidget { class ProductNameAndPrice extends StatefulWidget {
BuildContext context; BuildContext context;
PharmacyProduct item; PharmacyProduct item;
@ -36,19 +38,25 @@ class _ProductNameAndPriceState extends State<ProductNameAndPrice> {
return Column( return Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
SizedBox(height: 10,), SizedBox(
height: 10,
),
FractionallySizedBox( FractionallySizedBox(
widthFactor: 0.95, widthFactor: 0.95,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Texts(widget.item.price.toString() + " " + "SAR", Texts(widget.item.price.toString() + " " + "SAR",
fontWeight: FontWeight.bold, fontSize: 20 fontWeight: FontWeight.bold, fontSize: 20),
), Texts(
Texts( projectViewModel.isArabic projectViewModel.isArabic
? widget.item.stockAvailabilityn ? widget.item.stockAvailabilityn
: widget.item.stockAvailability, : widget.item.stockAvailability,
fontWeight: FontWeight.bold, fontSize: 15, color: widget.item.stockAvailability == 'Out of stock'?Colors.red:Colors.green, fontWeight: FontWeight.bold,
fontSize: 15,
color: widget.item.stockAvailability == 'Out of stock'
? Colors.red
: Colors.green,
), ),
// SizedBox(width: 20), // SizedBox(width: 20),
widget.item.stockAvailability == 'Out of stock' && widget.item.stockAvailability == 'Out of stock' &&
@ -70,22 +78,13 @@ class _ProductNameAndPriceState extends State<ProductNameAndPrice> {
) )
]), ]),
) )
: Container( : IconWithBg(
margin: projectViewModel.isArabic icon: !widget.isInWishList
? EdgeInsets.only(right: 25) ? Icons.favorite_border
: EdgeInsets.only(left: 25), : Icons.favorite,
width: 40, color: !widget.isInWishList ? Colors.white : Colors.red,
height: 40, onPress: () async {
decoration: BoxDecoration( {
color: Colors.grey[300],
borderRadius: BorderRadius.circular(30),
),
child: IconButton(
icon: Icon(!widget.isInWishList
? Icons.favorite_border
: Icons.favorite),
color: !widget.isInWishList ? Colors.white : Colors.red,
onPressed: () async {
if (widget.customerId != null) { if (widget.customerId != null) {
if (!widget.isInWishList) { if (!widget.isInWishList) {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
@ -100,8 +99,9 @@ class _ProductNameAndPriceState extends State<ProductNameAndPrice> {
return; return;
} }
setState(() {}); setState(() {});
}, }
)), },
)
], ],
), ),
), ),
@ -132,7 +132,8 @@ class _ProductNameAndPriceState extends State<ProductNameAndPrice> {
child: Row( child: Row(
children: [ children: [
RatingBar.readOnly( RatingBar.readOnly(
initialRating:double.parse( widget.item.approvedRatingSum.toString()), initialRating: double.parse(
widget.item.approvedRatingSum.toString()),
size: 15.0, size: 15.0,
filledColor: Colors.yellow[700], filledColor: Colors.yellow[700],
emptyColor: Colors.grey[400], emptyColor: Colors.grey[400],
@ -141,13 +142,17 @@ class _ProductNameAndPriceState extends State<ProductNameAndPrice> {
filledIcon: Icons.star, filledIcon: Icons.star,
emptyIcon: Icons.star, emptyIcon: Icons.star,
), ),
SizedBox(width: 10,), SizedBox(
width: 10,
),
Texts( Texts(
"${widget.item.approvedRatingSum}", "${widget.item.approvedRatingSum}",
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 12, fontSize: 12,
), ),
SizedBox(width: 30,), SizedBox(
width: 30,
),
Texts( Texts(
"(${widget.item.approvedTotalReviews}${TranslationBase.of(context).review})", "(${widget.item.approvedTotalReviews}${TranslationBase.of(context).review})",
fontSize: 12, fontSize: 12,
@ -178,7 +183,9 @@ class _ProductNameAndPriceState extends State<ProductNameAndPrice> {
], ],
), ),
), ),
SizedBox(height: 10,), SizedBox(
height: 10,
),
], ],
); );
} }

@ -62,6 +62,8 @@ class AppScaffold extends StatelessWidget {
locator<AuthenticatedUserObject>(); locator<AuthenticatedUserObject>();
AppBarWidget appBar; AppBarWidget appBar;
final Widget customAppBar;
AppScaffold( AppScaffold(
{@required this.body, {@required this.body,
this.appBarTitle = '', this.appBarTitle = '',
@ -85,7 +87,9 @@ class AppScaffold extends StatelessWidget {
this.infoList, this.infoList,
this.isHelp = false, this.isHelp = false,
this.showHomeAppBarIcon = true, this.showHomeAppBarIcon = true,
this.imagesInfo}); this.imagesInfo,
appBar,
this.customAppBar});
AppScaffold setOnAppBarCartClick(VoidCallback onClick) { AppScaffold setOnAppBarCartClick(VoidCallback onClick) {
_onCartClick = onClick; _onCartClick = onClick;
@ -99,16 +103,18 @@ class AppScaffold extends StatelessWidget {
backgroundColor: backgroundColor:
backgroundColor ?? Theme.of(context).scaffoldBackgroundColor, backgroundColor ?? Theme.of(context).scaffoldBackgroundColor,
appBar: isShowAppBar appBar: isShowAppBar
? appBar = AppBarWidget( ? customAppBar != null
appBarTitle: appBarTitle, ? customAppBar
appBarIcons: appBarIcons, : appBar = AppBarWidget(
showHomeAppBarIcon: showHomeAppBarIcon, appBarTitle: appBarTitle,
isPharmacy: isPharmacy, appBarIcons: appBarIcons,
showPharmacyCart: showPharmacyCart, showHomeAppBarIcon: showHomeAppBarIcon,
isOfferPackages: isOfferPackages, isPharmacy: isPharmacy,
showOfferPackagesCart: showOfferPackagesCart, showPharmacyCart: showPharmacyCart,
isShowDecPage: isShowDecPage, isOfferPackages: isOfferPackages,
) showOfferPackagesCart: showOfferPackagesCart,
isShowDecPage: isShowDecPage,
)
: null, : null,
bottomSheet: bottomSheet, bottomSheet: bottomSheet,
body: SafeArea( body: SafeArea(
@ -177,6 +183,7 @@ class AppBarWidget extends StatefulWidget with PreferredSizeWidget {
} }
String _badgeText = "0"; String _badgeText = "0";
class AppBarWidgetState extends State<AppBarWidget> { class AppBarWidgetState extends State<AppBarWidget> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -221,7 +228,8 @@ class AppBarWidgetState extends State<AppBarWidget> {
? IconButton( ? IconButton(
icon: Badge( icon: Badge(
shape: BadgeShape.circle, shape: BadgeShape.circle,
badgeContent: Text(_badgeText, style: TextStyle(color: Colors.white)), badgeContent:
Text(_badgeText, style: TextStyle(color: Colors.white)),
child: Icon(Icons.shopping_cart)), child: Icon(Icons.shopping_cart)),
color: Colors.white, color: Colors.white,
onPressed: () { onPressed: () {
@ -365,10 +373,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