Updates & fixes

merge-update-with-lab-changes
haroon amjad 4 years ago
parent 0b4e674097
commit a60e878fef

@ -30,13 +30,8 @@ class FooterWidget extends StatefulWidget {
int quantity; int quantity;
bool isOverQuantity; bool isOverQuantity;
FooterWidget(this.isAvailable, this.maxQuantity, this.minQuantity, FooterWidget(this.isAvailable, this.maxQuantity, this.minQuantity, this.quantityLimit, this.item,
this.quantityLimit, this.item, {this.quantity, this.isOverQuantity = false, this.addToCartFunction, this.addToShoppingCartFunction, this.model});
{this.quantity,
this.isOverQuantity = false,
this.addToCartFunction,
this.addToShoppingCartFunction,
this.model});
@override @override
_FooterWidgetState createState() => _FooterWidgetState(); _FooterWidgetState createState() => _FooterWidgetState();
@ -47,15 +42,16 @@ class _FooterWidgetState extends State<FooterWidget> {
bool showUI = false; bool showUI = false;
static final GlobalKey<FormState> _key = GlobalKey<FormState>(); static final GlobalKey<FormState> _key = GlobalKey<FormState>();
AuthenticatedUserObject authenticatedUserObject = AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
locator<AuthenticatedUserObject>();
AppSharedPreferences sharedPref = new AppSharedPreferences(); AppSharedPreferences sharedPref = new AppSharedPreferences();
@override @override
void initState() { void initState() {
super.initState(); super.initState();
quantityUI = 160; if (!isBuyNowDisable() || !isAddToCartDisable()) {
showUI = true; quantityUI = 160;
showUI = true;
}
} }
@override @override
@ -100,11 +96,7 @@ class _FooterWidgetState extends State<FooterWidget> {
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Texts( child: Texts(TranslationBase.of(context).productQuantity, fontSize: 15, fontWeight: FontWeight.bold, color: Color(0xFF575757)),
TranslationBase.of(context).productQuantity,
fontSize: 15,
fontWeight: FontWeight.bold,
color: Color(0xFF575757)),
), ),
InkWell( InkWell(
child: Icon(Icons.close, color: Colors.black), child: Icon(Icons.close, color: Colors.black),
@ -126,11 +118,7 @@ class _FooterWidgetState extends State<FooterWidget> {
SizedBox( SizedBox(
width: 5, width: 5,
), ),
for (int i = 1; i <= 10; i++) for (int i = 1; i <= 10; i++) QuantityBox(label: i, onTapFunc: onChangeValue, isSelected: widget.quantity == i),
QuantityBox(
label: i,
onTapFunc: onChangeValue,
isSelected: widget.quantity == i),
Container( Container(
width: 100, width: 100,
decoration: BoxDecoration( decoration: BoxDecoration(
@ -141,16 +129,14 @@ class _FooterWidgetState extends State<FooterWidget> {
key: _key, key: _key,
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
textAlign: TextAlign.center, textAlign: TextAlign.center,
decoration: decoration: InputDecoration(hintText: ' Quantity # '),
InputDecoration(hintText: ' 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 >= if (widget.quantity >= widget.quantityLimit) {
widget.quantityLimit) {
widget.isOverQuantity = true; widget.isOverQuantity = true;
} else { } else {
widget.isOverQuantity = false; widget.isOverQuantity = false;
@ -247,16 +233,12 @@ class _FooterWidgetState extends State<FooterWidget> {
if (!authenticatedUserObject.isLogin) { if (!authenticatedUserObject.isLogin) {
login(); login();
} else } else
await widget.addToCartFunction( await widget.addToCartFunction(quantity: widget.quantity, itemID: widget.item.id, model: widget.model);
quantity: widget.quantity,
itemID: widget.item.id,
model: widget.model);
}, },
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
borderRadius: 6, borderRadius: 6,
disableColor: Color(0xFFD6D6D6), disableColor: Color(0xFFD6D6D6),
textColor: textColor: isAddToCartDisable() ? Color(0xFFACACAC) : Colors.white,
isAddToCartDisable() ? Color(0xFFACACAC) : Colors.white,
color: Color(0xFF535353), color: Color(0xFF535353),
), ),
), ),
@ -274,14 +256,10 @@ class _FooterWidgetState extends State<FooterWidget> {
if (!authenticatedUserObject.isLogin) { if (!authenticatedUserObject.isLogin) {
login(); login();
} else { } else {
await widget.addToShoppingCartFunction( await widget.addToShoppingCartFunction(quantity: widget.quantity, itemID: widget.item.id, model: widget.model);
quantity: widget.quantity,
itemID: widget.item.id,
model: widget.model);
} }
}, },
textColor: textColor: isBuyNowDisable() ? Color(0xFFACACAC) : Colors.white,
isBuyNowDisable() ? Color(0xFFACACAC) : Colors.white,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
borderRadius: 6, borderRadius: 6,
disableColor: Color(0xFFD6D6D6), disableColor: Color(0xFFD6D6D6),
@ -297,15 +275,11 @@ class _FooterWidgetState extends State<FooterWidget> {
} }
bool isBuyNowDisable() { bool isBuyNowDisable() {
return (!widget.isAvailable && widget.quantity > 0) || return (!widget.isAvailable && widget.quantity > 0) || (widget.quantity > widget.quantityLimit) || widget.item.isRx;
(widget.quantity > widget.quantityLimit) ||
widget.item.isRx;
} }
bool isAddToCartDisable() { bool isAddToCartDisable() {
return (!widget.isAvailable && widget.quantity > 0) || return (!widget.isAvailable && widget.quantity > 0) || widget.quantity > widget.quantityLimit || widget.item.isRx;
widget.quantity > widget.quantityLimit ||
widget.item.isRx;
} }
void setUserValues(value) async { void setUserValues(value) async {
@ -320,9 +294,7 @@ 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 authService.selectDeviceImei(DEVICE_TOKEN).then((SelectDeviceIMEIRES value) {
.selectDeviceImei(DEVICE_TOKEN)
.then((SelectDeviceIMEIRES value) {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
if (value != null) { if (value != null) {
setUserValues(value); setUserValues(value);

@ -11,7 +11,6 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; 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/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:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -133,27 +132,32 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
), ),
), ),
), ),
if(model.isStockAvailable!= null && !model.isStockAvailable) if (model.isStockAvailable != null && !model.isStockAvailable)
Container( Container(
height: MediaQuery.of(context).size.height * .40, height: MediaQuery.of(context).size.height * .40,
color: Colors.white.withOpacity(0.6), color: Colors.white.withOpacity(0.6),
// child: AppText("Out of Stock"), // child: AppText("Out of Stock"),
), ),
if(model.isStockAvailable!= null && !model.isStockAvailable) if (model.isStockAvailable != null && !model.isStockAvailable)
Positioned( Positioned(
// bottom: 10, // bottom: 10,
top: MediaQuery.of(context).size.height *.088, top: MediaQuery.of(context).size.height * .088,
left: MediaQuery.of(context).size.width *.32, left: MediaQuery.of(context).size.width * .32,
child: Center( child: Center(
child: Container( child: Container(
height: MediaQuery.of(context).size.height * .40, height: MediaQuery.of(context).size.height * .40,
// color: Colors.white.withOpacity(0.75), // color: Colors.white.withOpacity(0.75),
child: RotationTransition( child: RotationTransition(
turns: new AlwaysStoppedAnimation(310 / 360), turns: new AlwaysStoppedAnimation(310 / 360),
child: AppText(TranslationBase.of(context).productOutOfStock ,color:Color(0xFF000000).withOpacity(0.19),fontSize: projectViewModel.isArabic?40: 50, fontWeight: FontWeight.bold ,)), child: AppText(
TranslationBase.of(context).productOutOfStock,
color: Color(0xFF000000).withOpacity(0.19),
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)
@ -233,7 +237,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
}, },
child: Text( child: Text(
TranslationBase.of(context).details, TranslationBase.of(context).details,
style: TextStyle( fontWeight: FontWeight.w600, fontSize: 14, letterSpacing:-0.84), style: TextStyle(fontWeight: FontWeight.w600, fontSize: 14, letterSpacing: -0.84),
), ),
color: Colors.white, color: Colors.white,
), ),
@ -264,7 +268,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
}, },
child: Text( child: Text(
TranslationBase.of(context).reviews, TranslationBase.of(context).reviews,
style: TextStyle( fontWeight: FontWeight.w600, fontSize: 14, letterSpacing:-0.84), style: TextStyle(fontWeight: FontWeight.w600, fontSize: 14, letterSpacing: -0.84),
), ),
color: Colors.white, color: Colors.white,
), ),
@ -279,7 +283,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
Column( Column(
children: [ children: [
FlatButton( FlatButton(
onPressed: model.isStockAvailable !=null && 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);
@ -294,7 +298,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
: null, : null,
child: Text( child: Text(
TranslationBase.of(context).availability, TranslationBase.of(context).availability,
style: TextStyle( fontWeight: FontWeight.w600, fontSize: 14, letterSpacing:-0.84), style: TextStyle(fontWeight: FontWeight.w600, fontSize: 14, letterSpacing: -0.84),
), ),
color: Colors.white, color: Colors.white,
), ),

Loading…
Cancel
Save