refact, separate remote window, try active session

Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
dignow
2023-08-02 20:38:09 +08:00
parent f495bf105f
commit 773a74e2a9
12 changed files with 54 additions and 42 deletions

View File

@@ -147,8 +147,10 @@ class DesktopTabController {
/// For addTab, tabPage has not been initialized, set [callOnSelected] to false,
/// and call [onSelected] at the end of initState
void jumpTo(int index, {bool callOnSelected = true}) {
if (!isDesktop || index < 0) return;
bool jumpTo(int index, {bool callOnSelected = true}) {
if (!isDesktop || index < 0) {
return false;
}
state.update((val) {
val!.selected = index;
Future.delayed(Duration(milliseconds: 100), (() {
@@ -169,8 +171,13 @@ class DesktopTabController {
onSelected?.call(key);
}
}
return true;
}
bool jumpToByKey(String key, {bool callOnSelected = true}) =>
jumpTo(state.value.tabs.indexWhere((tab) => tab.key == key),
callOnSelected: callOnSelected);
void closeBy(String? key) {
if (!isDesktop) return;
assert(onRemoved != null);