Skip to content

Commit

Permalink
Rename function in scoreboard card
Browse files Browse the repository at this point in the history
  • Loading branch information
LarsRefsgaard committed Aug 3, 2023
1 parent ae494c4 commit ce8f218
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/ui/cards/scoreboard_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class ScoreboardPersistentHeaderDelegate
List<Widget> 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)
Expand All @@ -77,7 +77,7 @@ class ScoreboardPersistentHeaderDelegate
List<Widget> 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)
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit ce8f218

Please sign in to comment.