Steps Progression
This commit is contained in:
@@ -28,6 +28,7 @@ class _ProjectDetailsState extends State<ProjectDetails> {
|
|||||||
int totalTimeSpent = 0;
|
int totalTimeSpent = 0;
|
||||||
List<ProjectChartData> timeSpentData = [];
|
List<ProjectChartData> timeSpentData = [];
|
||||||
List<ProjectChartData> timeProgressionData = [];
|
List<ProjectChartData> timeProgressionData = [];
|
||||||
|
List<ProjectChartData> stepsProgressionData = [];
|
||||||
|
|
||||||
String chartOption = 'Time Spent';
|
String chartOption = 'Time Spent';
|
||||||
DateTimeRange? chartRange;
|
DateTimeRange? chartRange;
|
||||||
@@ -75,6 +76,21 @@ class _ProjectDetailsState extends State<ProjectDetails> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
chartRange ??= (lastDateTime != null && firstDateTime != null) ? DateTimeRange(end: lastDateTime!, start: firstDateTime!) : null;
|
chartRange ??= (lastDateTime != null && firstDateTime != null) ? DateTimeRange(end: lastDateTime!, start: firstDateTime!) : null;
|
||||||
|
List<ProjectStep> steps = project.steps;
|
||||||
|
steps.sort((a,b)=> (a.finishedDate??DateTime(0,0,0)).compareTo(b.finishedDate?? DateTime(0,0,0)));
|
||||||
|
int stepsCompleted = 1;
|
||||||
|
stepsProgressionData=[];
|
||||||
|
for(int i =0; i < steps.length; i++){
|
||||||
|
if(steps[i].finishedDate==null){continue;}
|
||||||
|
|
||||||
|
if(steps[i].finishedDate!.isAfter(chartRange!.start) && steps[i].finishedDate!.isBefore(chartRange!.end)){
|
||||||
|
stepsCompleted+= steps[i].eta ;
|
||||||
|
stepsProgressionData.add(ProjectChartData(steps[i].finishedDate!, stepsCompleted,metadata: steps[i].stepName));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Row(
|
title: Row(
|
||||||
@@ -168,7 +184,7 @@ class _ProjectDetailsState extends State<ProjectDetails> {
|
|||||||
"I'll show you detailed info about this day in future, When my master creates the feature");
|
"I'll show you detailed info about this day in future, When my master creates the feature");
|
||||||
},
|
},
|
||||||
color: Colors.blue),
|
color: Colors.blue),
|
||||||
if (chartOption == 'Time Progression')
|
if (chartOption == 'Time Progression' || chartOption == 'Time & Steps Progression')
|
||||||
LineSeries<ProjectChartData, String>(
|
LineSeries<ProjectChartData, String>(
|
||||||
// Bind data source
|
// Bind data source
|
||||||
dataSource: timeProgressionData,
|
dataSource: timeProgressionData,
|
||||||
@@ -180,7 +196,20 @@ class _ProjectDetailsState extends State<ProjectDetails> {
|
|||||||
showAlertDialog(context, DateFormat("MM/dd").format(timeSpentData[point.pointIndex!].day),
|
showAlertDialog(context, DateFormat("MM/dd").format(timeSpentData[point.pointIndex!].day),
|
||||||
"I'll show you detailed info about this day in future, When my master creates the feature");
|
"I'll show you detailed info about this day in future, When my master creates the feature");
|
||||||
},
|
},
|
||||||
color: Colors.blue)
|
color: Colors.blue),
|
||||||
|
if (chartOption == 'Steps Progression'|| chartOption == 'Time & Steps Progression')
|
||||||
|
LineSeries<ProjectChartData, String>(
|
||||||
|
// Bind data source
|
||||||
|
dataSource: stepsProgressionData,
|
||||||
|
xValueMapper: (ProjectChartData sales, _) => DateFormat("MM/dd").format(sales.day),
|
||||||
|
yValueMapper: (ProjectChartData sales, _) => sales.timeSpent,
|
||||||
|
dataLabelMapper: (ProjectChartData sales, _) => sales.metadata,
|
||||||
|
dataLabelSettings: DataLabelSettings(overflowMode: OverflowMode.hide, showZeroValue: false, isVisible: true),
|
||||||
|
onPointTap: (ChartPointDetails point) {
|
||||||
|
showAlertDialog(context, DateFormat("MM/dd").format(timeSpentData[point.pointIndex!].day),
|
||||||
|
"I'll show you detailed info about this day in future, When my master creates the feature");
|
||||||
|
},
|
||||||
|
color: Colors.yellow)
|
||||||
]),
|
]),
|
||||||
],
|
],
|
||||||
))),
|
))),
|
||||||
@@ -451,8 +480,9 @@ class _ProjectDetailsState extends State<ProjectDetails> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class ProjectChartData {
|
class ProjectChartData {
|
||||||
ProjectChartData(this.day, this.timeSpent);
|
ProjectChartData(this.day, this.timeSpent,{this.metadata});
|
||||||
|
|
||||||
DateTime day;
|
DateTime day;
|
||||||
int timeSpent;
|
int timeSpent;
|
||||||
|
String? metadata;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user