mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 07:47:24 +00:00
switch chapter button
This commit is contained in:
@@ -323,6 +323,13 @@ class _ContinuousModeState extends State<_ContinuousMode>
|
||||
|
||||
void smoothTo(double offset) {
|
||||
futurePosition ??= scrollController.offset;
|
||||
if (futurePosition! > scrollController.position.maxScrollExtent &&
|
||||
offset > 0) {
|
||||
return;
|
||||
} else if (futurePosition! < scrollController.position.minScrollExtent &&
|
||||
offset < 0) {
|
||||
return;
|
||||
}
|
||||
futurePosition = futurePosition! + offset * 1.2;
|
||||
futurePosition = futurePosition!.clamp(
|
||||
scrollController.position.minScrollExtent,
|
||||
@@ -435,6 +442,27 @@ class _ContinuousModeState extends State<_ContinuousMode>
|
||||
child: widget,
|
||||
);
|
||||
|
||||
widget = NotificationListener<ScrollUpdateNotification>(
|
||||
onNotification: (notification) {
|
||||
var length = reader.maxChapter;
|
||||
if (!scrollController.hasClients) return false;
|
||||
if (scrollController.position.pixels <=
|
||||
scrollController.position.minScrollExtent &&
|
||||
reader.chapter != 1) {
|
||||
context.readerScaffold.setFloatingButton(-1);
|
||||
} else if (scrollController.position.pixels >=
|
||||
scrollController.position.maxScrollExtent &&
|
||||
reader.chapter < length) {
|
||||
context.readerScaffold.setFloatingButton(1);
|
||||
} else {
|
||||
context.readerScaffold.setFloatingButton(0);
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
child: widget,
|
||||
);
|
||||
|
||||
return PhotoView.customChild(
|
||||
backgroundDecoration: BoxDecoration(
|
||||
color: context.colorScheme.surface,
|
||||
@@ -510,7 +538,7 @@ class _ContinuousModeState extends State<_ContinuousMode>
|
||||
}
|
||||
});
|
||||
}
|
||||
if(event is KeyUpEvent) {
|
||||
if (event is KeyUpEvent) {
|
||||
return;
|
||||
}
|
||||
bool? forward;
|
||||
|
Reference in New Issue
Block a user