remove the custom scaffold

merge-requests/408/head
Elham Rababh 3 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 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'ProductAppBar.dart';
import 'availability_info.dart';
import 'details_info.dart';
import 'discount_description.dart';
@ -106,11 +107,12 @@ class __ProductDetailPageState extends State<ProductDetailPage>
final screenSize = MediaQuery.of(context).size;
return customerId != null
? DetailPageScafold(
? AppScaffold(
appBarTitle: TranslationBase.of(context).productDetails,
isShowAppBar: true,
isPharmacy: true,
isShowDecPage: false,
customAppBar: ProductAppBar(),
body: SingleChildScrollView(
child: Column(
children: [
@ -119,14 +121,14 @@ class __ProductDetailPageState extends State<ProductDetailPage>
color: Colors.white,
child: Column(
children: [
if(widget.product.images.isNotEmpty)
Container(
height: MediaQuery.of(context).size.height*.40,
child: Image.network(
widget.product.images[0].src.trim(),
fit: BoxFit.contain,
if (widget.product.images.isNotEmpty)
Container(
height: MediaQuery.of(context).size.height * .40,
child: Image.network(
widget.product.images[0].src.trim(),
fit: BoxFit.contain,
),
),
),
if (widget.product.discountDescription != null)
DiscountDescription(product: widget.product)
],
@ -157,7 +159,8 @@ class __ProductDetailPageState extends State<ProductDetailPage>
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: EdgeInsets.symmetric(vertical: 15, horizontal: 10),
padding: EdgeInsets.symmetric(
vertical: 15, horizontal: 10),
child: Texts(
TranslationBase.of(context).specification,
fontSize: 15,
@ -273,7 +276,9 @@ class __ProductDetailPageState extends State<ProductDetailPage>
color: Colors.white,
),
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,
),
CustomDivider(
color: isReviews ? Colors.green : Colors.transparent,
CustomDivider(
color: isReviews
? Colors.green
: Colors.transparent,
),
],
),
@ -324,8 +331,10 @@ class __ProductDetailPageState extends State<ProductDetailPage>
),
color: Colors.white,
),
CustomDivider(
color: isAvailability ? Colors.green : Colors.transparent,
CustomDivider(
color: isAvailability
? Colors.green
: Colors.transparent,
),
],
),
@ -367,7 +376,9 @@ class __ProductDetailPageState extends State<ProductDetailPage>
// ),
// 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:rating_bar/rating_bar.dart';
import 'CustomIcon.dart';
class ProductNameAndPrice extends StatefulWidget {
BuildContext context;
PharmacyProduct item;
@ -36,19 +38,25 @@ class _ProductNameAndPriceState extends State<ProductNameAndPrice> {
return Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SizedBox(height: 10,),
SizedBox(
height: 10,
),
FractionallySizedBox(
widthFactor: 0.95,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(widget.item.price.toString() + " " + "SAR",
fontWeight: FontWeight.bold, fontSize: 20
),
Texts( projectViewModel.isArabic
? widget.item.stockAvailabilityn
: widget.item.stockAvailability,
fontWeight: FontWeight.bold, fontSize: 15, color: widget.item.stockAvailability == 'Out of stock'?Colors.red:Colors.green,
fontWeight: FontWeight.bold, fontSize: 20),
Texts(
projectViewModel.isArabic
? widget.item.stockAvailabilityn
: widget.item.stockAvailability,
fontWeight: FontWeight.bold,
fontSize: 15,
color: widget.item.stockAvailability == 'Out of stock'
? Colors.red
: Colors.green,
),
// SizedBox(width: 20),
widget.item.stockAvailability == 'Out of stock' &&
@ -70,22 +78,13 @@ class _ProductNameAndPriceState extends State<ProductNameAndPrice> {
)
]),
)
: Container(
margin: projectViewModel.isArabic
? EdgeInsets.only(right: 25)
: EdgeInsets.only(left: 25),
width: 40,
height: 40,
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 {
: IconWithBg(
icon: !widget.isInWishList
? Icons.favorite_border
: Icons.favorite,
color: !widget.isInWishList ? Colors.white : Colors.red,
onPress: () async {
{
if (widget.customerId != null) {
if (!widget.isInWishList) {
GifLoaderDialogUtils.showMyDialog(context);
@ -100,8 +99,9 @@ class _ProductNameAndPriceState extends State<ProductNameAndPrice> {
return;
}
setState(() {});
},
)),
}
},
)
],
),
),
@ -132,7 +132,8 @@ class _ProductNameAndPriceState extends State<ProductNameAndPrice> {
child: Row(
children: [
RatingBar.readOnly(
initialRating:double.parse( widget.item.approvedRatingSum.toString()),
initialRating: double.parse(
widget.item.approvedRatingSum.toString()),
size: 15.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[400],
@ -141,13 +142,17 @@ class _ProductNameAndPriceState extends State<ProductNameAndPrice> {
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
SizedBox(width: 10,),
SizedBox(
width: 10,
),
Texts(
"${widget.item.approvedRatingSum}",
fontWeight: FontWeight.bold,
fontSize: 12,
),
SizedBox(width: 30,),
SizedBox(
width: 30,
),
Texts(
"(${widget.item.approvedTotalReviews}${TranslationBase.of(context).review})",
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>();
AppBarWidget appBar;
final Widget customAppBar;
AppScaffold(
{@required this.body,
this.appBarTitle = '',
@ -85,7 +87,9 @@ class AppScaffold extends StatelessWidget {
this.infoList,
this.isHelp = false,
this.showHomeAppBarIcon = true,
this.imagesInfo});
this.imagesInfo,
appBar,
this.customAppBar});
AppScaffold setOnAppBarCartClick(VoidCallback onClick) {
_onCartClick = onClick;
@ -99,16 +103,18 @@ class AppScaffold extends StatelessWidget {
backgroundColor:
backgroundColor ?? Theme.of(context).scaffoldBackgroundColor,
appBar: isShowAppBar
? appBar = AppBarWidget(
appBarTitle: appBarTitle,
appBarIcons: appBarIcons,
showHomeAppBarIcon: showHomeAppBarIcon,
isPharmacy: isPharmacy,
showPharmacyCart: showPharmacyCart,
isOfferPackages: isOfferPackages,
showOfferPackagesCart: showOfferPackagesCart,
isShowDecPage: isShowDecPage,
)
? customAppBar != null
? customAppBar
: appBar = AppBarWidget(
appBarTitle: appBarTitle,
appBarIcons: appBarIcons,
showHomeAppBarIcon: showHomeAppBarIcon,
isPharmacy: isPharmacy,
showPharmacyCart: showPharmacyCart,
isOfferPackages: isOfferPackages,
showOfferPackagesCart: showOfferPackagesCart,
isShowDecPage: isShowDecPage,
)
: null,
bottomSheet: bottomSheet,
body: SafeArea(
@ -177,6 +183,7 @@ class AppBarWidget extends StatefulWidget with PreferredSizeWidget {
}
String _badgeText = "0";
class AppBarWidgetState extends State<AppBarWidget> {
@override
Widget build(BuildContext context) {
@ -221,7 +228,8 @@ class AppBarWidgetState extends State<AppBarWidget> {
? IconButton(
icon: Badge(
shape: BadgeShape.circle,
badgeContent: Text(_badgeText, style: TextStyle(color: Colors.white)),
badgeContent:
Text(_badgeText, style: TextStyle(color: Colors.white)),
child: Icon(Icons.shopping_cart)),
color: Colors.white,
onPressed: () {
@ -365,10 +373,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