|
|
|
|
@ -21,73 +21,78 @@ class ProgressFragment extends StatelessWidget {
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
const Map<String, double> statuses = {
|
|
|
|
|
"Completed": 12,
|
|
|
|
|
"In Progress": 12,
|
|
|
|
|
"Open": 12,
|
|
|
|
|
};
|
|
|
|
|
return Consumer<AllRequestsProvider>(
|
|
|
|
|
builder: (context, snapshot, _) => Column(
|
|
|
|
|
children: [
|
|
|
|
|
AspectRatio(
|
|
|
|
|
aspectRatio: 398 / 237,
|
|
|
|
|
child: PieChart(
|
|
|
|
|
dataMap: statuses,
|
|
|
|
|
animationDuration: const Duration(milliseconds: 500),
|
|
|
|
|
chartRadius: 190.toScreenWidth,
|
|
|
|
|
colorList: [AColors.statusGreen, AColors.statusBlue, AColors.statusYellowLight],
|
|
|
|
|
initialAngleInDegree: 270,
|
|
|
|
|
chartType: ChartType.ring,
|
|
|
|
|
ringStrokeWidth: 40.toScreenWidth,
|
|
|
|
|
centerText: "${context.translation.total}\n20",
|
|
|
|
|
centerTextStyle: AppTextStyles.heading5.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
|
|
|
|
|
legendOptions: const LegendOptions(showLegends: false),
|
|
|
|
|
chartValuesOptions: ChartValuesOptions(
|
|
|
|
|
chartValueBackgroundColor: Colors.transparent,
|
|
|
|
|
chartValueStyle: AppTextStyles.heading6.copyWith(color: AppColor.neutral20),
|
|
|
|
|
showChartValuesOutside: true,
|
|
|
|
|
),
|
|
|
|
|
).toShimmer(isShow: snapshot.isOpenLoading || snapshot.isInProgressLoading || snapshot.isCompleteLoading, radius: 300).paddingAll(12).toShadowContainer(context),
|
|
|
|
|
).paddingOnly(start: 16, end: 16, bottom: 16),
|
|
|
|
|
DefaultTabController(
|
|
|
|
|
length: 3,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
margin: const EdgeInsets.only(left: 16, right: 16),
|
|
|
|
|
decoration: BoxDecoration(color: AppColor.neutral30, borderRadius: BorderRadius.circular(16)),
|
|
|
|
|
child: TabBar(
|
|
|
|
|
//controller: _tabController,
|
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
|
labelColor: AppColor.neutral60,
|
|
|
|
|
unselectedLabelColor: AppColor.neutral20,
|
|
|
|
|
unselectedLabelStyle: AppTextStyles.bodyText.copyWith(color: const Color(0xFF757575)),
|
|
|
|
|
labelStyle: AppTextStyles.bodyText.copyWith(color: AppColor.neutral60),
|
|
|
|
|
indicatorPadding: const EdgeInsets.all(4),
|
|
|
|
|
indicator: BoxDecoration(color: context.isDark? AppColor.neutral20:Theme.of(context).cardColor, borderRadius: BorderRadius.circular(13)),
|
|
|
|
|
onTap: (index) {
|
|
|
|
|
// setState(() {});
|
|
|
|
|
},
|
|
|
|
|
tabs: [
|
|
|
|
|
Tab(text: context.translation.open, height: 57.toScreenHeight),
|
|
|
|
|
Tab(text: context.translation.inProgress, height: 57.toScreenHeight),
|
|
|
|
|
Tab(text: context.translation.completed, height: 57.toScreenHeight),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
builder: (context, snapshot, _) {
|
|
|
|
|
Map<String, double> statuses = {
|
|
|
|
|
"Completed": snapshot.completedRequests?.requestsDetails?.length?.toDouble() ?? 0.0,
|
|
|
|
|
"In Progress": snapshot.inProgressRequests?.requestsDetails?.length?.toDouble() ?? 0.0,
|
|
|
|
|
"Open": snapshot.openRequests.requestsDetails?.length?.toDouble() ?? 0.0,
|
|
|
|
|
};
|
|
|
|
|
int total = (snapshot.completedRequests?.requestsDetails?.length ?? 0) + (snapshot.inProgressRequests?.requestsDetails?.length ?? 0) + (snapshot.openRequests?.requestsDetails?.length ?? 0);
|
|
|
|
|
|
|
|
|
|
return Column(
|
|
|
|
|
children: [
|
|
|
|
|
AspectRatio(
|
|
|
|
|
aspectRatio: 398 / 237,
|
|
|
|
|
child: PieChart(
|
|
|
|
|
dataMap: statuses,
|
|
|
|
|
animationDuration: const Duration(milliseconds: 500),
|
|
|
|
|
chartRadius: 190.toScreenWidth,
|
|
|
|
|
colorList: [AColors.statusGreen, AColors.statusBlue, AColors.statusYellowLight],
|
|
|
|
|
initialAngleInDegree: 270,
|
|
|
|
|
chartType: ChartType.ring,
|
|
|
|
|
ringStrokeWidth: 40.toScreenWidth,
|
|
|
|
|
centerText: "${context.translation.total}\n$total",
|
|
|
|
|
centerTextStyle: AppTextStyles.heading5.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
|
|
|
|
|
legendOptions: const LegendOptions(showLegends: false),
|
|
|
|
|
chartValuesOptions: ChartValuesOptions(
|
|
|
|
|
chartValueBackgroundColor: Colors.white,
|
|
|
|
|
showChartValuesInPercentage: true,
|
|
|
|
|
chartValueStyle: AppTextStyles.heading6.copyWith(color: AppColor.neutral20),
|
|
|
|
|
showChartValuesOutside: true,
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
TabBarView(
|
|
|
|
|
children: [
|
|
|
|
|
RequestItemViewList(snapshot.openRequests?.requestsDetails ?? [], snapshot.isOpenLoading),
|
|
|
|
|
RequestItemViewList(snapshot.inProgressRequests?.requestsDetails ?? [], snapshot.isInProgressLoading),
|
|
|
|
|
RequestItemViewList(snapshot.completedRequests?.requestsDetails ?? [], snapshot.isCompleteLoading),
|
|
|
|
|
],
|
|
|
|
|
).expanded,
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
).expanded,
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
).toShimmer(isShow: snapshot.isOpenLoading || snapshot.isInProgressLoading || snapshot.isCompleteLoading, radius: 300).paddingAll(12).toShadowContainer(context),
|
|
|
|
|
).paddingOnly(start: 16, end: 16, bottom: 16),
|
|
|
|
|
DefaultTabController(
|
|
|
|
|
length: 3,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
margin: const EdgeInsets.only(left: 16, right: 16),
|
|
|
|
|
decoration: BoxDecoration(color: AppColor.neutral30, borderRadius: BorderRadius.circular(16)),
|
|
|
|
|
child: TabBar(
|
|
|
|
|
//controller: _tabController,
|
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
|
labelColor: AppColor.neutral60,
|
|
|
|
|
unselectedLabelColor: AppColor.neutral20,
|
|
|
|
|
unselectedLabelStyle: AppTextStyles.bodyText.copyWith(color: const Color(0xFF757575)),
|
|
|
|
|
labelStyle: AppTextStyles.bodyText.copyWith(color: AppColor.neutral60),
|
|
|
|
|
indicatorPadding: const EdgeInsets.all(4),
|
|
|
|
|
indicator: BoxDecoration(color: context.isDark ? AppColor.neutral20 : Theme.of(context).cardColor, borderRadius: BorderRadius.circular(13)),
|
|
|
|
|
onTap: (index) {
|
|
|
|
|
// setState(() {});
|
|
|
|
|
},
|
|
|
|
|
tabs: [
|
|
|
|
|
Tab(text: context.translation.open, height: 57.toScreenHeight),
|
|
|
|
|
Tab(text: context.translation.inProgress, height: 57.toScreenHeight),
|
|
|
|
|
Tab(text: context.translation.completed, height: 57.toScreenHeight),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
TabBarView(
|
|
|
|
|
children: [
|
|
|
|
|
RequestItemViewList(snapshot.openRequests?.requestsDetails ?? [], snapshot.isOpenLoading),
|
|
|
|
|
RequestItemViewList(snapshot.inProgressRequests?.requestsDetails ?? [], snapshot.isInProgressLoading),
|
|
|
|
|
RequestItemViewList(snapshot.completedRequests?.requestsDetails ?? [], snapshot.isCompleteLoading),
|
|
|
|
|
],
|
|
|
|
|
).expanded,
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
).expanded,
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
|