|
|
|
@ -45,10 +45,19 @@ class FooterWidget extends StatefulWidget {
|
|
|
|
|
class _FooterWidgetState extends State<FooterWidget> {
|
|
|
|
|
double quantityUI = 80;
|
|
|
|
|
bool showUI = false;
|
|
|
|
|
|
|
|
|
|
static final GlobalKey<FormState> _key = GlobalKey<FormState>();
|
|
|
|
|
AuthenticatedUserObject authenticatedUserObject =
|
|
|
|
|
locator<AuthenticatedUserObject>();
|
|
|
|
|
AppSharedPreferences sharedPref = new AppSharedPreferences();
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
quantityUI = 160;
|
|
|
|
|
showUI = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Container(
|
|
|
|
@ -71,8 +80,11 @@ class _FooterWidgetState extends State<FooterWidget> {
|
|
|
|
|
height: quantityUI,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
showUI
|
|
|
|
|
!showUI
|
|
|
|
|
? Container(
|
|
|
|
|
height: 10,
|
|
|
|
|
)
|
|
|
|
|
: Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: 100,
|
|
|
|
|
color: Colors.white,
|
|
|
|
@ -89,11 +101,10 @@ class _FooterWidgetState extends State<FooterWidget> {
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
|
child: Texts(
|
|
|
|
|
TranslationBase.of(context).productQuantity,
|
|
|
|
|
TranslationBase.of(context).productQuantity,
|
|
|
|
|
fontSize: 15,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
color: Color(0xFF575757)
|
|
|
|
|
),
|
|
|
|
|
color: Color(0xFF575757)),
|
|
|
|
|
),
|
|
|
|
|
InkWell(
|
|
|
|
|
child: Icon(Icons.close, color: Colors.black),
|
|
|
|
@ -127,8 +138,11 @@ class _FooterWidgetState extends State<FooterWidget> {
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
child: TextField(
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
labelText: ' Quantity # '),
|
|
|
|
|
key: _key,
|
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
decoration:
|
|
|
|
|
InputDecoration(hintText: ' Quantity # '),
|
|
|
|
|
onChanged: (text) {
|
|
|
|
|
if (int.tryParse(text) == null) {
|
|
|
|
|
text = '';
|
|
|
|
@ -152,9 +166,6 @@ class _FooterWidgetState extends State<FooterWidget> {
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: Container(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
height: 58,
|
|
|
|
@ -227,8 +238,7 @@ class _FooterWidgetState extends State<FooterWidget> {
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.35,
|
|
|
|
|
margin: EdgeInsets.symmetric( vertical: 5.0),
|
|
|
|
|
|
|
|
|
|
margin: EdgeInsets.symmetric(vertical: 5.0),
|
|
|
|
|
child: SecondaryButton(
|
|
|
|
|
label: TranslationBase.of(context).addToCart,
|
|
|
|
|
disabled: isAddToCartDisable(),
|
|
|
|
@ -244,8 +254,9 @@ class _FooterWidgetState extends State<FooterWidget> {
|
|
|
|
|
},
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
borderRadius: 6,
|
|
|
|
|
disableColor:Color(0xFFD6D6D6),
|
|
|
|
|
textColor: isAddToCartDisable()?Color(0xFFACACAC):Colors.white,
|
|
|
|
|
disableColor: Color(0xFFD6D6D6),
|
|
|
|
|
textColor:
|
|
|
|
|
isAddToCartDisable() ? Color(0xFFACACAC) : Colors.white,
|
|
|
|
|
color: Color(0xFF535353),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -254,13 +265,11 @@ class _FooterWidgetState extends State<FooterWidget> {
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.35,
|
|
|
|
|
margin: EdgeInsets.symmetric( vertical: 5.0),
|
|
|
|
|
|
|
|
|
|
margin: EdgeInsets.symmetric(vertical: 5.0),
|
|
|
|
|
child: SecondaryButton(
|
|
|
|
|
label: TranslationBase.of(context).buyNow,
|
|
|
|
|
fontSize: 15,
|
|
|
|
|
disabled: isBuyNowDisable(),
|
|
|
|
|
|
|
|
|
|
onTap: () async {
|
|
|
|
|
if (!authenticatedUserObject.isLogin) {
|
|
|
|
|
login();
|
|
|
|
@ -271,7 +280,8 @@ class _FooterWidgetState extends State<FooterWidget> {
|
|
|
|
|
model: widget.model);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
textColor: isBuyNowDisable()?Color(0xFFACACAC):Colors.white,
|
|
|
|
|
textColor:
|
|
|
|
|
isBuyNowDisable() ? Color(0xFFACACAC) : Colors.white,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
borderRadius: 6,
|
|
|
|
|
disableColor: Color(0xFFD6D6D6),
|
|
|
|
@ -286,20 +296,16 @@ class _FooterWidgetState extends State<FooterWidget> {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool isBuyNowDisable(){
|
|
|
|
|
bool isBuyNowDisable() {
|
|
|
|
|
return (!widget.isAvailable && widget.quantity > 0) ||
|
|
|
|
|
(widget.quantity > widget.quantityLimit) ||
|
|
|
|
|
widget.item.isRx;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool isAddToCartDisable(){
|
|
|
|
|
bool isAddToCartDisable() {
|
|
|
|
|
return (!widget.isAvailable && widget.quantity > 0) ||
|
|
|
|
|
widget.quantity > widget.quantityLimit ||
|
|
|
|
|
widget.item.isRx;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void setUserValues(value) async {
|
|
|
|
|