From ce8f21894e3ec27b3a6141ee4b922d555aa12c68 Mon Sep 17 00:00:00 2001 From: Lars Refsgaard <1552887+LarsRefsgaard@users.noreply.github.com> Date: Thu, 3 Aug 2023 14:17:33 +0200 Subject: [PATCH] Rename function in scoreboard card --- lib/ui/cards/scoreboard_card.dart | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/ui/cards/scoreboard_card.dart b/lib/ui/cards/scoreboard_card.dart index 87d82937..4b1ae5e2 100644 --- a/lib/ui/cards/scoreboard_card.dart +++ b/lib/ui/cards/scoreboard_card.dart @@ -56,7 +56,7 @@ class ScoreboardPersistentHeaderDelegate List childrenTasks = [ Text(model.taskCompleted.toString(), style: scoreNumberStyle.copyWith( - fontSize: calculateSize(shrinkOffset, + fontSize: calculateScrollAwareSizing(shrinkOffset, scoreNumberStyleSmall.fontSize!, scoreNumberStyle.fontSize!), color: Theme.of(context).primaryColor)), if (shrinkOffset < offsetForShrink) @@ -77,7 +77,7 @@ class ScoreboardPersistentHeaderDelegate List childrenDays = [ Text(model.daysInStudy.toString(), style: scoreNumberStyle.copyWith( - fontSize: calculateSize(shrinkOffset, + fontSize: calculateScrollAwareSizing(shrinkOffset, scoreNumberStyleSmall.fontSize!, scoreNumberStyle.fontSize!), color: Theme.of(context).primaryColor)), if (shrinkOffset < offsetForShrink) @@ -118,7 +118,7 @@ class ScoreboardPersistentHeaderDelegate Expanded( flex: 0, child: Container( - height: calculateSize( + height: calculateScrollAwareSizing( shrinkOffset, minExtent * 0.6, maxExtent * 0.6), width: 2, decoration: BoxDecoration( @@ -146,7 +146,8 @@ class ScoreboardPersistentHeaderDelegate } // A simple function that returns the font size from the scoreNumberStyle, but increasingly smaller when scrolling down. - double calculateSize(double shrinkOffset, double minSize, double maxSize) { + // Also used for the size of the divider in the middle + double calculateScrollAwareSizing(double shrinkOffset, double minSize, double maxSize) { // Calculate the normalized shrinkOffset value in the range [0, 1] double normalizedShrinkOffset = shrinkOffset / maxExtent;