mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-31 08:08:19 +08:00
@@ -22,7 +22,7 @@ abstract class CommonPageState<
|
|||||||
|
|
||||||
Widget onBuild(Widget child) {
|
Widget onBuild(Widget child) {
|
||||||
if (_barOffset != null) {
|
if (_barOffset != null) {
|
||||||
return NotificationListener<ScrollUpdateNotification>(
|
return NotificationListener<ScrollNotification>(
|
||||||
onNotification: onNotification,
|
onNotification: onNotification,
|
||||||
child: child,
|
child: child,
|
||||||
);
|
);
|
||||||
@@ -30,22 +30,29 @@ abstract class CommonPageState<
|
|||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool onNotification(ScrollUpdateNotification notification) {
|
void _updateOffset(double scrollDelta) {
|
||||||
if (!_mainController.useBottomNav) return false;
|
|
||||||
|
|
||||||
final metrics = notification.metrics;
|
|
||||||
if (metrics.axis == .horizontal ||
|
|
||||||
metrics.pixels < 0 ||
|
|
||||||
notification.dragDetails == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
final scrollDelta = notification.scrollDelta ?? 0.0;
|
|
||||||
_barOffset!.value = clampDouble(
|
_barOffset!.value = clampDouble(
|
||||||
_barOffset!.value + scrollDelta,
|
_barOffset!.value + scrollDelta,
|
||||||
0.0,
|
0.0,
|
||||||
StyleString.topBarHeight,
|
StyleString.topBarHeight,
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool onNotification(ScrollNotification notification) {
|
||||||
|
if (!_mainController.useBottomNav) return false;
|
||||||
|
|
||||||
|
if (notification.metrics.axis == .horizontal) return false;
|
||||||
|
|
||||||
|
if (notification is ScrollUpdateNotification) {
|
||||||
|
if (notification.dragDetails == null) return false;
|
||||||
|
_updateOffset(notification.scrollDelta ?? 0.0);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (notification is OverscrollNotification) {
|
||||||
|
_updateOffset(notification.overscroll);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class _DynamicsTabPageState
|
|||||||
_mainController.selectedIndex.value == 0;
|
_mainController.selectedIndex.value == 0;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool onNotification(ScrollUpdateNotification notification) {
|
bool onNotification(ScrollNotification notification) {
|
||||||
if (checkPage) {
|
if (checkPage) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class _MediaPageState extends CommonPageState<MinePage, MineController>
|
|||||||
_mainController.selectedIndex.value == 0;
|
_mainController.selectedIndex.value == 0;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool onNotification(ScrollUpdateNotification notification) {
|
bool onNotification(ScrollNotification notification) {
|
||||||
if (checkPage) {
|
if (checkPage) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user