feat: add goal line to progress chart
parent
fd4e07fc8c
commit
67da75fb3e
|
@ -214,6 +214,11 @@ class StatisticsService {
|
|||
return sum as int;
|
||||
}
|
||||
|
||||
double getCaloryTargetForOneDay(){
|
||||
final Box userBox = Hive.box<User>("USER_BOX");
|
||||
return userBox.get("USER").kalorien.toDouble();
|
||||
}
|
||||
|
||||
List<double> getAllEatenIngredientsForTodayStatistics(double dayLen){
|
||||
Box box = Hive.box(todayStatisticsBoxName);
|
||||
final Box userBox = Hive.box<User>("USER_BOX");
|
||||
|
|
|
@ -169,6 +169,20 @@ class ProgressPage extends StatelessWidget {
|
|||
barGroups: value,
|
||||
gridData: FlGridData(show: false),
|
||||
alignment: BarChartAlignment.spaceAround,
|
||||
extraLinesData: ExtraLinesData(
|
||||
horizontalLines: [
|
||||
HorizontalLine(
|
||||
y: StatisticsService.instance.getCaloryTargetForOneDay(), // Specify the y-value where you want the line to be positioned
|
||||
color: Colors.black, // Change the color as per your requirement
|
||||
strokeWidth: 2, // Adjust the width as needed
|
||||
dashArray: [3, 2],
|
||||
label: HorizontalLineLabel(
|
||||
show: true,
|
||||
labelResolver: (x) => "Zielwert"
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
Loading…
Reference in New Issue