chore: Lots of bug fixes and navigation improvements

This commit is contained in:
PartyDonut 2025-09-01 20:21:36 +02:00
parent 9bb5e81812
commit 92d5391b93
35 changed files with 513 additions and 455 deletions

View file

@ -29,7 +29,7 @@ class HideOnScroll extends ConsumerStatefulWidget {
}
class _HideOnScrollState extends ConsumerState<HideOnScroll> {
late final ScrollController scrollController = widget.controller ?? ScrollController();
late ScrollController scrollController = widget.controller ?? ScrollController();
bool isVisible = true;
@override
@ -47,6 +47,16 @@ class _HideOnScrollState extends ConsumerState<HideOnScroll> {
super.dispose();
}
@override
void didUpdateWidget(covariant HideOnScroll oldWidget) {
super.didUpdateWidget(oldWidget);
if (oldWidget.controller != widget.controller) {
scrollController.removeListener(_onScroll);
scrollController = widget.controller ?? ScrollController();
scrollController.addListener(_onScroll);
}
}
void _onScroll() {
if (!widget.canHide) {
if (!isVisible) {

View file

@ -1,3 +1,5 @@
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
@ -19,6 +21,7 @@ class HorizontalList<T> extends ConsumerStatefulWidget {
final Widget Function(BuildContext context, int index) itemBuilder;
final bool scrollToEnd;
final EdgeInsets contentPadding;
final double? dominantRatio;
final double? height;
final bool shrinkWrap;
const HorizontalList({
@ -33,6 +36,7 @@ class HorizontalList<T> extends ConsumerStatefulWidget {
this.contentPadding = const EdgeInsets.symmetric(horizontal: 16),
this.subtext,
this.shrinkWrap = false,
this.dominantRatio,
super.key,
});
@ -201,9 +205,11 @@ class _HorizontalListState extends ConsumerState<HorizontalList> {
),
const SizedBox(height: 8),
SizedBox(
height: (widget.height ??
AdaptiveLayout.poster(context).size *
ref.watch(clientSettingsProvider.select((value) => value.posterSize))),
height: widget.height ??
((AdaptiveLayout.poster(context).size *
ref.watch(clientSettingsProvider.select((value) => value.posterSize))) /
pow((widget.dominantRatio ?? 1.0), 0.55)) *
0.72,
child: ListView.separated(
controller: _scrollController,
scrollDirection: Axis.horizontal,

View file

@ -158,7 +158,7 @@ class _ProgressFloatingButtonState extends ConsumerState<ProgressFloatingButton>
}
: null,
child: FloatingActionButton(
heroTag: null,
heroTag: "Progress_Floating_Button",
onPressed: isActive ? timer.cancel : timer.play,
child: Stack(
fit: StackFit.expand,

View file

@ -14,12 +14,16 @@ class SelectableIconButton extends ConsumerStatefulWidget {
final IconData icon;
final IconData? selectedIcon;
final bool selected;
final Color? backgroundColor;
final Color? iconColor;
const SelectableIconButton({
required this.onPressed,
required this.selected,
required this.icon,
this.selectedIcon,
this.label,
this.backgroundColor,
this.iconColor,
super.key,
});
@ -37,9 +41,14 @@ class _SelectableIconButtonState extends ConsumerState<SelectableIconButton> {
message: widget.label ?? "",
child: ElevatedButton(
style: ButtonStyle(
backgroundColor: widget.selected ? WidgetStatePropertyAll(Theme.of(context).colorScheme.primary) : null,
iconColor: widget.selected ? WidgetStatePropertyAll(Theme.of(context).colorScheme.onPrimary) : null,
foregroundColor: widget.selected ? WidgetStatePropertyAll(Theme.of(context).colorScheme.onPrimary) : null,
elevation: WidgetStatePropertyAll(
widget.backgroundColor != null ? (widget.backgroundColor!.a < 1 ? 0 : null) : null),
backgroundColor: WidgetStatePropertyAll(
widget.backgroundColor ?? (widget.selected ? Theme.of(context).colorScheme.primary : null)),
iconColor: WidgetStatePropertyAll(
widget.iconColor ?? (widget.selected ? Theme.of(context).colorScheme.onPrimary : null)),
foregroundColor: WidgetStatePropertyAll(
widget.iconColor ?? (widget.selected ? Theme.of(context).colorScheme.onPrimary : null)),
padding: const WidgetStatePropertyAll(EdgeInsets.zero),
),
onPressed: loading