|
|
|
|
@ -1,3 +1,4 @@
|
|
|
|
|
import 'dart:async';
|
|
|
|
|
|
|
|
|
|
import 'package:car_provider_app/views/subscriptions/sheet/downgrade_data_sheet.dart';
|
|
|
|
|
import 'package:car_provider_app/views/subscriptions/sheet/upgrade_package_sheet.dart';
|
|
|
|
|
@ -17,15 +18,28 @@ 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';
|
|
|
|
|
|
|
|
|
|
class SubscriptionsPage extends StatelessWidget {
|
|
|
|
|
class SubscriptionsPage extends StatefulWidget {
|
|
|
|
|
const SubscriptionsPage({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
State<SubscriptionsPage> createState() => _SubscriptionsPageState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _SubscriptionsPageState extends State<SubscriptionsPage> {
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
// TODO: implement initState
|
|
|
|
|
super.initState();
|
|
|
|
|
scheduleMicrotask(() {
|
|
|
|
|
context.read<SubscriptionsVM>().getSubscriptionBySP(
|
|
|
|
|
AppState().getUser.data?.userInfo?.providerId.toString() ?? "",
|
|
|
|
|
true,
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
context.read<SubscriptionsVM>().getSubscriptionBySP(
|
|
|
|
|
AppState().getUser.data?.userInfo?.providerId.toString() ?? "",
|
|
|
|
|
true,
|
|
|
|
|
);
|
|
|
|
|
return Scaffold(
|
|
|
|
|
appBar: const CustomAppBar(
|
|
|
|
|
title: "Subscriptions",
|
|
|
|
|
@ -65,12 +79,11 @@ class SubscriptionsPage extends StatelessWidget {
|
|
|
|
|
// AppRoutes.paymentMethodsView,
|
|
|
|
|
// arguments: PaymentTypes.subscription,
|
|
|
|
|
// );
|
|
|
|
|
if(model.tempSubscriptions[index].subscriptionTypeEnum==SubscriptionTypeEnum.upgrade){
|
|
|
|
|
showMyBottomSheet(context, child: UpgradePackageSheet(model.tempSubscriptions[index]));
|
|
|
|
|
}else{
|
|
|
|
|
if (model.tempSubscriptions[index].subscriptionTypeEnum == SubscriptionTypeEnum.upgrade) {
|
|
|
|
|
showMyBottomSheet(context, child: UpgradePackageSheet(model.tempSubscriptions[index]));
|
|
|
|
|
} else {
|
|
|
|
|
showMyBottomSheet(context, child: DowngradeDataSheet(model.tempSubscriptions[index]));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
|