|
|
|
|
@ -16,13 +16,10 @@ class PaymentMethodSelectPage extends StatefulWidget {
|
|
|
|
|
final bool isUpdating;
|
|
|
|
|
final Function changeMainState;
|
|
|
|
|
|
|
|
|
|
const PaymentMethodSelectPage(
|
|
|
|
|
{Key key, this.model, this.isUpdating = false, this.changeMainState})
|
|
|
|
|
: super(key: key);
|
|
|
|
|
const PaymentMethodSelectPage({Key key, this.model, this.isUpdating = false, this.changeMainState}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_PaymentMethodSelectPageState createState() =>
|
|
|
|
|
_PaymentMethodSelectPageState();
|
|
|
|
|
_PaymentMethodSelectPageState createState() => _PaymentMethodSelectPageState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _PaymentMethodSelectPageState extends State<PaymentMethodSelectPage> {
|
|
|
|
|
@ -85,16 +82,17 @@ class _PaymentMethodSelectPageState extends State<PaymentMethodSelectPage> {
|
|
|
|
|
selectedPaymentOption = PaymentOption.mastercard;
|
|
|
|
|
})
|
|
|
|
|
}),
|
|
|
|
|
PaymentMethodCard(
|
|
|
|
|
cardWidth,
|
|
|
|
|
selectedPaymentOption,
|
|
|
|
|
PaymentOption.installments,
|
|
|
|
|
() => {
|
|
|
|
|
setState(() {
|
|
|
|
|
selectedPaymentOption =
|
|
|
|
|
PaymentOption.installments;
|
|
|
|
|
})
|
|
|
|
|
}),
|
|
|
|
|
widget.model.cartResponse.totalAmount > 1000
|
|
|
|
|
? PaymentMethodCard(
|
|
|
|
|
cardWidth,
|
|
|
|
|
selectedPaymentOption,
|
|
|
|
|
PaymentOption.installments,
|
|
|
|
|
() => {
|
|
|
|
|
setState(() {
|
|
|
|
|
selectedPaymentOption = PaymentOption.installments;
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
: Container(),
|
|
|
|
|
if (Platform.isIOS)
|
|
|
|
|
PaymentMethodCard(
|
|
|
|
|
cardWidth,
|
|
|
|
|
@ -118,8 +116,7 @@ class _PaymentMethodSelectPageState extends State<PaymentMethodSelectPage> {
|
|
|
|
|
TranslationBase.of(context).next,
|
|
|
|
|
selectedPaymentOption != null
|
|
|
|
|
? () {
|
|
|
|
|
widget.model.paymentCheckoutData.paymentOption =
|
|
|
|
|
selectedPaymentOption;
|
|
|
|
|
widget.model.paymentCheckoutData.paymentOption = selectedPaymentOption;
|
|
|
|
|
if (widget.isUpdating) {
|
|
|
|
|
widget.changeMainState();
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
@ -150,14 +147,12 @@ class PaymentMethodCard extends StatelessWidget {
|
|
|
|
|
final PaymentOption paymentOption;
|
|
|
|
|
final Function selectMethod;
|
|
|
|
|
|
|
|
|
|
PaymentMethodCard(this.cardWidth, this.selectedPaymentOption,
|
|
|
|
|
this.paymentOption, this.selectMethod);
|
|
|
|
|
PaymentMethodCard(this.cardWidth, this.selectedPaymentOption, this.paymentOption, this.selectMethod);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
bool isSelected = false;
|
|
|
|
|
if (selectedPaymentOption != null &&
|
|
|
|
|
selectedPaymentOption == paymentOption) {
|
|
|
|
|
if (selectedPaymentOption != null && selectedPaymentOption == paymentOption) {
|
|
|
|
|
isSelected = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -171,9 +166,7 @@ class PaymentMethodCard extends StatelessWidget {
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
|
side: isSelected
|
|
|
|
|
? BorderSide(color: Colors.green, width: 2.0)
|
|
|
|
|
: BorderSide(color: Colors.transparent, width: 0.0),
|
|
|
|
|
side: isSelected ? BorderSide(color: Colors.green, width: 2.0) : BorderSide(color: Colors.transparent, width: 0.0),
|
|
|
|
|
),
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(12.0),
|
|
|
|
|
@ -182,13 +175,7 @@ class PaymentMethodCard extends StatelessWidget {
|
|
|
|
|
Container(
|
|
|
|
|
width: 24,
|
|
|
|
|
height: 24,
|
|
|
|
|
decoration: containerColorRadiusBorderWidth(
|
|
|
|
|
isSelected
|
|
|
|
|
? CustomColors.accentColor
|
|
|
|
|
: Colors.transparent,
|
|
|
|
|
100,
|
|
|
|
|
Colors.grey,
|
|
|
|
|
0.5),
|
|
|
|
|
decoration: containerColorRadiusBorderWidth(isSelected ? CustomColors.accentColor : Colors.transparent, 100, Colors.grey, 0.5),
|
|
|
|
|
),
|
|
|
|
|
mWidth(12),
|
|
|
|
|
Container(
|
|
|
|
|
@ -200,8 +187,7 @@ class PaymentMethodCard extends StatelessWidget {
|
|
|
|
|
if (isSelected)
|
|
|
|
|
Container(
|
|
|
|
|
decoration: containerRadius(CustomColors.green, 200),
|
|
|
|
|
padding:
|
|
|
|
|
EdgeInsets.only(top: 6, bottom: 6, left: 12, right: 12),
|
|
|
|
|
padding: EdgeInsets.only(top: 6, bottom: 6, left: 12, right: 12),
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).paymentSelected,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
|