| 
									
										
										
										
											2022-11-01 17:01:43 +08:00
										 |  |  | 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; | 
					
						
							| 
									
										
										
										
											2022-11-01 18:16:52 +08:00
										 |  |  |   final RxDouble _resizeEdgeSize = 8.0.obs; | 
					
						
							| 
									
										
										
										
											2022-11-01 17:01:43 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   int get windowId => _windowId; | 
					
						
							|  |  |  |   bool get fullscreen => _fullscreen; | 
					
						
							|  |  |  |   double get tabBarHeight => fullscreen ? 0 : kDesktopRemoteTabBarHeight; | 
					
						
							|  |  |  |   double get windowBorderWidth => fullscreen ? 0 : kWindowBorderWidth; | 
					
						
							|  |  |  |   RxBool get showTabBar => _showTabBar; | 
					
						
							| 
									
										
										
										
											2022-11-01 18:16:52 +08:00
										 |  |  |   RxDouble get resizeEdgeSize => _resizeEdgeSize; | 
					
						
							| 
									
										
										
										
											2022-11-01 17:01:43 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   setWindowId(int id) => _windowId = id; | 
					
						
							|  |  |  |   setFullscreen(bool v) { | 
					
						
							|  |  |  |     if (_fullscreen != v) { | 
					
						
							|  |  |  |       _fullscreen = v; | 
					
						
							|  |  |  |       _showTabBar.value = !_fullscreen; | 
					
						
							| 
									
										
										
										
											2022-11-01 18:16:52 +08:00
										 |  |  |       _resizeEdgeSize.value = | 
					
						
							|  |  |  |           fullscreen ? kFullScreenEdgeSize : kWindowEdgeSize; | 
					
						
							| 
									
										
										
										
											2022-11-01 17:01:43 +08:00
										 |  |  |       WindowController.fromWindowId(windowId).setFullscreen(_fullscreen); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   StateGlobal._(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   static final StateGlobal instance = StateGlobal._(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | final stateGlobal = StateGlobal.instance; |