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;
bool isOverQuantity;
FooterWidget(this.isAvailable, this.maxQuantity, this.minQuantity,
this.quantityLimit, this.item,
{this.quantity,
this.isOverQuantity = false,
this.addToCartFunction,
this.addToShoppingCartFunction,
this.model});
FooterWidget(this.isAvailable, this.maxQuantity, this.minQuantity, this.quantityLimit, this.item,
{this.quantity, this.isOverQuantity = false, this.addToCartFunction, this.addToShoppingCartFunction, this.model});
@override
_FooterWidgetState createState() => _FooterWidgetState();
@ -47,15 +42,16 @@ class _FooterWidgetState extends State<FooterWidget> {
bool showUI = false;
static final GlobalKey<FormState> _key = GlobalKey<FormState>();
AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
AppSharedPreferences sharedPref = new AppSharedPreferences();
@override
void initState() {
super.initState();
quantityUI = 160;
showUI = true;
if (!isBuyNowDisable() || !isAddToCartDisable()) {
quantityUI = 160;
showUI = true;
}
}
@override
@ -100,11 +96,7 @@ class _FooterWidgetState extends State<FooterWidget> {
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Texts(
TranslationBase.of(context).productQuantity,
fontSize: 15,
fontWeight: FontWeight.bold,
color: Color(0xFF575757)),
child: Texts(TranslationBase.of(context).productQuantity, fontSize: 15, fontWeight: FontWeight.bold, color: Color(0xFF575757)),
),
InkWell(
child: Icon(Icons.close, color: Colors.black),
@ -126,11 +118,7 @@ class _FooterWidgetState extends State<FooterWidget> {
SizedBox(
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(
width: 100,
decoration: BoxDecoration(
@ -141,16 +129,14 @@ class _FooterWidgetState extends State<FooterWidget> {
key: _key,
keyboardType: TextInputType.number,
textAlign: TextAlign.center,
decoration:
InputDecoration(hintText: ' Quantity # '),
decoration: InputDecoration(hintText: ' Quantity # '),
onChanged: (text) {
if (int.tryParse(text) == null) {
text = '';
} else {
setState(() {
widget.quantity = int.parse(text);
if (widget.quantity >=
widget.quantityLimit) {
if (widget.quantity >= widget.quantityLimit) {
widget.isOverQuantity = true;
} else {
widget.isOverQuantity = false;
@ -247,16 +233,12 @@ class _FooterWidgetState extends State<FooterWidget> {
if (!authenticatedUserObject.isLogin) {
login();
} 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,
borderRadius: 6,
disableColor: Color(0xFFD6D6D6),
textColor:
isAddToCartDisable() ? Color(0xFFACACAC) : Colors.white,
textColor: isAddToCartDisable() ? Color(0xFFACACAC) : Colors.white,
color: Color(0xFF535353),
),
),
@ -274,14 +256,10 @@ class _FooterWidgetState extends State<FooterWidget> {
if (!authenticatedUserObject.isLogin) {
login();
} 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);
}
},
textColor:
isBuyNowDisable() ? Color(0xFFACACAC) : Colors.white,
textColor: isBuyNowDisable() ? Color(0xFFACACAC) : Colors.white,
fontWeight: FontWeight.w600,
borderRadius: 6,
disableColor: Color(0xFFD6D6D6),
@ -297,15 +275,11 @@ class _FooterWidgetState extends State<FooterWidget> {
}
bool isBuyNowDisable() {
return (!widget.isAvailable && widget.quantity > 0) ||
(widget.quantity > widget.quantityLimit) ||
widget.item.isRx;
return (!widget.isAvailable && widget.quantity > 0) || (widget.quantity > widget.quantityLimit) || widget.item.isRx;
}
bool isAddToCartDisable() {
return (!widget.isAvailable && widget.quantity > 0) ||
widget.quantity > widget.quantityLimit ||
widget.item.isRx;
return (!widget.isAvailable && widget.quantity > 0) || widget.quantity > widget.quantityLimit || widget.item.isRx;
}
void setUserValues(value) async {
@ -320,9 +294,7 @@ class _FooterWidgetState extends State<FooterWidget> {
Navigator.of(context).pushNamed(CONFIRM_LOGIN);
} else {
GifLoaderDialogUtils.showMyDialog(context);
authService
.selectDeviceImei(DEVICE_TOKEN)
.then((SelectDeviceIMEIRES value) {
authService.selectDeviceImei(DEVICE_TOKEN).then((SelectDeviceIMEIRES value) {
GifLoaderDialogUtils.hideDialog(context);
if (value != null) {
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/translations_delegate_base.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/text/app_texts_widget.dart';
import 'package:flutter/material.dart';
@ -133,27 +132,32 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
),
),
),
if(model.isStockAvailable!= null && !model.isStockAvailable)
Container(
height: MediaQuery.of(context).size.height * .40,
color: Colors.white.withOpacity(0.6),
// 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.19),fontSize: projectViewModel.isArabic?40: 50, fontWeight: FontWeight.bold ,)),
if (model.isStockAvailable != null && !model.isStockAvailable)
Container(
height: MediaQuery.of(context).size.height * .40,
color: Colors.white.withOpacity(0.6),
// 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.19),
fontSize: projectViewModel.isArabic ? 40 : 50,
fontWeight: FontWeight.bold,
)),
),
),
),
),
],
),
if (widget.product.discountDescription != null) DiscountDescription(product: widget.product)
@ -233,7 +237,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
},
child: Text(
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,
),
@ -264,7 +268,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
},
child: Text(
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,
),
@ -279,7 +283,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
Column(
children: [
FlatButton(
onPressed: model.isStockAvailable !=null && model.isStockAvailable
onPressed: model.isStockAvailable != null && model.isStockAvailable
? () async {
GifLoaderDialogUtils.showMyDialog(context);
await model.getProductLocationData(widget.product.sku);
@ -294,7 +298,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
: null,
child: Text(
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,
),

Loading…
Cancel
Save