|
|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
|
|
@ -9,7 +10,7 @@ class FooterWidget extends StatefulWidget {
|
|
|
|
|
final bool isAvailble;
|
|
|
|
|
final int maxQuantity;
|
|
|
|
|
final int minQuantity;
|
|
|
|
|
final int quantityLimit;
|
|
|
|
|
final int quantityLimit;
|
|
|
|
|
final PharmacyProduct item;
|
|
|
|
|
final Function addToCartFunction;
|
|
|
|
|
|
|
|
|
|
@ -403,84 +404,47 @@ class _FooterWidgetState extends State<FooterWidget> {
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
!widget.isAvailble && widget.price > 0 ||
|
|
|
|
|
widget.price > widget.quantityLimit ||
|
|
|
|
|
widget.item.rxMessage != null
|
|
|
|
|
? Container(
|
|
|
|
|
width: 190,
|
|
|
|
|
height: 46,
|
|
|
|
|
color: Colors.grey,
|
|
|
|
|
child: Align(
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).addToCart,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
fontSize: 15),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
widget.addToCartFunction(widget.price, widget.item.id, context);
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
width: 190,
|
|
|
|
|
height: 46,
|
|
|
|
|
color: Colors.green,
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).addToCart,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
fontSize: 15),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width* 0.4,
|
|
|
|
|
child: SecondaryButton(
|
|
|
|
|
label: TranslationBase.of(context).addToCart.toUpperCase(),
|
|
|
|
|
disabled: !widget.isAvailble && widget.price > 0 ||
|
|
|
|
|
widget.price > widget.quantityLimit ||
|
|
|
|
|
widget.item.rxMessage != null,
|
|
|
|
|
onTap: () {
|
|
|
|
|
widget.addToCartFunction(widget.price, widget.item.id, context);
|
|
|
|
|
},
|
|
|
|
|
borderRadius: 5,
|
|
|
|
|
color:Colors.green,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 5,
|
|
|
|
|
),
|
|
|
|
|
!widget.isAvailble && widget.price > 0 ||
|
|
|
|
|
widget.price > widget.quantityLimit ||
|
|
|
|
|
widget.item.rxMessage != null
|
|
|
|
|
? Container(
|
|
|
|
|
width: 120,
|
|
|
|
|
height: 46,
|
|
|
|
|
color: Colors.grey,
|
|
|
|
|
child: Align(
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).buyNow,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
fontSize: 15),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
print('buy now');
|
|
|
|
|
widget.addToCartFunction(widget.price, widget.item.id, context);
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(page: CartOrderPage()),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
width: 120,
|
|
|
|
|
height: 46,
|
|
|
|
|
color: Colors.blue,
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).buyNow,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
fontSize: 15),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width* 0.3,
|
|
|
|
|
child: SecondaryButton(
|
|
|
|
|
label: TranslationBase.of(context).buyNow.toUpperCase(),
|
|
|
|
|
disabled: !widget.isAvailble && widget.price > 0 ||
|
|
|
|
|
widget.price > widget.quantityLimit ||
|
|
|
|
|
widget.item.rxMessage != null,
|
|
|
|
|
onTap: () {
|
|
|
|
|
widget.addToCartFunction(
|
|
|
|
|
widget.price, widget.item.id, context);
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(page: CartOrderPage()),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
borderRadius: 5,
|
|
|
|
|
color: !widget.isAvailble && widget.price > 0 ||
|
|
|
|
|
widget.price > widget.quantityLimit ||
|
|
|
|
|
widget.item.rxMessage != null?Colors.grey:Colors.grey[800],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
|