From e63dd11f5339d7bf32e8ed77282ba09c8ac782c2 Mon Sep 17 00:00:00 2001 From: braniii Date: Wed, 3 Jul 2024 22:20:51 +0200 Subject: [PATCH] Improve readability and bugs of target weight label. --- CHANGELOG.md | 2 ++ app/lib/widget/linechart.dart | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d11e0dea..652d1dba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,10 +16,12 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] ### Other changes: - Upgraded dependencies +- Improve readability of target weight label ### Bugfix 🐛: - Fix broken color of linechart - Allow adding measurements older than 2 years +- Fix bug of showing target weight correctly using st/lb ## [0.7.0] - 2024-05-29 diff --git a/app/lib/widget/linechart.dart b/app/lib/widget/linechart.dart index 4ddec1e5..19df9e73 100644 --- a/app/lib/widget/linechart.dart +++ b/app/lib/widget/linechart.dart @@ -230,16 +230,20 @@ class _CustomLineChartState extends State { horizontalLines: [ if (targetWeight != null) HorizontalLine( - y: targetWeight, + y: targetWeight / unitScaling, color: Theme.of(context).colorScheme.tertiary, strokeWidth: 2, dashArray: [8, 6], label: HorizontalLineLabel( show: true, - alignment: Alignment.topRight, + alignment: + ip.db.sortedMeasurements.first.measurement.weight > targetWeight + ? Alignment.bottomRight + : Alignment.topRight, padding: const EdgeInsets.only(bottom: 3), style: Theme.of(context).textTheme.bodySmall!.apply( color: Theme.of(context).colorScheme.onSurface, + backgroundColor: Theme.of(context).colorScheme.surfaceContainerLow, ), labelResolver: (HorizontalLine line) => AppLocalizations.of(context)!.targetWeightShort,