first step from product details

merge-update-with-lab-changes
Elham Rababh 4 years ago
parent 34596163d1
commit a71e7e4075

@ -1734,4 +1734,6 @@ const Map localizedValues = {
"points": {"en": "Points", "ar": "نقاط"}, "points": {"en": "Points", "ar": "نقاط"},
"availableBalance": {"en": "Available Balance", "ar": "الرصيد المتوفر"}, "availableBalance": {"en": "Available Balance", "ar": "الرصيد المتوفر"},
"ordersDashboard": {"en": "My Orders", "ar": "طلباتي"}, "ordersDashboard": {"en": "My Orders", "ar": "طلباتي"},
"productOutOfStock": {"en": "Out Of Stock", "ar": "إنتهى من المخزن"},
}; };

@ -28,8 +28,13 @@ class FooterWidget extends StatefulWidget {
int quantity; int quantity;
bool isOverQuantity; bool isOverQuantity;
FooterWidget(this.isAvailable, this.maxQuantity, this.minQuantity, this.quantityLimit, this.item, FooterWidget(this.isAvailable, this.maxQuantity, this.minQuantity,
{this.quantity, this.isOverQuantity = false, this.addToCartFunction, this.addToShoppingCartFunction, this.model}); this.quantityLimit, this.item,
{this.quantity,
this.isOverQuantity = false,
this.addToCartFunction,
this.addToShoppingCartFunction,
this.model});
@override @override
_FooterWidgetState createState() => _FooterWidgetState(); _FooterWidgetState createState() => _FooterWidgetState();
@ -38,7 +43,8 @@ class FooterWidget extends StatefulWidget {
class _FooterWidgetState extends State<FooterWidget> { class _FooterWidgetState extends State<FooterWidget> {
double quantityUI = 80; double quantityUI = 80;
bool showUI = false; bool showUI = false;
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>(); AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
AppSharedPreferences sharedPref = new AppSharedPreferences(); AppSharedPreferences sharedPref = new AppSharedPreferences();
@override @override
@ -74,7 +80,8 @@ class _FooterWidgetState extends State<FooterWidget> {
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Text( child: Text(
TranslationBase.of(context).quantity, TranslationBase.of(context).quantity,
style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold), style: TextStyle(
fontSize: 15, fontWeight: FontWeight.bold),
), ),
), ),
InkWell( InkWell(
@ -97,7 +104,11 @@ class _FooterWidgetState extends State<FooterWidget> {
SizedBox( SizedBox(
width: 5, width: 5,
), ),
for (int i = 1; i <= 10; i++) QuantityBox(label: i, onTapFunc: onChangeValue, isSelected: widget.quantity == i), for (int i = 1; i <= 10; i++)
QuantityBox(
label: i,
onTapFunc: onChangeValue,
isSelected: widget.quantity == i),
Container( Container(
width: 100, width: 100,
decoration: BoxDecoration( decoration: BoxDecoration(
@ -105,14 +116,16 @@ class _FooterWidgetState extends State<FooterWidget> {
color: Colors.white, color: Colors.white,
), ),
child: TextField( child: TextField(
decoration: InputDecoration(labelText: ' Quantity # '), decoration: InputDecoration(
labelText: ' Quantity # '),
onChanged: (text) { onChanged: (text) {
if (int.tryParse(text) == null) { if (int.tryParse(text) == null) {
text = ''; text = '';
} else { } else {
setState(() { setState(() {
widget.quantity = int.parse(text); widget.quantity = int.parse(text);
if (widget.quantity >= widget.quantityLimit) { if (widget.quantity >=
widget.quantityLimit) {
widget.isOverQuantity = true; widget.isOverQuantity = true;
} else { } else {
widget.isOverQuantity = false; widget.isOverQuantity = false;
@ -133,7 +146,7 @@ class _FooterWidgetState extends State<FooterWidget> {
height: 20, height: 20,
), ),
Container( Container(
height: 55, height: 58,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -177,6 +190,7 @@ class _FooterWidgetState extends State<FooterWidget> {
: null, : null,
), ),
), ),
SizedBox( SizedBox(
width: 10, width: 10,
), ),
@ -184,17 +198,22 @@ class _FooterWidgetState extends State<FooterWidget> {
width: MediaQuery.of(context).size.width * 0.35, width: MediaQuery.of(context).size.width * 0.35,
child: SecondaryButton( child: SecondaryButton(
label: TranslationBase.of(context).addToCart.toUpperCase(), label: TranslationBase.of(context).addToCart.toUpperCase(),
disabled: (!widget.isAvailable && widget.quantity > 0) || widget.quantity > widget.quantityLimit || widget.item.isRx, disabled: (!widget.isAvailable && widget.quantity > 0) ||
widget.quantity > widget.quantityLimit ||
widget.item.isRx,
onTap: () async { onTap: () async {
if (!authenticatedUserObject.isLogin) { if (!authenticatedUserObject.isLogin) {
login(); login();
} else } else
await widget.addToCartFunction(quantity: widget.quantity, itemID: widget.item.id, model: widget.model); await widget.addToCartFunction(
quantity: widget.quantity,
itemID: widget.item.id,
model: widget.model);
}, },
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
borderColor: Color(0xFF4CAF50), borderColor: Color(0xFF4CAF50).withOpacity(0.7),
borderRadius: 3, borderRadius: 6,
color: Color(0xFF4CAF50), color: Color(0xFF5AB145).withOpacity(0.7),
), ),
), ),
SizedBox( SizedBox(
@ -204,19 +223,28 @@ class _FooterWidgetState extends State<FooterWidget> {
width: MediaQuery.of(context).size.width * 0.35, width: MediaQuery.of(context).size.width * 0.35,
child: SecondaryButton( child: SecondaryButton(
label: TranslationBase.of(context).buyNow.toUpperCase(), label: TranslationBase.of(context).buyNow.toUpperCase(),
disabled: (!widget.isAvailable && widget.quantity > 0) || (widget.quantity > widget.quantityLimit) || widget.item.isRx, disabled: (!widget.isAvailable && widget.quantity > 0) ||
(widget.quantity > widget.quantityLimit) ||
widget.item.isRx,
onTap: () async { onTap: () async {
if (!authenticatedUserObject.isLogin) { if (!authenticatedUserObject.isLogin) {
login(); login();
} else { } else {
await widget.addToShoppingCartFunction(quantity: widget.quantity, itemID: widget.item.id, model: widget.model); await widget.addToShoppingCartFunction(
quantity: widget.quantity,
itemID: widget.item.id,
model: widget.model);
} }
}, },
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
borderColor: Colors.grey[800], borderColor: Colors.grey[800].withOpacity(0.7),
borderRadius: 3, borderRadius: 6,
disableColor: Colors.grey[700], disableColor: Colors.grey[700],
color: !widget.isAvailable && widget.quantity > 0 || widget.quantity > widget.quantityLimit || widget.item.isRx ? Colors.grey : Colors.grey[800], color: !widget.isAvailable && widget.quantity > 0 ||
widget.quantity > widget.quantityLimit ||
widget.item.isRx
? Color(0xFF535353).withOpacity(0.7)
: Colors.grey[800],
), ),
), ),
], ],
@ -239,7 +267,9 @@ class _FooterWidgetState extends State<FooterWidget> {
Navigator.of(context).pushNamed(CONFIRM_LOGIN); Navigator.of(context).pushNamed(CONFIRM_LOGIN);
} else { } else {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
authService.selectDeviceImei(DEVICE_TOKEN).then((SelectDeviceIMEIRES value) { authService
.selectDeviceImei(DEVICE_TOKEN)
.then((SelectDeviceIMEIRES value) {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
if (value != null) { if (value != null) {
setUserValues(value); setUserValues(value);

@ -13,6 +13,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -121,12 +122,39 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
child: Column( child: Column(
children: [ children: [
if (widget.product.images.isNotEmpty) if (widget.product.images.isNotEmpty)
Container( Stack(
height: MediaQuery.of(context).size.height * .40, children: [
child: Image.network( Container(
widget.product.images[0].src.trim(), height: MediaQuery.of(context).size.height * .40,
fit: BoxFit.contain, child: Center(
), child: Image.network(
widget.product.images[0].src.trim(),
fit: BoxFit.contain,
),
),
),
if(model.isStockAvailable!= null && !model.isStockAvailable)
Container(
height: MediaQuery.of(context).size.height * .40,
color: Colors.white.withOpacity(0.75),
// child: AppText("Out of Stock"),
),
if(model.isStockAvailable!= null && !model.isStockAvailable)
Positioned(
// bottom: 10,
top: MediaQuery.of(context).size.height *.088,
left: MediaQuery.of(context).size.width *.32,
child: Center(
child: Container(
height: MediaQuery.of(context).size.height * .40,
// color: Colors.white.withOpacity(0.75),
child: RotationTransition(
turns: new AlwaysStoppedAnimation(310 / 360),
child: AppText(TranslationBase.of(context).productOutOfStock ,color:Color(0xFF000000).withOpacity(0.1),fontSize: projectViewModel.isArabic?40: 50, fontWeight: FontWeight.bold ,)),
),
),
),
],
), ),
if (widget.product.discountDescription != null) DiscountDescription(product: widget.product) if (widget.product.discountDescription != null) DiscountDescription(product: widget.product)
], ],
@ -251,7 +279,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
Column( Column(
children: [ children: [
FlatButton( FlatButton(
onPressed: model.isStockAvailable onPressed: model.isStockAvailable !=null && model.isStockAvailable
? () async { ? () async {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await model.getProductLocationData(widget.product.sku); await model.getProductLocationData(widget.product.sku);

@ -57,10 +57,12 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
IconWithBg( IconWithBg(
icon: Icons.arrow_back, icon: Icons.arrow_back_ios,
color: Colors.grey, color: Color(0xFF2B353E),
onPress: () { onPress: () {
Navigator.pop(context); Navigator.pop(context);
}, },

@ -1827,6 +1827,7 @@ class TranslationBase {
String get needPrescription => localizedValues['needPrescription'][locale.languageCode]; String get needPrescription => localizedValues['needPrescription'][locale.languageCode];
String get outOfStockMsg => localizedValues['outOfStockMsg'][locale.languageCode]; String get outOfStockMsg => localizedValues['outOfStockMsg'][locale.languageCode];
String get productOutOfStock => localizedValues['productOutOfStock'][locale.languageCode];
String get noArabicLetters => localizedValues['noArabicLetters'][locale.languageCode]; String get noArabicLetters => localizedValues['noArabicLetters'][locale.languageCode];

Loading…
Cancel
Save