diff --git a/lib/views/dashboard/dashboard_page.dart b/lib/views/dashboard/dashboard_page.dart index 3282827..6d4f796 100644 --- a/lib/views/dashboard/dashboard_page.dart +++ b/lib/views/dashboard/dashboard_page.dart @@ -57,7 +57,7 @@ class _DashboardPageState extends State { final requestsVM = context.read(); await context.read().getBranchAndServices(); AdVM adVm = Provider.of(context, listen: false); - SubscriptionsVM sVM = Provider.of(context, listen: false); + SubscriptionsVM sVM = Provider.of(context, listen: false); await context.read().getMyAppointmentsForProvider({"ServiceProviderID": injector.get().getUser.data?.userInfo?.providerId.toString() ?? "0"}); adVm.populateAdsFilterList(); if (adVm.myAds.isEmpty) { @@ -82,6 +82,10 @@ class _DashboardPageState extends State { await sVM.getMySubscriptionsBySP(AppState().getUser.data?.userInfo?.providerId.toString() ?? ""); } + if (sVM.tempSubscriptions.isEmpty) { + await sVM.getSubscriptionBySP(AppState().getUser.data?.userInfo?.providerId.toString() ?? "", true); + } + // await chatVM.buildHubConnection(context); } diff --git a/lib/views/dashboard/widget/my_service_provider.dart b/lib/views/dashboard/widget/my_service_provider.dart index 60a41d3..f834dd5 100644 --- a/lib/views/dashboard/widget/my_service_provider.dart +++ b/lib/views/dashboard/widget/my_service_provider.dart @@ -25,7 +25,7 @@ class ServiceProviderWidget extends StatelessWidget { if (model.state == ViewState.busy) { return const Center(child: CircularProgressIndicator()); } else { - return model.branches!.data == null + return model.branches == null || model.branches!.data == null ? Center(child: Text(LocaleKeys.noBranchFound.tr())) : model.branches!.data!.serviceProviderBranch != null && model.branches!.data!.serviceProviderBranch!.isEmpty ? Center(child: Text(LocaleKeys.no_branch.tr())) diff --git a/lib/views/subscriptions/all_subscriptions_page.dart b/lib/views/subscriptions/all_subscriptions_page.dart index 865cfcd..bd7fecd 100644 --- a/lib/views/subscriptions/all_subscriptions_page.dart +++ b/lib/views/subscriptions/all_subscriptions_page.dart @@ -7,6 +7,8 @@ import 'package:flutter/material.dart'; import 'package:mc_common_app/classes/app_state.dart'; import 'package:mc_common_app/config/routes.dart'; import 'package:mc_common_app/extensions/int_extensions.dart'; +import 'package:mc_common_app/generated/locale_keys.g.dart'; +import 'package:mc_common_app/models/general_models/m_response.dart'; import 'package:mc_common_app/theme/colors.dart'; import 'package:mc_common_app/utils/enums.dart'; import 'package:mc_common_app/utils/navigator.dart'; @@ -17,6 +19,7 @@ import 'package:mc_common_app/widgets/common_widgets/app_bar.dart'; import 'package:mc_common_app/widgets/dropdown/dropdow_field.dart'; import 'package:mc_common_app/widgets/tab/menu_tabs.dart'; import 'package:provider/provider.dart'; +import 'package:easy_localization/easy_localization.dart'; class SubscriptionsPage extends StatefulWidget { const SubscriptionsPage({Key? key}) : super(key: key); @@ -41,50 +44,49 @@ class _SubscriptionsPageState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: const CustomAppBar( - title: "Subscriptions", + appBar: CustomAppBar( + title: LocaleKeys.subscriptions.tr(), ), body: SizedBox( width: double.infinity, height: double.infinity, - child: Consumer(builder: (context, model, _) { - return model.state == ViewState.busy + child: Consumer(builder: (context, subcriptionsVM, _) { + return subcriptionsVM.state == ViewState.busy ? const Center(child: CircularProgressIndicator()) : SingleChildScrollView( child: Column( children: [ 21.height, MenuTabs( - model.selectedIndex, - model.monthlyTabs, + subcriptionsVM.monthlyTabs, selectedColor: MyColors.primaryColor, - onSelect: (DropValue selectedValue) { - model.selectedMothlyTab = selectedValue; - // model.selectedIndex = selectedIndex; - model.filterSubscriptions(); - model.setState(ViewState.idle); + onSelected: (DropValue selectedValue, int index) { + subcriptionsVM.selectedMothlyTab = selectedValue; + subcriptionsVM.monthlyTabs.forEach((element) => element.isEnabled = false); + subcriptionsVM.monthlyTabs[index].isEnabled = true; + subcriptionsVM.filterSubscriptions(); + subcriptionsVM.setState(ViewState.idle); }, ), 21.height, ListView.separated( itemBuilder: (BuildContext context, int index) { return AllSubscriptionsCard( - model.tempSubscriptions[index], - isSubscribed: model.tempSubscriptions[index].isSubscribed ?? false, - isMainPage: false, - onRenewSubscriptionClick: () { - // context.read().updateOrderProviderSubscriptionId(id: model.tempSubscriptions[index].id??0); - // navigateWithName( - // context, - // AppRoutes.paymentMethodsView, - // arguments: PaymentTypes.subscription, - // ); - if (model.tempSubscriptions[index].subscriptionTypeEnum == SubscriptionTypeEnum.upgrade) { - showMyBottomSheet(context, child: UpgradePackageSheet(model.tempSubscriptions[index])); - } else { - showMyBottomSheet(context, child: DowngradeDataSheet(model.tempSubscriptions[index])); + subcriptionsVM.tempSubscriptions[index], + isSubscribed: subcriptionsVM.tempSubscriptions[index].isSubscribed ?? false, + onRenewSubscriptionClick: () async { + MResponse response = await subcriptionsVM.createSubscriptionOrder(subcriptionsVM.tempSubscriptions[index].id ?? 0, true, true); + if (response.data != null) { + context.read().updateOrderProviderSubscriptionId(id: response.data ?? 0); + navigateWithName(context, AppRoutes.paymentMethodsView, arguments: PaymentTypes.subscription); } }, + onUpgradeSubscriptionClick: () { + showMyBottomSheet(context, child: UpgradePackageSheet(subcriptionsVM.tempSubscriptions[index])); + }, + onDowngradeSubscriptionClick: () { + showMyBottomSheet(context, child: DowngradeDataSheet(subcriptionsVM.tempSubscriptions[index])); + }, ); }, separatorBuilder: (BuildContext context, int index) { @@ -92,7 +94,7 @@ class _SubscriptionsPageState extends State { }, physics: const NeverScrollableScrollPhysics(), shrinkWrap: true, - itemCount: model.tempSubscriptions.length, + itemCount: subcriptionsVM.tempSubscriptions.length, ), 21.height, ], diff --git a/lib/views/subscriptions/my_subscritions_page.dart b/lib/views/subscriptions/my_subscritions_page.dart index 7ff6815..6773dec 100644 --- a/lib/views/subscriptions/my_subscritions_page.dart +++ b/lib/views/subscriptions/my_subscritions_page.dart @@ -1,7 +1,9 @@ +import 'dart:async'; import 'dart:developer'; import 'package:car_provider_app/config/provider_routes.dart'; import 'package:car_provider_app/views/subscriptions/sheet/select_package_sheet.dart'; +import 'package:car_provider_app/views/subscriptions/sheet/upgrade_package_sheet.dart'; import 'package:car_provider_app/views/subscriptions/widget/all_subscriptions_card.dart'; import 'package:car_provider_app/views/subscriptions/widget/my_subscriptions_card.dart'; import 'package:flutter/material.dart'; @@ -10,6 +12,7 @@ import 'package:mc_common_app/config/routes.dart'; import 'package:mc_common_app/extensions/int_extensions.dart'; import 'package:mc_common_app/generated/locale_keys.g.dart'; import 'package:mc_common_app/models/general_models/m_response.dart'; +import 'package:mc_common_app/models/subscriptions_models/subscription_model.dart'; import 'package:mc_common_app/theme/colors.dart'; import 'package:mc_common_app/utils/enums.dart'; import 'package:mc_common_app/utils/navigator.dart'; @@ -19,19 +22,30 @@ import 'package:mc_common_app/view_models/subscriptions_view_model.dart'; import 'package:mc_common_app/widgets/bottom_sheet.dart'; import 'package:mc_common_app/widgets/button/show_fill_button.dart'; import 'package:mc_common_app/widgets/common_widgets/app_bar.dart'; -import 'package:mc_common_app/widgets/extensions/extensions_widget.dart'; import 'package:provider/provider.dart'; import 'package:easy_localization/easy_localization.dart'; -class MySubscriptionsPage extends StatelessWidget { +class MySubscriptionsPage extends StatefulWidget { const MySubscriptionsPage({Key? key}) : super(key: key); + @override + State createState() => _MySubscriptionsPageState(); +} + +class _MySubscriptionsPageState extends State { + @override + void initState() { + super.initState(); + scheduleMicrotask(() { + context.read().getMySubscriptionsBySP(AppState().getUser.data?.userInfo?.providerId.toString() ?? ""); + }); + } + @override Widget build(BuildContext context) { - context.read().getMySubscriptionsBySP(AppState().getUser.data?.userInfo?.providerId.toString() ?? ""); return Scaffold( - appBar: const CustomAppBar( - title: "My Subscription", + appBar: CustomAppBar( + title: LocaleKeys.mySubscription.tr(), ), body: SizedBox( width: double.infinity, @@ -48,6 +62,7 @@ class MySubscriptionsPage extends StatelessWidget { 21.height, ListView.separated( itemBuilder: (BuildContext context, int index) { + var sub = model.mySubscriptionsBySp[index]; return MySubscriptionsCard( model.mySubscriptionsBySp[index], isSubscribed: false, @@ -58,20 +73,43 @@ class MySubscriptionsPage extends StatelessWidget { MResponse response = await model.createSubscriptionOrder(model.mySubscriptionsBySp[index].subscriptionID ?? 0, true, true); Utils.hideLoading(context); if (response.data != null) { - log("response.data: ${response.data}"); context.read().updateOrderProviderSubscriptionId(id: response.data ?? 0); - navigateWithName( - context, - AppRoutes.paymentMethodsView, - arguments: PaymentTypes.subscription, - ); + navigateWithName(context, AppRoutes.paymentMethodsView, arguments: PaymentTypes.subscription); } }, - ).onPress( - () { - showMyBottomSheet(context, child: const SelectPackageSheet()); + onUpgradeSubscriptionClick: () { + print("Upgrade"); + print(sub.toJson()); + // showMyBottomSheet( + // context, + // child: UpgradePackageSheet( + // Subscription( + // id: sub.subscriptionID, + // isMyCurrentPackage: false, + // isExpired: sub.isExpired, + // isActive: sub.isActive, + // isSubscribed: true, + // name: sub.subscriptionName, + // description: sub.subscriptionDescription, + // numberOfAds: sub.totalAds ?? 0, + // numberOfBranches: sub.totalBranches ?? 0, + // numberOfSubUsers: sub.totalSubUsers ?? 0, + // countryId: 1, + // countryName: "KSA" , + // currency: "SAR", + // price: 0, + // dateEnd: sub.dateEnd, + // dateStart: sub.dateStart + // ), + // ), + // ); }, ); + // .onPress( + // () { + // // showMyBottomSheet(context, child: const SelectPackageSheet()); + // }, + // ); }, separatorBuilder: (BuildContext context, int index) { return 21.height; diff --git a/lib/views/subscriptions/sheet/upgrade_package_sheet.dart b/lib/views/subscriptions/sheet/upgrade_package_sheet.dart index cd5d009..085b14e 100644 --- a/lib/views/subscriptions/sheet/upgrade_package_sheet.dart +++ b/lib/views/subscriptions/sheet/upgrade_package_sheet.dart @@ -1,3 +1,5 @@ +import 'dart:async'; + import 'package:flutter/material.dart'; import 'package:mc_common_app/classes/app_state.dart'; import 'package:mc_common_app/extensions/int_extensions.dart'; @@ -33,7 +35,9 @@ class _UpgradePackageSheetState extends State { void initState() { // TODO: implement initState super.initState(); - calculateUpgradePrice(); + scheduleMicrotask(() { + calculateUpgradePrice(); + }); } calculateUpgradePrice() { @@ -70,7 +74,7 @@ class _UpgradePackageSheetState extends State { 12.height, packageItem( "Now", - ("Your subscription will upgrade now. Affecting from ${DateHelper.formatAsLongDate(widget.subscription.dateEnd!)}"), + ("Your subscription will upgrade now. Affecting from ${DateHelper.formatAsLongDate(widget.subscription.dateEnd ?? DateTime.now())}"), model.newPrice.toString(), isNowSelected, ).onPress(() { @@ -82,7 +86,7 @@ class _UpgradePackageSheetState extends State { 6.height, packageItem( "Upgrade after current expiry", - ("Your subscription will upgrade after you current subscription will end. Affecting from 27 January, 2024 ${DateHelper.formatAsLongDate(widget.subscription.dateEnd!)}"), + ("Your subscription will upgrade after you current subscription will end. Affecting from 27 January, 2024 ${DateHelper.formatAsLongDate(widget.subscription.dateEnd ?? DateTime.now())}"), widget.subscription.price.toString(), isNowSelected ? false : true, ).onPress(() { @@ -102,17 +106,10 @@ class _UpgradePackageSheetState extends State { paymentType: PaymentTypes.subscription, onTempContinue: () async { Utils.showLoading(context); - MResponse mResponse = await model.payForSubscription( - widget.subscription.id!, - isNowSelected, - false, - price); + MResponse mResponse = await model.payForSubscription(widget.subscription.id!, isNowSelected, false, price); Utils.hideLoading(context); if (mResponse.messageStatus == 1) { - context - .read() - .updateOrderProviderSubscriptionId( - id: mResponse.data); + context.read().updateOrderProviderSubscriptionId(id: mResponse.data); // Utils.showToast( // "Subscriptions is successfully updated"); @@ -133,8 +130,7 @@ class _UpgradePackageSheetState extends State { ); } - Widget packageItem( - String title, String description, String price, bool isSelected) { + Widget packageItem(String title, String description, String price, bool isSelected) { return Row( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, @@ -145,8 +141,7 @@ class _UpgradePackageSheetState extends State { color: Colors.white, ).toContainer( isEnabledBorder: true, - backgroundColor: - isSelected ? MyColors.primaryColor : Colors.transparent, + backgroundColor: isSelected ? MyColors.primaryColor : Colors.transparent, borderColor: MyColors.primaryColor, borderWidget: 1, borderRadius: 0, @@ -176,10 +171,7 @@ class _UpgradePackageSheetState extends State { 2.width, Padding( padding: const EdgeInsets.only(bottom: 2), - child: "SAR".toText( - fontSize: 16, - isBold: true, - color: MyColors.lightTextColor), + child: "SAR".toText(fontSize: 16, isBold: true, color: MyColors.lightTextColor), ), ], ) diff --git a/lib/views/subscriptions/widget/all_subscriptions_card.dart b/lib/views/subscriptions/widget/all_subscriptions_card.dart index c107c82..259e35a 100644 --- a/lib/views/subscriptions/widget/all_subscriptions_card.dart +++ b/lib/views/subscriptions/widget/all_subscriptions_card.dart @@ -13,158 +13,141 @@ class AllSubscriptionsCard extends StatelessWidget { Color? backgroundColor; late Color textColor; Function onRenewSubscriptionClick; - bool isMainPage; + Function onUpgradeSubscriptionClick; + Function onDowngradeSubscriptionClick; - AllSubscriptionsCard(this.subscription, - {Key? key, - this.isSubscribed = false, - this.backgroundColor, - required this.onRenewSubscriptionClick, - this.isMainPage = true}) - : super(key: key); + AllSubscriptionsCard( + this.subscription, { + Key? key, + this.isSubscribed = false, + this.backgroundColor, + required this.onRenewSubscriptionClick, + required this.onUpgradeSubscriptionClick, + required this.onDowngradeSubscriptionClick, + }) : super(key: key); @override Widget build(BuildContext context) { textColor = backgroundColor == null ? Colors.black : Colors.white; - return InkWell( - onTap: isSubscribed - ? null - : () { - onRenewSubscriptionClick(); - }, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Expanded( - child: subscription.name.toString().toText( - fontSize: 18, - color: textColor, + // return InkWell( + // onTap: isSubscribed + // ? null + // : () { + // onRenewSubscriptionClick(); + // }, + // child: + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + child: subscription.name.toString().toText( + fontSize: 18, + color: textColor, + ), + ), + // if (isSubscribed) + // Row( + // children: [ + // Container( + // color: MyColors.white, + // padding: const EdgeInsets.all(2), + // child: const Icon( + // Icons.done, + // size: 8, + // color: MyColors.primaryColor, + // ), + // ).toCircle( + // borderRadius: 122, + // ), + // 6.width, + // "Subscribed".toText(color: Colors.white, isBold: true) + // ], + // ).toContainer( + // backgroundColor: MyColors.primaryColor, + // borderRadius: 20, + // padding: const EdgeInsets.symmetric( + // horizontal: 6, + // vertical: 3, + // ), + // ) + if (subscription.isMyCurrentPackage!) "Current Package".toText(color: MyColors.primaryColor, fontWeight: FontWeight.bold), + if (!subscription.isMyCurrentPackage!) + (subscription.subscriptionTypeEnum)! + .getStringSubscriptionTypeEnum() + .toText(color: Colors.white) + .toContainer( + backgroundColor: MyColors.primaryColor, + borderRadius: 30, + padding: const EdgeInsets.symmetric( + horizontal: 6, + vertical: 3, ), - ), - // if (isSubscribed) - // Row( - // children: [ - // Container( - // color: MyColors.white, - // padding: const EdgeInsets.all(2), - // child: const Icon( - // Icons.done, - // size: 8, - // color: MyColors.primaryColor, - // ), - // ).toCircle( - // borderRadius: 122, - // ), - // 6.width, - // "Subscribed".toText(color: Colors.white, isBold: true) - // ], - // ).toContainer( - // backgroundColor: MyColors.primaryColor, - // borderRadius: 20, - // padding: const EdgeInsets.symmetric( - // horizontal: 6, - // vertical: 3, - // ), - // ) - if (!isMainPage) - if (subscription.subscriptionTypeEnum == - SubscriptionTypeEnum.current) - "Current Package".toText(color: MyColors.primaryColor,fontWeight: FontWeight.bold), - if (isMainPage) - "Upgrade".toText(color: Colors.white).toContainer( - backgroundColor: MyColors.primaryColor, - borderRadius: 30, - padding: const EdgeInsets.symmetric( - horizontal: 6, - vertical: 3, + ) + .onPress(() { + if (subscription.subscriptionTypeEnum == SubscriptionTypeEnum.downgrade) { + onDowngradeSubscriptionClick(); + } else { + onUpgradeSubscriptionClick(); + } + }) + ], + ), + 6.height, + showItem("Ads:", subscription.numberOfAds.toString()), + showItem("Users:", subscription.numberOfSubUsers.toString()), + showItem("Branches:", subscription.numberOfBranches.toString()), + 14.height, + Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + subscription.price.toString().toText( + fontSize: 26, + isBold: true, + color: textColor, ), - ) - ], - ), - 6.height, - showItem("Ads:", subscription.numberOfAds.toString()), - showItem("Users:", subscription.numberOfSubUsers.toString()), - showItem("Branches:", subscription.numberOfBranches.toString()), - 14.height, - Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Expanded( - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - subscription.price.toString().toText( - fontSize: 26, - isBold: true, - color: textColor, - ), - 2.width, - "${subscription.currency}/Month".toText( - color: MyColors.lightTextColor, - fontSize: 16, - ), - ], - ), + 2.width, + "${subscription.currency}/Month".toText( + color: MyColors.lightTextColor, + fontSize: 16, + ), + ], ), - if (!isMainPage) - Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - (subscription.subscriptionTypeEnum == - SubscriptionTypeEnum.current) - ? "Renew".toText() - : (subscription.subscriptionTypeEnum)! - .getStringSubscriptionTypeEnum() - .toText(), - 6.width, - const Icon( - Icons.arrow_forward, - size: 16, - ) - ], - ), - ], - ), - // if (isSubscribed) - if (isMainPage) - Row( - children: [ - "Expires on ${DateHelper.formatAsDayMonthYear(subscription.dateEnd)}" - .toText( - fontSize: 14, - color: textColor, - ), - Row( - children: [ - 6.width, - "Renew".toText( - color: MyColors.primaryColor, - fontSize: 14, - textDecoration: TextDecoration.underline, - decorationColor: MyColors.primaryColor, - isBold: true, - ), - ], - ).onPress(() { - onRenewSubscriptionClick(); - }), - ], - ) - ], - ).toWhiteContainer( - width: double.infinity, - allPading: 12, - backgroundColor: backgroundColor, - margin: const EdgeInsets.symmetric( - horizontal: 21, + ), + if (subscription.isMyCurrentPackage!) + Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + (subscription.subscriptionTypeEnum == SubscriptionTypeEnum.current) ? "Renew".toText() : (subscription.subscriptionTypeEnum)!.getStringSubscriptionTypeEnum().toText(), + 6.width, + const Icon( + Icons.arrow_forward, + size: 16, + ) + ], + ).onPress(() { + onRenewSubscriptionClick(); + }), + ], ), + ], + ).toWhiteContainer( + width: double.infinity, + allPading: 12, + backgroundColor: backgroundColor, + margin: const EdgeInsets.symmetric( + horizontal: 21, ), ); + // ); } Widget showItem(String title, String value) { diff --git a/lib/views/subscriptions/widget/my_subscriptions_card.dart b/lib/views/subscriptions/widget/my_subscriptions_card.dart index 216718a..e047e16 100644 --- a/lib/views/subscriptions/widget/my_subscriptions_card.dart +++ b/lib/views/subscriptions/widget/my_subscriptions_card.dart @@ -14,105 +14,130 @@ class MySubscriptionsCard extends StatelessWidget { Color? backgroundColor; late Color textColor; Function onRenewSubscriptionClick; + Function onUpgradeSubscriptionClick; bool isMainPage; - MySubscriptionsCard(this.providerSubscriptionModel, {Key? key, this.isSubscribed = false, this.backgroundColor, required this.onRenewSubscriptionClick, this.isMainPage = true}) : super(key: key); + MySubscriptionsCard(this.providerSubscriptionModel, + {Key? key, this.isSubscribed = false, this.backgroundColor, required this.onRenewSubscriptionClick, required this.onUpgradeSubscriptionClick, this.isMainPage = true}) + : super(key: key); @override Widget build(BuildContext context) { textColor = backgroundColor == null ? Colors.black : Colors.white; - return InkWell( - onTap: isSubscribed - ? null - : () { - onRenewSubscriptionClick(); - }, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Expanded( - child: providerSubscriptionModel.subscriptionName.toString().toText( - fontSize: 18, - color: textColor, + // return InkWell( + // onTap: isSubscribed + // ? null + // : () { + // onRenewSubscriptionClick(); + // }, + // child: + + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + child: providerSubscriptionModel.subscriptionName.toString().toText( + fontSize: 18, + color: textColor, + ), + ), + // if (providerSubscriptionModel.isActive!) "Current Package".toText(color: MyColors.primaryColor, fontWeight: FontWeight.bold), + 5.width, + if (!providerSubscriptionModel.isExpired!) + Row( + children: [ + Container( + height: 15, + width: 15, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: MyColors.white, ), - ), - if (providerSubscriptionModel.isActive!) "Current Package".toText(color: MyColors.primaryColor, fontWeight: FontWeight.bold), - 5.width, - if (providerSubscriptionModel.isUpgradeNow!) - "Upgrade".toText(color: Colors.white).toContainer( - backgroundColor: MyColors.primaryColor, - borderRadius: 30, - padding: const EdgeInsets.symmetric( - horizontal: 6, - vertical: 3, - ), - ) - ], - ), - 6.height, - showItem("Ads:", providerSubscriptionModel.adsRemaining.toString()), - showItem("Users:", providerSubscriptionModel.subUsersRemaining.toString()), - showItem("Branches:", providerSubscriptionModel.branchesRemaining.toString()), - 14.height, - // Row( - // crossAxisAlignment: CrossAxisAlignment.center, - // mainAxisAlignment: MainAxisAlignment.start, - // children: [ - // Expanded( - // child: Row( - // mainAxisAlignment: MainAxisAlignment.start, - // crossAxisAlignment: CrossAxisAlignment.end, - // children: [ - // "10000".toString().toText( - // fontSize: 26, - // isBold: true, - // color: textColor, - // ), - // 2.width, - // " SAR/Month".toText( - // color: MyColors.lightTextColor, - // fontSize: 16, - // ), - // ], - // ), - // ), - // ], - // ), - Row( - children: [ - "Expires on ${DateHelper.formatAsDayMonthYear(providerSubscriptionModel.dateEnd)}".toText( - fontSize: 14, - color: textColor, - ), - if (!providerSubscriptionModel.isTrialSubscription!) - Row( - children: [ - 6.width, - "Renew".toText( + alignment: Alignment.center, + child: Icon( + Icons.done, + size: 12, color: MyColors.primaryColor, - fontSize: 14, - textDecoration: TextDecoration.underline, - decorationColor: MyColors.primaryColor, - isBold: true, ), - ], - ).onPress(() { - onRenewSubscriptionClick(); - }), - ], - ) - ], - ).toWhiteContainer( - width: double.infinity, - allPading: 12, - backgroundColor: backgroundColor, - margin: const EdgeInsets.symmetric( - horizontal: 21, + ), + 5.width, + "Subscribed".toText(color: MyColors.white) + ], + ) + .toContainer( + backgroundColor: MyColors.primaryColor, + borderRadius: 30, + padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 7), + ) + .onPress(() { + onUpgradeSubscriptionClick(); + }) + ], ), + 6.height, + showItem("Ads:", providerSubscriptionModel.adsRemaining.toString()), + showItem("Users:", providerSubscriptionModel.subUsersRemaining.toString()), + showItem("Branches:", providerSubscriptionModel.branchesRemaining.toString()), + 14.height, + // Row( + // crossAxisAlignment: CrossAxisAlignment.center, + // mainAxisAlignment: MainAxisAlignment.start, + // children: [ + // Expanded( + // child: Row( + // mainAxisAlignment: MainAxisAlignment.start, + // crossAxisAlignment: CrossAxisAlignment.end, + // children: [ + // "10000".toString().toText( + // fontSize: 26, + // isBold: true, + // color: textColor, + // ), + // 2.width, + // " SAR/Month".toText( + // color: MyColors.lightTextColor, + // fontSize: 16, + // ), + // ], + // ), + // ), + // ], + // ), + Row( + children: [ + "Expires on ${DateHelper.formatAsDayMonthYear(providerSubscriptionModel.dateEnd)}".toText( + fontSize: 14, + color: textColor, + ), + if (!providerSubscriptionModel.isTrialSubscription!) + Row( + children: [ + 6.width, + "Renew".toText( + color: MyColors.primaryColor, + fontSize: 14, + textDecoration: TextDecoration.underline, + decorationColor: MyColors.primaryColor, + isBold: true, + ), + ], + ).onPress(() { + onRenewSubscriptionClick(); + }), + ], + ) + ], + ).toWhiteContainer( + width: double.infinity, + allPading: 12, + backgroundColor: backgroundColor, + margin: const EdgeInsets.symmetric( + horizontal: 21, ), ); + //); } Widget showItem(String title, String value) {