flutter_desktop: remote rxbool of fullscreen

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2022-11-01 17:01:43 +08:00
parent 5df850e7de
commit b28fa19dfe
12 changed files with 128 additions and 141 deletions

View File

@@ -0,0 +1,33 @@
import 'package:desktop_multi_window/desktop_multi_window.dart';
import 'package:get/get.dart';
import '../consts.dart';
class StateGlobal {
int _windowId = -1;
bool _fullscreen = false;
final RxBool _showTabBar = true.obs;
int get windowId => _windowId;
bool get fullscreen => _fullscreen;
double get tabBarHeight => fullscreen ? 0 : kDesktopRemoteTabBarHeight;
double get windowBorderWidth => fullscreen ? 0 : kWindowBorderWidth;
RxBool get showTabBar => _showTabBar;
double get resizeEdgeSize =>
fullscreen ? kFullScreenEdgeSize : kWindowEdgeSize;
setWindowId(int id) => _windowId = id;
setFullscreen(bool v) {
if (_fullscreen != v) {
_fullscreen = v;
_showTabBar.value = !_fullscreen;
WindowController.fromWindowId(windowId).setFullscreen(_fullscreen);
}
}
StateGlobal._();
static final StateGlobal instance = StateGlobal._();
}
final stateGlobal = StateGlobal.instance;