You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
2.2 KiB
Dart
55 lines
2.2 KiB
Dart
import 'package:car_provider_app/view_models/subscriptions_view_model.dart';
|
|
import 'package:car_provider_app/views/subscriptions/widget/subscriptions_card.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:mc_common_app/classes/app_state.dart';
|
|
import 'package:mc_common_app/extensions/int_extensions.dart';
|
|
import 'package:mc_common_app/theme/colors.dart';
|
|
import 'package:mc_common_app/utils/enums.dart';
|
|
import 'package:mc_common_app/widgets/common_widgets/app_bar.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
class MySubscriptionsPage extends StatelessWidget {
|
|
const MySubscriptionsPage({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
context.read<SubscriptionsVM>().getMySubscriptions(AppState().getUser.data?.userInfo?.providerId.toString() ?? "");
|
|
return Scaffold(
|
|
appBar: const CustomAppBar(
|
|
title: "My Subscriptions",
|
|
),
|
|
body: SizedBox(
|
|
width: double.infinity,
|
|
height: double.infinity,
|
|
child: Consumer<SubscriptionsVM>(builder: (context, model, _) {
|
|
return model.state == ViewState.busy
|
|
? const Center(child: CircularProgressIndicator())
|
|
: SingleChildScrollView(
|
|
child: Column(
|
|
children: [
|
|
21.height,
|
|
ListView.separated(
|
|
itemBuilder: (BuildContext context, int index) {
|
|
return SubscriptionsCard(
|
|
model.allSubscriptions.data![index],
|
|
isSubscribed: model.allSubscriptions.data![index].isSubscribed ?? false,
|
|
backgroundColor: MyColors.darkIconColor,
|
|
);
|
|
},
|
|
separatorBuilder: (BuildContext context, int index) {
|
|
return 21.height;
|
|
},
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
shrinkWrap: true,
|
|
itemCount: model.allSubscriptions.data!.length,
|
|
),
|
|
21.height,
|
|
],
|
|
),
|
|
);
|
|
}),
|
|
),
|
|
);
|
|
}
|
|
}
|