Refactor chapter seeking logic in AudiobookPlayerSeekChapterButton

This commit is contained in:
Dr-Blank 2024-05-22 03:49:14 -04:00
parent 9dcfbee201
commit 4a430209af
No known key found for this signature in database
GPG key ID: 7452CC63F210A266
5 changed files with 13 additions and 21 deletions

View file

@ -1,5 +1,3 @@
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
@ -28,7 +26,7 @@ class ScaffoldWithNavBar extends HookConsumerWidget {
var percentExpanded = (playerProgress - playerMinHeight) /
(playerMaxHeight - playerMinHeight);
// Clamp the value between 0 and 1
percentExpanded = max(0, min(1, percentExpanded));
percentExpanded = percentExpanded.clamp(0.0, 1.0);
return Scaffold(
body: Stack(