feat: audio page (#1518)

* feat: audio page

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>

* opt ui

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>

* impl intro, share, fav

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>

* tweaks

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>

* load prev/next

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>

---------

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
dom
2025-10-11 22:16:16 +08:00
committed by GitHub
parent a65edab7d1
commit 16f577f3fd
62 changed files with 49877 additions and 774 deletions

View File

@@ -21,6 +21,7 @@ abstract class CommonPageState<
double? _lastScrollPosition; // 记录上次滚动位置
final _enableScrollThreshold = Pref.enableScrollThreshold;
late final double _scrollThreshold = Pref.scrollThreshold; // 滚动阈值
late final scrollController = controller.scrollController;
@override
void initState() {
@@ -29,25 +30,38 @@ abstract class CommonPageState<
mainStream = Get.find<MainController>().bottomBarStream;
searchBarStream = Get.find<HomeController>().searchBarStream;
} catch (_) {}
if (mainStream != null || searchBarStream != null) {
if (_enableScrollThreshold &&
(mainStream != null || searchBarStream != null)) {
controller.scrollController.addListener(listener);
}
}
void listener() {
final scrollController = controller.scrollController;
final direction = scrollController.position.userScrollDirection;
if (!_enableScrollThreshold) {
if (direction == ScrollDirection.forward) {
mainStream?.add(true);
searchBarStream?.add(true);
} else if (direction == ScrollDirection.reverse) {
mainStream?.add(false);
searchBarStream?.add(false);
}
return;
Widget onBuild(Widget child) {
if (!_enableScrollThreshold &&
(mainStream != null || searchBarStream != null)) {
return NotificationListener<UserScrollNotification>(
onNotification: onNotification,
child: child,
);
}
return child;
}
bool onNotification(UserScrollNotification notification) {
if (notification.metrics.axis == Axis.horizontal) return false;
final direction = notification.direction;
if (direction == ScrollDirection.forward) {
mainStream?.add(true);
searchBarStream?.add(true);
} else if (direction == ScrollDirection.reverse) {
mainStream?.add(false);
searchBarStream?.add(false);
}
return false;
}
void listener() {
final direction = scrollController.position.userScrollDirection;
final double currentPosition = scrollController.position.pixels;