scroll to top/bottom
This commit is contained in:
@@ -106,6 +106,16 @@ class TabSession extends _$TabSession {
|
||||
return _sessionService.dispatchKeyEvent(keyCode: 93);
|
||||
}
|
||||
|
||||
Future<void> scrollToTop() {
|
||||
// Android KeyEvent.KEYCODE_MOVE_HOME = 122
|
||||
return _sessionService.dispatchKeyEvent(keyCode: 122);
|
||||
}
|
||||
|
||||
Future<void> scrollToBottom() {
|
||||
// Android KeyEvent.KEYCODE_MOVE_END = 123
|
||||
return _sessionService.dispatchKeyEvent(keyCode: 123);
|
||||
}
|
||||
|
||||
@override
|
||||
void build({required String? tabId}) {
|
||||
_sessionService = (tabId != null)
|
||||
|
||||
+20
@@ -353,6 +353,16 @@ final List<ToolbarButtonDefinition> toolbarButtonRegistry = [
|
||||
.pageUp();
|
||||
}
|
||||
},
|
||||
onLongPress: scope.isPreview
|
||||
? () {}
|
||||
: () async {
|
||||
final tabId = scope.selectedTabId;
|
||||
if (tabId != null) {
|
||||
await ref
|
||||
.read(tabSessionProvider(tabId: tabId).notifier)
|
||||
.scrollToTop();
|
||||
}
|
||||
},
|
||||
icon: const Icon(MdiIcons.chevronDoubleUp),
|
||||
);
|
||||
},
|
||||
@@ -373,6 +383,16 @@ final List<ToolbarButtonDefinition> toolbarButtonRegistry = [
|
||||
.pageDown();
|
||||
}
|
||||
},
|
||||
onLongPress: scope.isPreview
|
||||
? () {}
|
||||
: () async {
|
||||
final tabId = scope.selectedTabId;
|
||||
if (tabId != null) {
|
||||
await ref
|
||||
.read(tabSessionProvider(tabId: tabId).notifier)
|
||||
.scrollToBottom();
|
||||
}
|
||||
},
|
||||
icon: const Icon(MdiIcons.chevronDoubleDown),
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user