BASE: Update Icons & Name Of The App.
This commit is contained in:
@@ -12,7 +12,7 @@ import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get.dart' hide Trans;
|
||||
import '../../../controllers/theme_controller.dart';
|
||||
import '../../../themes/show_toast_dialog.dart';
|
||||
import 'history_gift_card.dart';
|
||||
@@ -29,13 +29,18 @@ class GiftCardScreen extends StatelessWidget {
|
||||
builder: (controller) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: isDark ? AppThemeData.surfaceDark : AppThemeData.surface,
|
||||
backgroundColor:
|
||||
isDark ? AppThemeData.surfaceDark : AppThemeData.surface,
|
||||
centerTitle: false,
|
||||
titleSpacing: 0,
|
||||
title: Text(
|
||||
"Customize Gift Card".tr(),
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(fontFamily: AppThemeData.medium, fontSize: 16, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900),
|
||||
style: TextStyle(
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontSize: 16,
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
InkWell(
|
||||
@@ -69,26 +74,54 @@ class GiftCardScreen extends StatelessWidget {
|
||||
itemCount: controller.giftCardList.length,
|
||||
onPageChanged: (value) {
|
||||
controller.selectedPageIndex.value = value;
|
||||
controller.selectedGiftCard.value = controller.giftCardList[controller.selectedPageIndex.value];
|
||||
controller.selectedGiftCard.value =
|
||||
controller.giftCardList[controller
|
||||
.selectedPageIndex
|
||||
.value];
|
||||
|
||||
controller.messageController.value.text = controller.giftCardList[controller.selectedPageIndex.value].message.toString();
|
||||
controller.messageController.value.text =
|
||||
controller
|
||||
.giftCardList[controller
|
||||
.selectedPageIndex
|
||||
.value]
|
||||
.message
|
||||
.toString();
|
||||
},
|
||||
scrollDirection: Axis.horizontal,
|
||||
controller: controller.pageController,
|
||||
itemBuilder: (context, index) {
|
||||
GiftCardsModel giftCardModel = controller.giftCardList[index];
|
||||
GiftCardsModel giftCardModel =
|
||||
controller.giftCardList[index];
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
controller.selectedGiftCard.value = giftCardModel;
|
||||
controller.messageController.value.text = controller.selectedGiftCard.value.message.toString();
|
||||
controller.selectedGiftCard.value =
|
||||
giftCardModel;
|
||||
controller.messageController.value.text =
|
||||
controller
|
||||
.selectedGiftCard
|
||||
.value
|
||||
.message
|
||||
.toString();
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(10), border: Border.all(color: AppThemeData.primary300)),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(
|
||||
color: AppThemeData.primary300,
|
||||
),
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
child: NetworkImageWidget(imageUrl: giftCardModel.image.toString(), width: Responsive.width(80, context), fit: BoxFit.cover),
|
||||
child: NetworkImageWidget(
|
||||
imageUrl:
|
||||
giftCardModel.image.toString(),
|
||||
width: Responsive.width(80, context),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -101,14 +134,32 @@ class GiftCardScreen extends StatelessWidget {
|
||||
title: 'Choose an amount'.tr(),
|
||||
controller: controller.amountController.value,
|
||||
hintText: 'Enter gift card amount'.tr(),
|
||||
textInputType: const TextInputType.numberWithOptions(signed: true, decimal: true),
|
||||
textInputType:
|
||||
const TextInputType.numberWithOptions(
|
||||
signed: true,
|
||||
decimal: true,
|
||||
),
|
||||
textInputAction: TextInputAction.done,
|
||||
inputFormatters: [FilteringTextInputFormatter.allow(RegExp('[0-9]'))],
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(
|
||||
RegExp('[0-9]'),
|
||||
),
|
||||
],
|
||||
prefix: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 14,
|
||||
),
|
||||
child: Text(
|
||||
Constant.currencyModel!.symbol.tr(),
|
||||
style: TextStyle(color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, fontFamily: AppThemeData.semiBold, fontSize: 18),
|
||||
style: TextStyle(
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.grey50
|
||||
: AppThemeData.grey900,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
fontSize: 18,
|
||||
),
|
||||
),
|
||||
),
|
||||
onchange: (value) {
|
||||
@@ -126,17 +177,25 @@ class GiftCardScreen extends StatelessWidget {
|
||||
return Obx(
|
||||
() => InkWell(
|
||||
onTap: () {
|
||||
controller.selectedAmount.value = controller.amountList[index];
|
||||
controller.amountController.value.text = controller.amountList[index];
|
||||
controller.selectedAmount.value =
|
||||
controller.amountList[index];
|
||||
controller.amountController.value.text =
|
||||
controller.amountList[index];
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 5),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 5,
|
||||
),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(40)),
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(40),
|
||||
),
|
||||
border: Border.all(
|
||||
color:
|
||||
controller.selectedAmount == controller.amountList[index]
|
||||
controller.selectedAmount ==
|
||||
controller
|
||||
.amountList[index]
|
||||
? AppThemeData.primary300
|
||||
: isDark
|
||||
? AppThemeData.grey400
|
||||
@@ -144,11 +203,24 @@ class GiftCardScreen extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
Constant.amountShow(amount: controller.amountList[index]),
|
||||
style: TextStyle(fontFamily: AppThemeData.medium, fontSize: 14, color: isDark ? AppThemeData.grey400 : AppThemeData.grey500),
|
||||
Constant.amountShow(
|
||||
amount:
|
||||
controller
|
||||
.amountList[index],
|
||||
),
|
||||
style: TextStyle(
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontSize: 14,
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.grey400
|
||||
: AppThemeData.grey500,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -160,7 +232,12 @@ class GiftCardScreen extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 40),
|
||||
TextFieldWidget(title: 'Add Message (Optional)'.tr(), controller: controller.messageController.value, hintText: 'Add message here....'.tr(), maxLine: 6),
|
||||
TextFieldWidget(
|
||||
title: 'Add Message (Optional)'.tr(),
|
||||
controller: controller.messageController.value,
|
||||
hintText: 'Add message here....'.tr(),
|
||||
maxLine: 6,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -179,7 +256,10 @@ class GiftCardScreen extends StatelessWidget {
|
||||
onPress: () async {
|
||||
if (controller.amountController.value.text.isNotEmpty) {
|
||||
if (Constant.userModel == null) {
|
||||
ShowToastDialog.showToast("Please log in to the application. You are not logged in.".tr());
|
||||
ShowToastDialog.showToast(
|
||||
"Please log in to the application. You are not logged in."
|
||||
.tr(),
|
||||
);
|
||||
} else {
|
||||
giftCardBottomSheet(context, controller);
|
||||
}
|
||||
@@ -195,12 +275,17 @@ class GiftCardScreen extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Future giftCardBottomSheet(BuildContext context, GiftCardController controller) {
|
||||
Future giftCardBottomSheet(
|
||||
BuildContext context,
|
||||
GiftCardController controller,
|
||||
) {
|
||||
return showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
isDismissible: true,
|
||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(30))),
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(30)),
|
||||
),
|
||||
clipBehavior: Clip.antiAliasWithSaveLayer,
|
||||
builder:
|
||||
(context) => FractionallySizedBox(
|
||||
@@ -213,7 +298,10 @@ class GiftCardScreen extends StatelessWidget {
|
||||
() => Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 10,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -221,17 +309,34 @@ class GiftCardScreen extends StatelessWidget {
|
||||
const SizedBox(height: 20),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
child: NetworkImageWidget(imageUrl: controller.selectedGiftCard.value.image.toString(), height: Responsive.height(20, context), width: Responsive.width(100, context)),
|
||||
child: NetworkImageWidget(
|
||||
imageUrl:
|
||||
controller.selectedGiftCard.value.image
|
||||
.toString(),
|
||||
height: Responsive.height(20, context),
|
||||
width: Responsive.width(100, context),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: ShapeDecoration(color: AppThemeData.ecommerce50, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12))),
|
||||
decoration: ShapeDecoration(
|
||||
color: AppThemeData.ecommerce50,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
'Complete payment and share this e-gift card with loved ones using any app'.tr(),
|
||||
style: TextStyle(color: AppThemeData.ecommerce300, fontSize: 14, fontFamily: AppThemeData.medium, fontWeight: FontWeight.w500),
|
||||
'Complete payment and share this e-gift card with loved ones using any app'
|
||||
.tr(),
|
||||
style: TextStyle(
|
||||
color: AppThemeData.ecommerce300,
|
||||
fontSize: 14,
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -241,48 +346,114 @@ class GiftCardScreen extends StatelessWidget {
|
||||
Text(
|
||||
"Bill Details".tr(),
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(fontFamily: AppThemeData.semiBold, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, fontSize: 16),
|
||||
style: TextStyle(
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.grey50
|
||||
: AppThemeData.grey900,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Container(
|
||||
width: Responsive.width(100, context),
|
||||
decoration: ShapeDecoration(color: isDark ? AppThemeData.grey900 : AppThemeData.grey50, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8))),
|
||||
decoration: ShapeDecoration(
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.grey900
|
||||
: AppThemeData.grey50,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 14),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
vertical: 14,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"Sub Total".tr(),
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(fontFamily: AppThemeData.regular, color: isDark ? AppThemeData.grey300 : AppThemeData.grey600, fontSize: 16),
|
||||
style: TextStyle(
|
||||
fontFamily:
|
||||
AppThemeData.regular,
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.grey300
|
||||
: AppThemeData
|
||||
.grey600,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
Constant.amountShow(amount: controller.amountController.value.text),
|
||||
Constant.amountShow(
|
||||
amount:
|
||||
controller
|
||||
.amountController
|
||||
.value
|
||||
.text,
|
||||
),
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(fontFamily: AppThemeData.regular, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, fontSize: 16),
|
||||
style: TextStyle(
|
||||
fontFamily:
|
||||
AppThemeData.regular,
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.grey50
|
||||
: AppThemeData.grey900,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"Grand Total".tr(),
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(fontFamily: AppThemeData.regular, color: isDark ? AppThemeData.grey300 : AppThemeData.grey600, fontSize: 16),
|
||||
style: TextStyle(
|
||||
fontFamily:
|
||||
AppThemeData.regular,
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.grey300
|
||||
: AppThemeData
|
||||
.grey600,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
Constant.amountShow(amount: controller.amountController.value.text),
|
||||
Constant.amountShow(
|
||||
amount:
|
||||
controller
|
||||
.amountController
|
||||
.value
|
||||
.text,
|
||||
),
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(fontFamily: AppThemeData.regular, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, fontSize: 16),
|
||||
style: TextStyle(
|
||||
fontFamily:
|
||||
AppThemeData.regular,
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.grey50
|
||||
: AppThemeData.grey900,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -295,9 +466,17 @@ class GiftCardScreen extends StatelessWidget {
|
||||
const SizedBox(height: 20),
|
||||
Center(
|
||||
child: Text(
|
||||
"${'Gift Card expire'.tr()} ${controller.selectedGiftCard.value.expiryDay} ${'days after purchase'.tr()}".tr(),
|
||||
"${'Gift Card expire'.tr()} ${controller.selectedGiftCard.value.expiryDay} ${'days after purchase'.tr()}"
|
||||
.tr(),
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontFamily: AppThemeData.medium, fontSize: 16, color: isDark ? AppThemeData.grey500 : AppThemeData.grey400),
|
||||
style: TextStyle(
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontSize: 16,
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.grey500
|
||||
: AppThemeData.grey400,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -305,12 +484,17 @@ class GiftCardScreen extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: Container(
|
||||
color: isDark ? AppThemeData.grey900 : AppThemeData.grey50,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 20),
|
||||
color:
|
||||
isDark ? AppThemeData.grey900 : AppThemeData.grey50,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 20,
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20),
|
||||
child: RoundedButtonFill(
|
||||
title: "${'Pay'.tr()} ${Constant.amountShow(amount: controller.amountController.value.text)}",
|
||||
title:
|
||||
"${'Pay'.tr()} ${Constant.amountShow(amount: controller.amountController.value.text)}",
|
||||
height: 5.5,
|
||||
color: AppThemeData.primary300,
|
||||
textColor: AppThemeData.grey50,
|
||||
|
||||
@@ -4,7 +4,7 @@ import 'package:customer/models/gift_cards_order_model.dart';
|
||||
import 'package:customer/themes/app_them_data.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get.dart' hide Trans;
|
||||
import '../../../controllers/theme_controller.dart';
|
||||
import '../../../widget/my_separator.dart';
|
||||
|
||||
@@ -19,7 +19,12 @@ class HistoryGiftCard extends StatelessWidget {
|
||||
init: HistoryGiftCardController(),
|
||||
builder: (controller) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(backgroundColor: isDark ? AppThemeData.surfaceDark : AppThemeData.surface, centerTitle: false, titleSpacing: 0),
|
||||
appBar: AppBar(
|
||||
backgroundColor:
|
||||
isDark ? AppThemeData.surfaceDark : AppThemeData.surface,
|
||||
centerTitle: false,
|
||||
titleSpacing: 0,
|
||||
),
|
||||
body:
|
||||
controller.isLoading.value
|
||||
? Constant.loader()
|
||||
@@ -27,61 +32,114 @@ class HistoryGiftCard extends StatelessWidget {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child:
|
||||
controller.giftCardsOrderList.isEmpty
|
||||
? Constant.showEmptyView(message: "Purchased Gift card not found".tr())
|
||||
? Constant.showEmptyView(
|
||||
message: "Purchased Gift card not found".tr(),
|
||||
)
|
||||
: ListView.builder(
|
||||
itemCount: controller.giftCardsOrderList.length,
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (context, index) {
|
||||
GiftCardsOrderModel giftCardOrderModel = controller.giftCardsOrderList[index];
|
||||
GiftCardsOrderModel giftCardOrderModel =
|
||||
controller.giftCardsOrderList[index];
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(vertical: 4),
|
||||
decoration: ShapeDecoration(color: isDark ? AppThemeData.grey900 : AppThemeData.grey50, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8))),
|
||||
margin: const EdgeInsets.symmetric(
|
||||
vertical: 4,
|
||||
),
|
||||
decoration: ShapeDecoration(
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.grey900
|
||||
: AppThemeData.grey50,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
giftCardOrderModel.giftTitle.toString(),
|
||||
giftCardOrderModel.giftTitle
|
||||
.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: isDark ? AppThemeData.ecommerce300 : AppThemeData.ecommerce300,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData
|
||||
.ecommerce300
|
||||
: AppThemeData
|
||||
.ecommerce300,
|
||||
fontFamily:
|
||||
AppThemeData.semiBold,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
Constant.amountShow(amount: giftCardOrderModel.price.toString()),
|
||||
Constant.amountShow(
|
||||
amount:
|
||||
giftCardOrderModel.price
|
||||
.toString(),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.grey50
|
||||
: AppThemeData.grey900,
|
||||
fontFamily:
|
||||
AppThemeData.semiBold,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
MySeparator(color: isDark ? AppThemeData.grey700 : AppThemeData.grey200),
|
||||
MySeparator(
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.grey700
|
||||
: AppThemeData.grey200,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"Gift Code".tr(),
|
||||
style: TextStyle(color: isDark ? AppThemeData.grey300 : AppThemeData.grey600, fontFamily: AppThemeData.semiBold, fontWeight: FontWeight.w500),
|
||||
style: TextStyle(
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.grey300
|
||||
: AppThemeData
|
||||
.grey600,
|
||||
fontFamily:
|
||||
AppThemeData.semiBold,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
giftCardOrderModel.giftCode.toString().replaceAllMapped(RegExp(r".{4}"), (match) => "${match.group(0)} "),
|
||||
giftCardOrderModel.giftCode
|
||||
.toString()
|
||||
.replaceAllMapped(
|
||||
RegExp(r".{4}"),
|
||||
(match) =>
|
||||
"${match.group(0)} ",
|
||||
),
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.grey50
|
||||
: AppThemeData.grey900,
|
||||
fontFamily:
|
||||
AppThemeData.semiBold,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
@@ -93,16 +151,33 @@ class HistoryGiftCard extends StatelessWidget {
|
||||
Expanded(
|
||||
child: Text(
|
||||
"Gift Pin".tr(),
|
||||
style: TextStyle(color: isDark ? AppThemeData.grey300 : AppThemeData.grey600, fontFamily: AppThemeData.semiBold, fontWeight: FontWeight.w500),
|
||||
style: TextStyle(
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.grey300
|
||||
: AppThemeData
|
||||
.grey600,
|
||||
fontFamily:
|
||||
AppThemeData.semiBold,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
giftCardOrderModel.isPasswordShow == true
|
||||
giftCardOrderModel.isPasswordShow ==
|
||||
true
|
||||
? Text(
|
||||
giftCardOrderModel.giftPin.toString(),
|
||||
giftCardOrderModel.giftPin
|
||||
.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData
|
||||
.grey50
|
||||
: AppThemeData
|
||||
.grey900,
|
||||
fontFamily:
|
||||
AppThemeData.semiBold,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
)
|
||||
@@ -110,60 +185,107 @@ class HistoryGiftCard extends StatelessWidget {
|
||||
"****",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData
|
||||
.grey50
|
||||
: AppThemeData
|
||||
.grey900,
|
||||
fontFamily:
|
||||
AppThemeData.semiBold,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
giftCardOrderModel.isPasswordShow == true
|
||||
giftCardOrderModel.isPasswordShow ==
|
||||
true
|
||||
? InkWell(
|
||||
onTap: () {
|
||||
controller.updateList(index);
|
||||
controller.updateList(
|
||||
index,
|
||||
);
|
||||
controller.update();
|
||||
},
|
||||
child: const Icon(Icons.visibility_off),
|
||||
child: const Icon(
|
||||
Icons.visibility_off,
|
||||
),
|
||||
)
|
||||
: InkWell(
|
||||
onTap: () {
|
||||
controller.updateList(index);
|
||||
controller.updateList(
|
||||
index,
|
||||
);
|
||||
controller.update();
|
||||
},
|
||||
child: const Icon(Icons.remove_red_eye),
|
||||
child: const Icon(
|
||||
Icons.remove_red_eye,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
MySeparator(color: isDark ? AppThemeData.grey700 : AppThemeData.grey200),
|
||||
MySeparator(
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.grey700
|
||||
: AppThemeData.grey200,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
controller.share(
|
||||
giftCardOrderModel.giftCode.toString(),
|
||||
giftCardOrderModel.giftPin.toString(),
|
||||
giftCardOrderModel.message.toString(),
|
||||
giftCardOrderModel.price.toString(),
|
||||
giftCardOrderModel.expireDate!,
|
||||
giftCardOrderModel.giftCode
|
||||
.toString(),
|
||||
giftCardOrderModel.giftPin
|
||||
.toString(),
|
||||
giftCardOrderModel.message
|
||||
.toString(),
|
||||
giftCardOrderModel.price
|
||||
.toString(),
|
||||
giftCardOrderModel
|
||||
.expireDate!,
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 6),
|
||||
padding:
|
||||
const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 6,
|
||||
),
|
||||
decoration: ShapeDecoration(
|
||||
color: isDark ? AppThemeData.grey700 : AppThemeData.grey200,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.grey700
|
||||
: AppThemeData
|
||||
.grey200,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisSize:
|
||||
MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
'Share'.tr(),
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey300 : AppThemeData.grey600,
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData
|
||||
.grey300
|
||||
: AppThemeData
|
||||
.grey600,
|
||||
fontSize: 14,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontFamily:
|
||||
AppThemeData
|
||||
.semiBold,
|
||||
fontWeight:
|
||||
FontWeight.w600,
|
||||
height: 0.11,
|
||||
),
|
||||
),
|
||||
@@ -175,11 +297,20 @@ class HistoryGiftCard extends StatelessWidget {
|
||||
),
|
||||
const Expanded(child: SizedBox()),
|
||||
Text(
|
||||
giftCardOrderModel.redeem == true ? "Redeemed".tr() : "Not Redeem".tr(),
|
||||
giftCardOrderModel.redeem == true
|
||||
? "Redeemed".tr()
|
||||
: "Not Redeem".tr(),
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: giftCardOrderModel.redeem == true ? AppThemeData.success400 : AppThemeData.danger300,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
color:
|
||||
giftCardOrderModel.redeem ==
|
||||
true
|
||||
? AppThemeData
|
||||
.success400
|
||||
: AppThemeData
|
||||
.danger300,
|
||||
fontFamily:
|
||||
AppThemeData.semiBold,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -11,8 +11,7 @@ import 'package:easy_localization/easy_localization.dart';
|
||||
import '../../../controllers/theme_controller.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'package:get/get.dart' hide Trans;
|
||||
import '../../../service/fire_store_utils.dart';
|
||||
import '../../../themes/show_toast_dialog.dart';
|
||||
import '../dash_board_screens/dash_board_screen.dart';
|
||||
@@ -28,7 +27,12 @@ class RedeemGiftCardScreen extends StatelessWidget {
|
||||
init: RedeemGiftCardController(),
|
||||
builder: (controller) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(backgroundColor: isDark ? AppThemeData.surfaceDark : AppThemeData.surface, centerTitle: false, titleSpacing: 0),
|
||||
appBar: AppBar(
|
||||
backgroundColor:
|
||||
isDark ? AppThemeData.surfaceDark : AppThemeData.surface,
|
||||
centerTitle: false,
|
||||
titleSpacing: 0,
|
||||
),
|
||||
body: InkWell(
|
||||
onTap: () {
|
||||
FocusScope.of(context).unfocus();
|
||||
@@ -40,11 +44,24 @@ class RedeemGiftCardScreen extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
"Redeem Gift Card".tr(),
|
||||
style: TextStyle(fontSize: 24, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, fontFamily: AppThemeData.semiBold, fontWeight: FontWeight.w500),
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
color:
|
||||
isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
"Enter your gift card code to enjoy discounts and special offers on your orders.".tr(),
|
||||
style: TextStyle(fontSize: 16, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, fontFamily: AppThemeData.regular, fontWeight: FontWeight.w400),
|
||||
"Enter your gift card code to enjoy discounts and special offers on your orders."
|
||||
.tr(),
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color:
|
||||
isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
fontFamily: AppThemeData.regular,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
TextFieldWidget(
|
||||
@@ -52,14 +69,20 @@ class RedeemGiftCardScreen extends StatelessWidget {
|
||||
controller: controller.giftCodeController.value,
|
||||
hintText: 'Enter gift code'.tr(),
|
||||
textInputType: TextInputType.number,
|
||||
prefix: Padding(padding: const EdgeInsets.all(10), child: SvgPicture.asset("assets/icons/ic_gift_code.svg")),
|
||||
prefix: Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: SvgPicture.asset("assets/icons/ic_gift_code.svg"),
|
||||
),
|
||||
),
|
||||
TextFieldWidget(
|
||||
title: 'Gift Pin'.tr(),
|
||||
controller: controller.giftPinController.value,
|
||||
hintText: 'Enter gift pin'.tr(),
|
||||
textInputType: TextInputType.number,
|
||||
prefix: Padding(padding: const EdgeInsets.all(10), child: SvgPicture.asset("assets/icons/ic_gift_pin.svg")),
|
||||
prefix: Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: SvgPicture.asset("assets/icons/ic_gift_pin.svg"),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -83,45 +106,73 @@ class RedeemGiftCardScreen extends StatelessWidget {
|
||||
ShowToastDialog.showToast("Please Enter Gift Pin".tr());
|
||||
} else {
|
||||
ShowToastDialog.showLoader("Please wait...".tr());
|
||||
await FireStoreUtils.checkRedeemCode(controller.giftCodeController.value.text.replaceAll(" ", "")).then((value) async {
|
||||
await FireStoreUtils.checkRedeemCode(
|
||||
controller.giftCodeController.value.text.replaceAll(
|
||||
" ",
|
||||
"",
|
||||
),
|
||||
).then((value) async {
|
||||
if (value != null) {
|
||||
GiftCardsOrderModel giftCodeModel = value;
|
||||
if (giftCodeModel.redeem == true) {
|
||||
ShowToastDialog.closeLoader();
|
||||
ShowToastDialog.showToast("Gift voucher already redeemed".tr());
|
||||
} else if (giftCodeModel.giftPin != controller.giftPinController.value.text) {
|
||||
ShowToastDialog.showToast(
|
||||
"Gift voucher already redeemed".tr(),
|
||||
);
|
||||
} else if (giftCodeModel.giftPin !=
|
||||
controller.giftPinController.value.text) {
|
||||
ShowToastDialog.closeLoader();
|
||||
ShowToastDialog.showToast("Gift Pin Invalid".tr());
|
||||
} else if (giftCodeModel.expireDate!.toDate().isBefore(DateTime.now())) {
|
||||
} else if (giftCodeModel.expireDate!.toDate().isBefore(
|
||||
DateTime.now(),
|
||||
)) {
|
||||
ShowToastDialog.closeLoader();
|
||||
ShowToastDialog.showToast("Gift Voucher expire".tr());
|
||||
} else {
|
||||
giftCodeModel.redeem = true;
|
||||
|
||||
WalletTransactionModel transactionModel = WalletTransactionModel(
|
||||
id: Constant.getUuid(),
|
||||
amount: double.parse(giftCodeModel.price.toString()),
|
||||
date: Timestamp.now(),
|
||||
paymentMethod: "Wallet",
|
||||
transactionUser: "user",
|
||||
userId: FireStoreUtils.getCurrentUid(),
|
||||
isTopup: true,
|
||||
note: "Gift Voucher",
|
||||
paymentStatus: "success",
|
||||
);
|
||||
WalletTransactionModel transactionModel =
|
||||
WalletTransactionModel(
|
||||
id: Constant.getUuid(),
|
||||
amount: double.parse(
|
||||
giftCodeModel.price.toString(),
|
||||
),
|
||||
date: Timestamp.now(),
|
||||
paymentMethod: "Wallet",
|
||||
transactionUser: "user",
|
||||
userId: FireStoreUtils.getCurrentUid(),
|
||||
isTopup: true,
|
||||
note: "Gift Voucher",
|
||||
paymentStatus: "success",
|
||||
);
|
||||
|
||||
await FireStoreUtils.setWalletTransaction(transactionModel).then((value) async {
|
||||
await FireStoreUtils.setWalletTransaction(
|
||||
transactionModel,
|
||||
).then((value) async {
|
||||
if (value == true) {
|
||||
await FireStoreUtils.updateUserWallet(amount: giftCodeModel.price.toString(), userId: FireStoreUtils.getCurrentUid()).then((value) async {
|
||||
await FireStoreUtils.sendTopUpMail(paymentMethod: "Gift Voucher", amount: giftCodeModel.price.toString(), tractionId: transactionModel.id.toString());
|
||||
await FireStoreUtils.placeGiftCardOrder(giftCodeModel).then((value) {
|
||||
await FireStoreUtils.updateUserWallet(
|
||||
amount: giftCodeModel.price.toString(),
|
||||
userId: FireStoreUtils.getCurrentUid(),
|
||||
).then((value) async {
|
||||
await FireStoreUtils.sendTopUpMail(
|
||||
paymentMethod: "Gift Voucher",
|
||||
amount: giftCodeModel.price.toString(),
|
||||
tractionId: transactionModel.id.toString(),
|
||||
);
|
||||
await FireStoreUtils.placeGiftCardOrder(
|
||||
giftCodeModel,
|
||||
).then((value) {
|
||||
ShowToastDialog.closeLoader();
|
||||
if (Constant.walletSetting == true) {
|
||||
Get.offAll(const DashBoardScreen());
|
||||
DashBoardController controller = Get.put(DashBoardController());
|
||||
DashBoardController controller = Get.put(
|
||||
DashBoardController(),
|
||||
);
|
||||
controller.selectedIndex.value = 2;
|
||||
}
|
||||
ShowToastDialog.showToast("Voucher redeem successfully".tr());
|
||||
ShowToastDialog.showToast(
|
||||
"Voucher redeem successfully".tr(),
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'package:customer/themes/app_them_data.dart';
|
||||
import 'package:customer/themes/round_button_fill.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get.dart' hide Trans;
|
||||
import '../../../controllers/theme_controller.dart';
|
||||
import '../../../themes/show_toast_dialog.dart';
|
||||
import '../wallet_screen/wallet_screen.dart';
|
||||
@@ -22,12 +22,22 @@ class SelectGiftPaymentScreen extends StatelessWidget {
|
||||
init: GiftCardController(),
|
||||
builder: (controller) {
|
||||
return Scaffold(
|
||||
backgroundColor: isDark ? AppThemeData.surfaceDark : AppThemeData.surface,
|
||||
backgroundColor:
|
||||
isDark ? AppThemeData.surfaceDark : AppThemeData.surface,
|
||||
appBar: AppBar(
|
||||
backgroundColor: isDark ? AppThemeData.surfaceDark : AppThemeData.surface,
|
||||
backgroundColor:
|
||||
isDark ? AppThemeData.surfaceDark : AppThemeData.surface,
|
||||
centerTitle: false,
|
||||
titleSpacing: 0,
|
||||
title: Text("Payment Option".tr(), textAlign: TextAlign.start, style: TextStyle(fontFamily: AppThemeData.medium, fontSize: 16, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900)),
|
||||
title: Text(
|
||||
"Payment Option".tr(),
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontSize: 16,
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
),
|
||||
),
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
@@ -38,7 +48,12 @@ class SelectGiftPaymentScreen extends StatelessWidget {
|
||||
Text(
|
||||
"Preferred Payment".tr(),
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(fontFamily: AppThemeData.semiBold, fontSize: 16, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900),
|
||||
style: TextStyle(
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
fontSize: 16,
|
||||
color:
|
||||
isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
if (controller.walletSettingModel.value.isEnabled == true)
|
||||
@@ -47,17 +62,39 @@ class SelectGiftPaymentScreen extends StatelessWidget {
|
||||
children: [
|
||||
Container(
|
||||
decoration: ShapeDecoration(
|
||||
color: isDark ? AppThemeData.grey900 : AppThemeData.grey50,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
|
||||
shadows: const [BoxShadow(color: Color(0x07000000), blurRadius: 20, offset: Offset(0, 0), spreadRadius: 0)],
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.grey900
|
||||
: AppThemeData.grey50,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
shadows: const [
|
||||
BoxShadow(
|
||||
color: Color(0x07000000),
|
||||
blurRadius: 20,
|
||||
offset: Offset(0, 0),
|
||||
spreadRadius: 0,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Visibility(
|
||||
visible: controller.walletSettingModel.value.isEnabled == true,
|
||||
child: cardDecoration(controller, PaymentGateway.wallet, isDark, "assets/images/ic_wallet.png"),
|
||||
visible:
|
||||
controller
|
||||
.walletSettingModel
|
||||
.value
|
||||
.isEnabled ==
|
||||
true,
|
||||
child: cardDecoration(
|
||||
controller,
|
||||
PaymentGateway.wallet,
|
||||
isDark,
|
||||
"assets/images/ic_wallet.png",
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -67,40 +104,143 @@ class SelectGiftPaymentScreen extends StatelessWidget {
|
||||
Text(
|
||||
"Other Payment Options".tr(),
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(fontFamily: AppThemeData.semiBold, fontSize: 16, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900),
|
||||
style: TextStyle(
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
fontSize: 16,
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.grey50
|
||||
: AppThemeData.grey900,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
decoration: ShapeDecoration(
|
||||
color: isDark ? AppThemeData.grey900 : AppThemeData.grey50,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
|
||||
shadows: const [BoxShadow(color: Color(0x07000000), blurRadius: 20, offset: Offset(0, 0), spreadRadius: 0)],
|
||||
color:
|
||||
isDark ? AppThemeData.grey900 : AppThemeData.grey50,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
shadows: const [
|
||||
BoxShadow(
|
||||
color: Color(0x07000000),
|
||||
blurRadius: 20,
|
||||
offset: Offset(0, 0),
|
||||
spreadRadius: 0,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Visibility(visible: controller.flutterWaveModel.value.isEnable == true, child: cardDecoration(controller, PaymentGateway.stripe, isDark, "assets/images/stripe.png")),
|
||||
Visibility(visible: controller.paytmModel.value.isEnabled == true, child: cardDecoration(controller, PaymentGateway.paypal, isDark, "assets/images/paypal.png")),
|
||||
Visibility(visible: controller.payStackModel.value.isEnable == true, child: cardDecoration(controller, PaymentGateway.payStack, isDark, "assets/images/paystack.png")),
|
||||
Visibility(
|
||||
visible: controller.mercadoPagoModel.value.isEnabled == true,
|
||||
child: cardDecoration(controller, PaymentGateway.mercadoPago, isDark, "assets/images/mercado-pago.png"),
|
||||
visible:
|
||||
controller.flutterWaveModel.value.isEnable ==
|
||||
true,
|
||||
child: cardDecoration(
|
||||
controller,
|
||||
PaymentGateway.stripe,
|
||||
isDark,
|
||||
"assets/images/stripe.png",
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible: controller.flutterWaveModel.value.isEnable == true,
|
||||
child: cardDecoration(controller, PaymentGateway.flutterWave, isDark, "assets/images/flutterwave_logo.png"),
|
||||
visible:
|
||||
controller.paytmModel.value.isEnabled == true,
|
||||
child: cardDecoration(
|
||||
controller,
|
||||
PaymentGateway.paypal,
|
||||
isDark,
|
||||
"assets/images/paypal.png",
|
||||
),
|
||||
),
|
||||
Visibility(visible: controller.payFastModel.value.isEnable == true, child: cardDecoration(controller, PaymentGateway.payFast, isDark, "assets/images/payfast.png")),
|
||||
Visibility(visible: controller.razorPayModel.value.isEnabled == true, child: cardDecoration(controller, PaymentGateway.razorpay, isDark, "assets/images/razorpay.png")),
|
||||
Visibility(visible: controller.midTransModel.value.enable == true, child: cardDecoration(controller, PaymentGateway.midTrans, isDark, "assets/images/midtrans.png")),
|
||||
Visibility(
|
||||
visible: controller.orangeMoneyModel.value.enable == true,
|
||||
child: cardDecoration(controller, PaymentGateway.orangeMoney, isDark, "assets/images/orange_money.png"),
|
||||
visible:
|
||||
controller.payStackModel.value.isEnable == true,
|
||||
child: cardDecoration(
|
||||
controller,
|
||||
PaymentGateway.payStack,
|
||||
isDark,
|
||||
"assets/images/paystack.png",
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible:
|
||||
controller.mercadoPagoModel.value.isEnabled ==
|
||||
true,
|
||||
child: cardDecoration(
|
||||
controller,
|
||||
PaymentGateway.mercadoPago,
|
||||
isDark,
|
||||
"assets/images/mercado-pago.png",
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible:
|
||||
controller.flutterWaveModel.value.isEnable ==
|
||||
true,
|
||||
child: cardDecoration(
|
||||
controller,
|
||||
PaymentGateway.flutterWave,
|
||||
isDark,
|
||||
"assets/images/flutterwave_logo.png",
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible:
|
||||
controller.payFastModel.value.isEnable == true,
|
||||
child: cardDecoration(
|
||||
controller,
|
||||
PaymentGateway.payFast,
|
||||
isDark,
|
||||
"assets/images/payfast.png",
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible:
|
||||
controller.razorPayModel.value.isEnabled ==
|
||||
true,
|
||||
child: cardDecoration(
|
||||
controller,
|
||||
PaymentGateway.razorpay,
|
||||
isDark,
|
||||
"assets/images/razorpay.png",
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible:
|
||||
controller.midTransModel.value.enable == true,
|
||||
child: cardDecoration(
|
||||
controller,
|
||||
PaymentGateway.midTrans,
|
||||
isDark,
|
||||
"assets/images/midtrans.png",
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible:
|
||||
controller.orangeMoneyModel.value.enable ==
|
||||
true,
|
||||
child: cardDecoration(
|
||||
controller,
|
||||
PaymentGateway.orangeMoney,
|
||||
isDark,
|
||||
"assets/images/orange_money.png",
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible:
|
||||
controller.xenditModel.value.enable == true,
|
||||
child: cardDecoration(
|
||||
controller,
|
||||
PaymentGateway.xendit,
|
||||
isDark,
|
||||
"assets/images/xendit.png",
|
||||
),
|
||||
),
|
||||
Visibility(visible: controller.xenditModel.value.enable == true, child: cardDecoration(controller, PaymentGateway.xendit, isDark, "assets/images/xendit.png")),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -110,7 +250,13 @@ class SelectGiftPaymentScreen extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: Container(
|
||||
decoration: BoxDecoration(color: isDark ? AppThemeData.grey900 : AppThemeData.grey50, borderRadius: const BorderRadius.only(topLeft: Radius.circular(20), topRight: Radius.circular(20))),
|
||||
decoration: BoxDecoration(
|
||||
color: isDark ? AppThemeData.grey900 : AppThemeData.grey50,
|
||||
borderRadius: const BorderRadius.only(
|
||||
topLeft: Radius.circular(20),
|
||||
topRight: Radius.circular(20),
|
||||
),
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 20),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20),
|
||||
@@ -121,38 +267,89 @@ class SelectGiftPaymentScreen extends StatelessWidget {
|
||||
textColor: AppThemeData.grey50,
|
||||
fontSizes: 16,
|
||||
onPress: () async {
|
||||
if (controller.selectedPaymentMethod.value == PaymentGateway.stripe.name) {
|
||||
controller.stripeMakePayment(amount: controller.amountController.value.text);
|
||||
} else if (controller.selectedPaymentMethod.value == PaymentGateway.paypal.name) {
|
||||
controller.paypalPaymentSheet(controller.amountController.value.text, context);
|
||||
} else if (controller.selectedPaymentMethod.value == PaymentGateway.payStack.name) {
|
||||
controller.payStackPayment(controller.amountController.value.text);
|
||||
} else if (controller.selectedPaymentMethod.value == PaymentGateway.mercadoPago.name) {
|
||||
controller.mercadoPagoMakePayment(context: context, amount: controller.amountController.value.text);
|
||||
} else if (controller.selectedPaymentMethod.value == PaymentGateway.flutterWave.name) {
|
||||
controller.flutterWaveInitiatePayment(context: context, amount: controller.amountController.value.text);
|
||||
} else if (controller.selectedPaymentMethod.value == PaymentGateway.payFast.name) {
|
||||
controller.payFastPayment(context: context, amount: controller.amountController.value.text);
|
||||
} else if (controller.selectedPaymentMethod.value == PaymentGateway.midTrans.name) {
|
||||
controller.midtransMakePayment(context: context, amount: controller.amountController.value.text);
|
||||
} else if (controller.selectedPaymentMethod.value == PaymentGateway.orangeMoney.name) {
|
||||
controller.orangeMakePayment(context: context, amount: controller.amountController.value.text);
|
||||
} else if (controller.selectedPaymentMethod.value == PaymentGateway.xendit.name) {
|
||||
controller.xenditPayment(context, controller.amountController.value.text);
|
||||
} else if (controller.selectedPaymentMethod.value == PaymentGateway.wallet.name) {
|
||||
if (controller.selectedPaymentMethod.value ==
|
||||
PaymentGateway.stripe.name) {
|
||||
controller.stripeMakePayment(
|
||||
amount: controller.amountController.value.text,
|
||||
);
|
||||
} else if (controller.selectedPaymentMethod.value ==
|
||||
PaymentGateway.paypal.name) {
|
||||
controller.paypalPaymentSheet(
|
||||
controller.amountController.value.text,
|
||||
context,
|
||||
);
|
||||
} else if (controller.selectedPaymentMethod.value ==
|
||||
PaymentGateway.payStack.name) {
|
||||
controller.payStackPayment(
|
||||
controller.amountController.value.text,
|
||||
);
|
||||
} else if (controller.selectedPaymentMethod.value ==
|
||||
PaymentGateway.mercadoPago.name) {
|
||||
controller.mercadoPagoMakePayment(
|
||||
context: context,
|
||||
amount: controller.amountController.value.text,
|
||||
);
|
||||
} else if (controller.selectedPaymentMethod.value ==
|
||||
PaymentGateway.flutterWave.name) {
|
||||
controller.flutterWaveInitiatePayment(
|
||||
context: context,
|
||||
amount: controller.amountController.value.text,
|
||||
);
|
||||
} else if (controller.selectedPaymentMethod.value ==
|
||||
PaymentGateway.payFast.name) {
|
||||
controller.payFastPayment(
|
||||
context: context,
|
||||
amount: controller.amountController.value.text,
|
||||
);
|
||||
} else if (controller.selectedPaymentMethod.value ==
|
||||
PaymentGateway.midTrans.name) {
|
||||
controller.midtransMakePayment(
|
||||
context: context,
|
||||
amount: controller.amountController.value.text,
|
||||
);
|
||||
} else if (controller.selectedPaymentMethod.value ==
|
||||
PaymentGateway.orangeMoney.name) {
|
||||
controller.orangeMakePayment(
|
||||
context: context,
|
||||
amount: controller.amountController.value.text,
|
||||
);
|
||||
} else if (controller.selectedPaymentMethod.value ==
|
||||
PaymentGateway.xendit.name) {
|
||||
controller.xenditPayment(
|
||||
context,
|
||||
controller.amountController.value.text,
|
||||
);
|
||||
} else if (controller.selectedPaymentMethod.value ==
|
||||
PaymentGateway.wallet.name) {
|
||||
controller.placeOrder();
|
||||
} else if (controller.selectedPaymentMethod.value == PaymentGateway.razorpay.name) {
|
||||
RazorPayController().createOrderRazorPay(amount: double.parse(controller.amountController.value.text), razorpayModel: controller.razorPayModel.value).then((value) {
|
||||
if (value == null) {
|
||||
Get.back();
|
||||
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr());
|
||||
} else {
|
||||
CreateRazorPayOrderModel result = value;
|
||||
controller.openCheckout(amount: controller.amountController.value.text, orderId: result.id);
|
||||
}
|
||||
});
|
||||
} else if (controller.selectedPaymentMethod.value ==
|
||||
PaymentGateway.razorpay.name) {
|
||||
RazorPayController()
|
||||
.createOrderRazorPay(
|
||||
amount: double.parse(
|
||||
controller.amountController.value.text,
|
||||
),
|
||||
razorpayModel: controller.razorPayModel.value,
|
||||
)
|
||||
.then((value) {
|
||||
if (value == null) {
|
||||
Get.back();
|
||||
ShowToastDialog.showToast(
|
||||
"Something went wrong, please contact admin."
|
||||
.tr(),
|
||||
);
|
||||
} else {
|
||||
CreateRazorPayOrderModel result = value;
|
||||
controller.openCheckout(
|
||||
amount: controller.amountController.value.text,
|
||||
orderId: result.id,
|
||||
);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ShowToastDialog.showToast("Please select payment method".tr());
|
||||
ShowToastDialog.showToast(
|
||||
"Please select payment method".tr(),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
@@ -163,7 +360,12 @@ class SelectGiftPaymentScreen extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Obx cardDecoration(GiftCardController controller, PaymentGateway value, isDark, String image) {
|
||||
Obx cardDecoration(
|
||||
GiftCardController controller,
|
||||
PaymentGateway value,
|
||||
isDark,
|
||||
String image,
|
||||
) {
|
||||
return Obx(
|
||||
() => Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 5),
|
||||
@@ -176,8 +378,16 @@ class SelectGiftPaymentScreen extends StatelessWidget {
|
||||
Container(
|
||||
width: 50,
|
||||
height: 50,
|
||||
decoration: ShapeDecoration(shape: RoundedRectangleBorder(side: const BorderSide(width: 1, color: Color(0xFFE5E7EB)), borderRadius: BorderRadius.circular(8))),
|
||||
child: Padding(padding: EdgeInsets.all(value.name == "payFast" ? 0 : 8.0), child: Image.asset(image)),
|
||||
decoration: ShapeDecoration(
|
||||
shape: RoundedRectangleBorder(
|
||||
side: const BorderSide(width: 1, color: Color(0xFFE5E7EB)),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(value.name == "payFast" ? 0 : 8.0),
|
||||
child: Image.asset(image),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
value.name == "wallet"
|
||||
@@ -188,12 +398,32 @@ class SelectGiftPaymentScreen extends StatelessWidget {
|
||||
Text(
|
||||
value.name.capitalizeString(),
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(fontFamily: AppThemeData.medium, fontSize: 16, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900),
|
||||
style: TextStyle(
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontSize: 16,
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.grey50
|
||||
: AppThemeData.grey900,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
Constant.amountShow(amount: controller.userModel.value.walletAmount == null ? '0.0' : controller.userModel.value.walletAmount.toString()),
|
||||
Constant.amountShow(
|
||||
amount:
|
||||
controller.userModel.value.walletAmount == null
|
||||
? '0.0'
|
||||
: controller.userModel.value.walletAmount
|
||||
.toString(),
|
||||
),
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(fontFamily: AppThemeData.semiBold, fontSize: 16, color: isDark ? AppThemeData.primary300 : AppThemeData.primary300),
|
||||
style: TextStyle(
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
fontSize: 16,
|
||||
color:
|
||||
isDark
|
||||
? AppThemeData.primary300
|
||||
: AppThemeData.primary300,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -202,14 +432,20 @@ class SelectGiftPaymentScreen extends StatelessWidget {
|
||||
child: Text(
|
||||
value.name.capitalizeString(),
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(fontFamily: AppThemeData.medium, fontSize: 16, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900),
|
||||
style: TextStyle(
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontSize: 16,
|
||||
color:
|
||||
isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
),
|
||||
),
|
||||
),
|
||||
const Expanded(child: SizedBox()),
|
||||
Radio(
|
||||
value: value.name,
|
||||
groupValue: controller.selectedPaymentMethod.value,
|
||||
activeColor: isDark ? AppThemeData.primary300 : AppThemeData.primary300,
|
||||
activeColor:
|
||||
isDark ? AppThemeData.primary300 : AppThemeData.primary300,
|
||||
onChanged: (value) {
|
||||
controller.selectedPaymentMethod.value = value.toString();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user