fix cm client authorized
This commit is contained in:
parent
5326e32128
commit
befb6ffe8f
@ -18,11 +18,11 @@ import 'models/platform_model.dart';
|
|||||||
final globalKey = GlobalKey<NavigatorState>();
|
final globalKey = GlobalKey<NavigatorState>();
|
||||||
final navigationBarKey = GlobalKey();
|
final navigationBarKey = GlobalKey();
|
||||||
|
|
||||||
var isAndroid = Platform.isAndroid;
|
final isAndroid = Platform.isAndroid;
|
||||||
var isIOS = Platform.isIOS;
|
final isIOS = Platform.isIOS;
|
||||||
|
final isDesktop = Platform.isWindows || Platform.isMacOS || Platform.isLinux;
|
||||||
var isWeb = false;
|
var isWeb = false;
|
||||||
var isWebDesktop = false;
|
var isWebDesktop = false;
|
||||||
var isDesktop = Platform.isWindows || Platform.isMacOS || Platform.isLinux;
|
|
||||||
var version = "";
|
var version = "";
|
||||||
int androidVersion = 0;
|
int androidVersion = 0;
|
||||||
|
|
||||||
|
@ -161,6 +161,7 @@ class DesktopTabBar extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static onAdd(RxList<TabInfo> tabs, TabInfo tab) {
|
static onAdd(RxList<TabInfo> tabs, TabInfo tab) {
|
||||||
|
if (!isDesktop) return;
|
||||||
int index = tabs.indexWhere((e) => e.key == tab.key);
|
int index = tabs.indexWhere((e) => e.key == tab.key);
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
selected.value = index;
|
selected.value = index;
|
||||||
@ -178,6 +179,7 @@ class DesktopTabBar extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static remove(RxList<TabInfo> tabs, int index) {
|
static remove(RxList<TabInfo> tabs, int index) {
|
||||||
|
if (!isDesktop) return;
|
||||||
if (index < 0) return;
|
if (index < 0) return;
|
||||||
if (index == tabs.length - 1) {
|
if (index == tabs.length - 1) {
|
||||||
selected.value = max(0, selected.value - 1);
|
selected.value = max(0, selected.value - 1);
|
||||||
@ -189,12 +191,14 @@ class DesktopTabBar extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void jumpTo(RxList<TabInfo> tabs, int index) {
|
static void jumpTo(RxList<TabInfo> tabs, int index) {
|
||||||
|
if (!isDesktop) return;
|
||||||
if (index < 0 || index >= tabs.length) return;
|
if (index < 0 || index >= tabs.length) return;
|
||||||
selected.value = index;
|
selected.value = index;
|
||||||
controller.value.jumpToPage(selected.value);
|
controller.value.jumpToPage(selected.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void close(String? key) {
|
static void close(String? key) {
|
||||||
|
if (!isDesktop) return;
|
||||||
final tabBar = _tabBarListViewKey.currentWidget as _ListView?;
|
final tabBar = _tabBarListViewKey.currentWidget as _ListView?;
|
||||||
if (tabBar == null) return;
|
if (tabBar == null) return;
|
||||||
final tabs = tabBar.tabs;
|
final tabs = tabBar.tabs;
|
||||||
|
@ -465,7 +465,12 @@ class ServerModel with ChangeNotifier {
|
|||||||
try {
|
try {
|
||||||
final client = Client.fromJson(jsonDecode(evt['client']));
|
final client = Client.fromJson(jsonDecode(evt['client']));
|
||||||
parent.target?.dialogManager.dismissByTag(getLoginDialogTag(client.id));
|
parent.target?.dialogManager.dismissByTag(getLoginDialogTag(client.id));
|
||||||
_clients.add(client);
|
final index = _clients.indexWhere((c) => c.id == client.id);
|
||||||
|
if (index < 0) {
|
||||||
|
_clients.add(client);
|
||||||
|
} else {
|
||||||
|
_clients[index].authorized = true;
|
||||||
|
}
|
||||||
DesktopTabBar.onAdd(
|
DesktopTabBar.onAdd(
|
||||||
tabs,
|
tabs,
|
||||||
TabInfo(
|
TabInfo(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user