Skip to content

Commit

Permalink
Merge pull request #69 from Onestop-Agrotech/0.4.2
Browse files Browse the repository at this point in the history
0.4.2
  • Loading branch information
Rahul-Vijay authored Aug 19, 2020
2 parents 609f603 + f3eb76d commit 7e8e62f
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 24 deletions.
46 changes: 30 additions & 16 deletions lib/screens/common/AnimatedCard/animatedCard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class _AnimatedCardState extends State<AnimatedCard>
}

// open the modal for product addition
void onClickProduct() {
void onClickProduct(context) {
showGeneralDialog(
context: context,
barrierDismissible: true,
Expand All @@ -88,7 +88,7 @@ class _AnimatedCardState extends State<AnimatedCard>
? animationController.forward()
: animationController.reverse();

void _showDeleteAlert(newCart) {
void _showDeleteAlert(newCart, context) {
showDialog(
context: context,
builder: (context) {
Expand Down Expand Up @@ -139,14 +139,18 @@ class _AnimatedCardState extends State<AnimatedCard>
child: animationController.value <= 0.5
? GestureDetector(
onTap: () {
if (!this.widget.shopping) onClickProduct();
if (!this.widget.shopping &&
!this.widget.product.outOfStock)
onClickProduct(context);
},
child: Container(
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(
color: ThemeColoursSeva().pallete3,
width: 1.5,
color: !this.widget.product.outOfStock
? ThemeColoursSeva().pallete3
: ThemeColoursSeva().grey,
width: !this.widget.product.outOfStock ? 1.5 : 0.2,
),
borderRadius: BorderRadius.circular(20.0),
),
Expand All @@ -159,7 +163,9 @@ class _AnimatedCardState extends State<AnimatedCard>
this.widget.product.name,
overflow: TextOverflow.clip,
style: TextStyle(
color: ThemeColoursSeva().pallete1,
color: !this.widget.product.outOfStock
? ThemeColoursSeva().pallete1
: ThemeColoursSeva().grey,
fontSize: 15.0,
fontWeight: FontWeight.w700),
),
Expand Down Expand Up @@ -202,7 +208,8 @@ class _AnimatedCardState extends State<AnimatedCard>
ThemeColoursSeva().binColor,
onPressed: () {
// alert
_showDeleteAlert(newCart);
_showDeleteAlert(
newCart, context);
}),
);
},
Expand All @@ -211,15 +218,22 @@ class _AnimatedCardState extends State<AnimatedCard>
],
),
SizedBox(height: 20),
Text(
!this.widget.shopping
? "Rs ${this.widget.product.price} - ${this.widget.product.quantity.quantityValue} ${this.widget.product.quantity.quantityMetric}"
: "Rs ${this.widget.product.totalPrice} - ${this.widget.product.totalQuantity.toStringAsFixed(2)} ${this.widget.product.quantity.quantityMetric}",
overflow: TextOverflow.clip,
style: TextStyle(
color: ThemeColoursSeva().pallete1,
fontSize: 15.0,
fontWeight: FontWeight.w700)),
!this.widget.product.outOfStock
? Text(
!this.widget.shopping
? "Rs ${this.widget.product.price} - ${this.widget.product.quantity.quantityValue} ${this.widget.product.quantity.quantityMetric}"
: "Rs ${this.widget.product.totalPrice} - ${this.widget.product.totalQuantity.toStringAsFixed(2)} ${this.widget.product.quantity.quantityMetric}",
overflow: TextOverflow.clip,
style: TextStyle(
color: ThemeColoursSeva().pallete1,
fontSize: 15.0,
fontWeight: FontWeight.w700))
: Text("Out of stock",
overflow: TextOverflow.clip,
style: TextStyle(
color: ThemeColoursSeva().grey,
fontSize: 17.0,
fontWeight: FontWeight.bold)),
SizedBox(
height: 30,
)
Expand Down
29 changes: 21 additions & 8 deletions lib/screens/landing/common/showCards.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,25 @@ class _ShowCardsState extends State<ShowCards> {
);
else {
// open the modal container
onClickProduct();
if (!this.widget.sp.outOfStock) onClickProduct();
}
},
child: Container(
// fallback height
height: height * 0.22,
width: width * 0.4,
decoration: BoxDecoration(
border: Border.all(
color: ThemeColoursSeva().pallete3,
width: 1.5,
),
border: !this.widget.store
? Border.all(
color: ThemeColoursSeva().pallete3,
width: 1.5,
)
: Border.all(
color: !this.widget.sp.outOfStock
? ThemeColoursSeva().pallete3
: ThemeColoursSeva().grey,
width: !this.widget.sp.outOfStock ? 1.5 : 0.2,
),
borderRadius: BorderRadius.circular(20.0)),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
Expand All @@ -68,7 +75,9 @@ class _ShowCardsState extends State<ShowCards> {
"${widget.sp.name}",
overflow: TextOverflow.clip,
style: TextStyle(
color: ThemeColoursSeva().pallete1,
color: !this.widget.sp.outOfStock
? ThemeColoursSeva().pallete1
: ThemeColoursSeva().grey,
fontSize: 15.0,
fontWeight: FontWeight.w700),
)
Expand All @@ -84,10 +93,14 @@ class _ShowCardsState extends State<ShowCards> {
),
widget.store
? Text(
"Rs ${widget.sp.price} - ${widget.sp.quantity.quantityValue} ${widget.sp.quantity.quantityMetric}",
!this.widget.sp.outOfStock
? "Rs ${widget.sp.price} - ${widget.sp.quantity.quantityValue} ${widget.sp.quantity.quantityMetric}"
: "Out of Stock",
overflow: TextOverflow.clip,
style: TextStyle(
color: ThemeColoursSeva().pallete1,
color: !this.widget.sp.outOfStock
? ThemeColoursSeva().pallete1
: ThemeColoursSeva().grey,
fontSize: 15.0,
fontWeight: FontWeight.w700),
)
Expand Down

0 comments on commit 7e8e62f

Please sign in to comment.