mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-05-11 10:26:19 +02:00
refact: init values from initState to Constractor (#8817)
* refact: init values from initState to Constractor Signed-off-by: dignow <linlong1265@gmail.com> * fix: move RxBool init into Constructor Signed-off-by: dignow <linlong1265@gmail.com> * peer sort option Signed-off-by: dignow <linlong1265@gmail.com> * Remove empty initState() Signed-off-by: dignow <linlong1265@gmail.com> --------- Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
parent
2aef79688b
commit
b967d496cc
24 changed files with 120 additions and 174 deletions
|
@ -31,7 +31,6 @@ import 'mobile/pages/file_manager_page.dart';
|
||||||
import 'mobile/pages/remote_page.dart';
|
import 'mobile/pages/remote_page.dart';
|
||||||
import 'desktop/pages/remote_page.dart' as desktop_remote;
|
import 'desktop/pages/remote_page.dart' as desktop_remote;
|
||||||
import 'package:flutter_hbb/desktop/widgets/remote_toolbar.dart';
|
import 'package:flutter_hbb/desktop/widgets/remote_toolbar.dart';
|
||||||
import 'models/input_model.dart';
|
|
||||||
import 'models/model.dart';
|
import 'models/model.dart';
|
||||||
import 'models/platform_model.dart';
|
import 'models/platform_model.dart';
|
||||||
|
|
||||||
|
@ -3448,7 +3447,12 @@ setResizable(bool resizable) {
|
||||||
|
|
||||||
isOptionFixed(String key) => bind.mainIsOptionFixed(key: key);
|
isOptionFixed(String key) => bind.mainIsOptionFixed(key: key);
|
||||||
|
|
||||||
final isCustomClient = bind.isCustomClient();
|
bool? _isCustomClient;
|
||||||
|
bool get isCustomClient {
|
||||||
|
_isCustomClient ??= bind.isCustomClient();
|
||||||
|
return _isCustomClient!;
|
||||||
|
}
|
||||||
|
|
||||||
get defaultOptionLang => isCustomClient ? 'default' : '';
|
get defaultOptionLang => isCustomClient ? 'default' : '';
|
||||||
get defaultOptionTheme => isCustomClient ? 'system' : '';
|
get defaultOptionTheme => isCustomClient ? 'system' : '';
|
||||||
get defaultOptionYes => isCustomClient ? 'Y' : '';
|
get defaultOptionYes => isCustomClient ? 'Y' : '';
|
||||||
|
|
|
@ -35,11 +35,6 @@ class AddressBook extends StatefulWidget {
|
||||||
class _AddressBookState extends State<AddressBook> {
|
class _AddressBookState extends State<AddressBook> {
|
||||||
var menuPos = RelativeRect.fill;
|
var menuPos = RelativeRect.fill;
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => Obx(() {
|
Widget build(BuildContext context) => Obx(() {
|
||||||
if (!gFFI.userModel.isLogin) {
|
if (!gFFI.userModel.isLogin) {
|
||||||
|
|
|
@ -142,11 +142,6 @@ class _WidgetOPState extends State<WidgetOP> {
|
||||||
String _failedMsg = '';
|
String _failedMsg = '';
|
||||||
String _url = '';
|
String _url = '';
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
super.dispose();
|
super.dispose();
|
||||||
|
|
|
@ -23,11 +23,6 @@ class _MyGroupState extends State<MyGroup> {
|
||||||
RxString get searchUserText => gFFI.groupModel.searchUserText;
|
RxString get searchUserText => gFFI.groupModel.searchUserText;
|
||||||
static TextEditingController searchUserController = TextEditingController();
|
static TextEditingController searchUserController = TextEditingController();
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Obx(() {
|
return Obx(() {
|
||||||
|
|
|
@ -353,7 +353,7 @@ class Draggable extends StatefulWidget {
|
||||||
final Widget Function(BuildContext, GestureDragUpdateCallback) builder;
|
final Widget Function(BuildContext, GestureDragUpdateCallback) builder;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<StatefulWidget> createState() => _DraggableState();
|
State<StatefulWidget> createState() => _DraggableState(chatModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
class _DraggableState extends State<Draggable> {
|
class _DraggableState extends State<Draggable> {
|
||||||
|
@ -362,10 +362,8 @@ class _DraggableState extends State<Draggable> {
|
||||||
double _saveHeight = 0;
|
double _saveHeight = 0;
|
||||||
double _lastBottomHeight = 0;
|
double _lastBottomHeight = 0;
|
||||||
|
|
||||||
@override
|
_DraggableState(ChatModel? chatModel) {
|
||||||
void initState() {
|
_chatModel = chatModel;
|
||||||
super.initState();
|
|
||||||
_chatModel = widget.chatModel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get position => widget.position.pos;
|
get position => widget.position.pos;
|
||||||
|
@ -467,7 +465,8 @@ class IOSDraggable extends StatefulWidget {
|
||||||
final Widget Function(BuildContext) builder;
|
final Widget Function(BuildContext) builder;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
IOSDraggableState createState() => IOSDraggableState();
|
IOSDraggableState createState() =>
|
||||||
|
IOSDraggableState(chatModel, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
class IOSDraggableState extends State<IOSDraggable> {
|
class IOSDraggableState extends State<IOSDraggable> {
|
||||||
|
@ -478,12 +477,10 @@ class IOSDraggableState extends State<IOSDraggable> {
|
||||||
double _saveHeight = 0;
|
double _saveHeight = 0;
|
||||||
double _lastBottomHeight = 0;
|
double _lastBottomHeight = 0;
|
||||||
|
|
||||||
@override
|
IOSDraggableState(ChatModel? chatModel, double w, double h) {
|
||||||
void initState() {
|
_chatModel = chatModel;
|
||||||
super.initState();
|
_width = w;
|
||||||
_chatModel = widget.chatModel;
|
_height = h;
|
||||||
_width = widget.width;
|
|
||||||
_height = widget.height;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DraggableKeyPosition get position => widget.position;
|
DraggableKeyPosition get position => widget.position;
|
||||||
|
|
|
@ -76,15 +76,11 @@ class _PeerTabPageState extends State<PeerTabPage>
|
||||||
|
|
||||||
final isOptVisiableFixed = isOptionFixed(kOptionPeerTabVisible);
|
final isOptVisiableFixed = isOptionFixed(kOptionPeerTabVisible);
|
||||||
|
|
||||||
@override
|
_PeerTabPageState() {
|
||||||
void initState() {
|
_loadLocalOptions();
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
_loadLocalOptions();
|
|
||||||
});
|
|
||||||
super.initState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _loadLocalOptions() async {
|
void _loadLocalOptions() {
|
||||||
final uiType = bind.getLocalFlutterOption(k: kOptionPeerCardUiType);
|
final uiType = bind.getLocalFlutterOption(k: kOptionPeerCardUiType);
|
||||||
if (uiType != '') {
|
if (uiType != '') {
|
||||||
peerCardUiType.value = int.parse(uiType) == 0
|
peerCardUiType.value = int.parse(uiType) == 0
|
||||||
|
@ -878,18 +874,13 @@ class PeerSortDropdown extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _PeerSortDropdownState extends State<PeerSortDropdown> {
|
class _PeerSortDropdownState extends State<PeerSortDropdown> {
|
||||||
@override
|
_PeerSortDropdownState() {
|
||||||
void initState() {
|
|
||||||
if (!PeerSortType.values.contains(peerSort.value)) {
|
if (!PeerSortType.values.contains(peerSort.value)) {
|
||||||
// do not change obx directly in initState, so do in future.
|
_loadLocalOptions();
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
_loadLocalOptions();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
super.initState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _loadLocalOptions() async {
|
void _loadLocalOptions() {
|
||||||
peerSort.value = PeerSortType.remoteId;
|
peerSort.value = PeerSortType.remoteId;
|
||||||
bind.setLocalFlutterOption(
|
bind.setLocalFlutterOption(
|
||||||
k: kOptionPeerSorting,
|
k: kOptionPeerSorting,
|
||||||
|
|
|
@ -45,10 +45,14 @@ class LoadEvent {
|
||||||
final peerSearchText = "".obs;
|
final peerSearchText = "".obs;
|
||||||
|
|
||||||
/// for peer sort, global obs value
|
/// for peer sort, global obs value
|
||||||
final peerSort = bind.getLocalFlutterOption(k: kOptionPeerSorting).obs;
|
RxString? _peerSort;
|
||||||
|
RxString get peerSort {
|
||||||
|
_peerSort ??= bind.getLocalFlutterOption(k: kOptionPeerSorting).obs;
|
||||||
|
return _peerSort!;
|
||||||
|
}
|
||||||
|
|
||||||
// list for listener
|
// list for listener
|
||||||
final obslist = [peerSearchText, peerSort].obs;
|
RxList<RxString> get obslist => [peerSearchText, peerSort].obs;
|
||||||
|
|
||||||
final peerSearchTextController =
|
final peerSearchTextController =
|
||||||
TextEditingController(text: peerSearchText.value);
|
TextEditingController(text: peerSearchText.value);
|
||||||
|
|
|
@ -212,14 +212,14 @@ class _ConnectionPageState extends State<ConnectionPage>
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
if (_idController.text.isEmpty) {
|
if (_idController.text.isEmpty) {
|
||||||
() async {
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||||
final lastRemoteId = await bind.mainGetLastRemoteId();
|
final lastRemoteId = await bind.mainGetLastRemoteId();
|
||||||
if (lastRemoteId != _idController.id) {
|
if (lastRemoteId != _idController.id) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_idController.id = lastRemoteId;
|
_idController.id = lastRemoteId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}();
|
});
|
||||||
}
|
}
|
||||||
Get.put<IDTextEditingController>(_idController);
|
Get.put<IDTextEditingController>(_idController);
|
||||||
windowManager.addListener(this);
|
windowManager.addListener(this);
|
||||||
|
|
|
@ -78,7 +78,8 @@ class DesktopSettingPage extends StatefulWidget {
|
||||||
DesktopSettingPage({Key? key, required this.initialTabkey}) : super(key: key);
|
DesktopSettingPage({Key? key, required this.initialTabkey}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<DesktopSettingPage> createState() => _DesktopSettingPageState();
|
State<DesktopSettingPage> createState() =>
|
||||||
|
_DesktopSettingPageState(initialTabkey);
|
||||||
|
|
||||||
static void switch2page(SettingsTabKey page) {
|
static void switch2page(SettingsTabKey page) {
|
||||||
try {
|
try {
|
||||||
|
@ -111,10 +112,8 @@ class _DesktopSettingPageState extends State<DesktopSettingPage>
|
||||||
@override
|
@override
|
||||||
bool get wantKeepAlive => true;
|
bool get wantKeepAlive => true;
|
||||||
|
|
||||||
@override
|
_DesktopSettingPageState(SettingsTabKey initialTabkey) {
|
||||||
void initState() {
|
var initialIndex = DesktopSettingPage.tabKeys.indexOf(initialTabkey);
|
||||||
super.initState();
|
|
||||||
var initialIndex = DesktopSettingPage.tabKeys.indexOf(widget.initialTabkey);
|
|
||||||
if (initialIndex == -1) {
|
if (initialIndex == -1) {
|
||||||
initialIndex = 0;
|
initialIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,21 +44,9 @@ class _DesktopTabPageState extends State<DesktopTabPage>
|
||||||
final RxBool _block = false.obs;
|
final RxBool _block = false.obs;
|
||||||
// bool mouseIn = false;
|
// bool mouseIn = false;
|
||||||
|
|
||||||
@override
|
_DesktopTabPageState() {
|
||||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
|
||||||
super.didChangeAppLifecycleState(state);
|
|
||||||
if (state == AppLifecycleState.resumed) {
|
|
||||||
shouldBeBlocked(_block, canBeBlocked);
|
|
||||||
} else if (state == AppLifecycleState.inactive) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
// HardwareKeyboard.instance.addHandler(_handleKeyEvent);
|
|
||||||
WidgetsBinding.instance.addObserver(this);
|
|
||||||
Get.put<DesktopTabController>(tabController);
|
|
||||||
RemoteCountState.init();
|
RemoteCountState.init();
|
||||||
|
Get.put<DesktopTabController>(tabController);
|
||||||
tabController.add(TabInfo(
|
tabController.add(TabInfo(
|
||||||
key: kTabLabelHomePage,
|
key: kTabLabelHomePage,
|
||||||
label: kTabLabelHomePage,
|
label: kTabLabelHomePage,
|
||||||
|
@ -81,6 +69,21 @@ class _DesktopTabPageState extends State<DesktopTabPage>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||||
|
super.didChangeAppLifecycleState(state);
|
||||||
|
if (state == AppLifecycleState.resumed) {
|
||||||
|
shouldBeBlocked(_block, canBeBlocked);
|
||||||
|
} else if (state == AppLifecycleState.inactive) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
// HardwareKeyboard.instance.addHandler(_handleKeyEvent);
|
||||||
|
WidgetsBinding.instance.addObserver(this);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
bool _handleKeyEvent(KeyEvent event) {
|
bool _handleKeyEvent(KeyEvent event) {
|
||||||
if (!mouseIn && event is KeyDownEvent) {
|
if (!mouseIn && event is KeyDownEvent) {
|
||||||
|
|
|
@ -34,6 +34,7 @@ class _FileManagerTabPageState extends State<FileManagerTabPage> {
|
||||||
WindowController.fromWindowId(windowId())
|
WindowController.fromWindowId(windowId())
|
||||||
.setTitle(getWindowNameWithId(id));
|
.setTitle(getWindowNameWithId(id));
|
||||||
};
|
};
|
||||||
|
tabController.onRemoved = (_, id) => onRemoveId(id);
|
||||||
tabController.add(TabInfo(
|
tabController.add(TabInfo(
|
||||||
key: params['id'],
|
key: params['id'],
|
||||||
label: params['id'],
|
label: params['id'],
|
||||||
|
@ -54,8 +55,6 @@ class _FileManagerTabPageState extends State<FileManagerTabPage> {
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
tabController.onRemoved = (_, id) => onRemoveId(id);
|
|
||||||
|
|
||||||
rustDeskWinManager.setMethodHandler((call, fromWindowId) async {
|
rustDeskWinManager.setMethodHandler((call, fromWindowId) async {
|
||||||
print(
|
print(
|
||||||
"[FileTransfer] call ${call.method} with args ${call.arguments} from window $fromWindowId to ${windowId()}");
|
"[FileTransfer] call ${call.method} with args ${call.arguments} from window $fromWindowId to ${windowId()}");
|
||||||
|
|
|
@ -19,9 +19,7 @@ class InstallPage extends StatefulWidget {
|
||||||
class _InstallPageState extends State<InstallPage> {
|
class _InstallPageState extends State<InstallPage> {
|
||||||
final tabController = DesktopTabController(tabType: DesktopTabType.main);
|
final tabController = DesktopTabController(tabType: DesktopTabType.main);
|
||||||
|
|
||||||
@override
|
_InstallPageState() {
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
Get.put<DesktopTabController>(tabController);
|
Get.put<DesktopTabController>(tabController);
|
||||||
const label = "install";
|
const label = "install";
|
||||||
tabController.add(TabInfo(
|
tabController.add(TabInfo(
|
||||||
|
@ -73,10 +71,13 @@ class _InstallPageBodyState extends State<_InstallPageBody>
|
||||||
padding: EdgeInsets.symmetric(vertical: 15, horizontal: 12),
|
padding: EdgeInsets.symmetric(vertical: 15, horizontal: 12),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
_InstallPageBodyState() {
|
||||||
|
controller = TextEditingController(text: bind.installInstallPath());
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
windowManager.addListener(this);
|
windowManager.addListener(this);
|
||||||
controller = TextEditingController(text: bind.installInstallPath());
|
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ class _PortForwardTabPageState extends State<PortForwardTabPage> {
|
||||||
WindowController.fromWindowId(windowId())
|
WindowController.fromWindowId(windowId())
|
||||||
.setTitle(getWindowNameWithId(id));
|
.setTitle(getWindowNameWithId(id));
|
||||||
};
|
};
|
||||||
|
tabController.onRemoved = (_, id) => onRemoveId(id);
|
||||||
tabController.add(TabInfo(
|
tabController.add(TabInfo(
|
||||||
key: params['id'],
|
key: params['id'],
|
||||||
label: params['id'],
|
label: params['id'],
|
||||||
|
@ -54,8 +55,6 @@ class _PortForwardTabPageState extends State<PortForwardTabPage> {
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
tabController.onRemoved = (_, id) => onRemoveId(id);
|
|
||||||
|
|
||||||
rustDeskWinManager.setMethodHandler((call, fromWindowId) async {
|
rustDeskWinManager.setMethodHandler((call, fromWindowId) async {
|
||||||
debugPrint(
|
debugPrint(
|
||||||
"[Port Forward] call ${call.method} with args ${call.arguments} from window $fromWindowId");
|
"[Port Forward] call ${call.method} with args ${call.arguments} from window $fromWindowId");
|
||||||
|
|
|
@ -64,7 +64,7 @@ class RemotePage extends StatefulWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<RemotePage> createState() {
|
State<RemotePage> createState() {
|
||||||
final state = _RemotePageState();
|
final state = _RemotePageState(id);
|
||||||
_lastState.value = state;
|
_lastState.value = state;
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
@ -94,6 +94,10 @@ class _RemotePageState extends State<RemotePage>
|
||||||
|
|
||||||
SessionID get sessionId => _ffi.sessionId;
|
SessionID get sessionId => _ffi.sessionId;
|
||||||
|
|
||||||
|
_RemotePageState(String id) {
|
||||||
|
_initStates(id);
|
||||||
|
}
|
||||||
|
|
||||||
void _initStates(String id) {
|
void _initStates(String id) {
|
||||||
initSharedStates(id);
|
initSharedStates(id);
|
||||||
_zoomCursor = PeerBoolOption.find(id, kOptionZoomCursor);
|
_zoomCursor = PeerBoolOption.find(id, kOptionZoomCursor);
|
||||||
|
@ -105,7 +109,6 @@ class _RemotePageState extends State<RemotePage>
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_initStates(widget.id);
|
|
||||||
_ffi = FFI(widget.sessionId);
|
_ffi = FFI(widget.sessionId);
|
||||||
Get.put<FFI>(_ffi, tag: widget.id);
|
Get.put<FFI>(_ffi, tag: widget.id);
|
||||||
_ffi.imageModel.addCallbackOnFirstImage((String peerId) {
|
_ffi.imageModel.addCallbackOnFirstImage((String peerId) {
|
||||||
|
@ -570,11 +573,6 @@ class _ImagePaintState extends State<ImagePaint> {
|
||||||
RxBool get remoteCursorMoved => widget.remoteCursorMoved;
|
RxBool get remoteCursorMoved => widget.remoteCursorMoved;
|
||||||
Widget Function(Widget)? get listenerBuilder => widget.listenerBuilder;
|
Widget Function(Widget)? get listenerBuilder => widget.listenerBuilder;
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final m = Provider.of<ImageModel>(context);
|
final m = Provider.of<ImageModel>(context);
|
||||||
|
|
|
@ -71,7 +71,7 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
||||||
final ffi = remotePage.ffi;
|
final ffi = remotePage.ffi;
|
||||||
bind.setCurSessionId(sessionId: ffi.sessionId);
|
bind.setCurSessionId(sessionId: ffi.sessionId);
|
||||||
}
|
}
|
||||||
WindowController.fromWindowId(windowId())
|
WindowController.fromWindowId(params['windowId'])
|
||||||
.setTitle(getWindowNameWithId(id));
|
.setTitle(getWindowNameWithId(id));
|
||||||
UnreadChatCountState.find(id).value = 0;
|
UnreadChatCountState.find(id).value = 0;
|
||||||
};
|
};
|
||||||
|
@ -98,15 +98,14 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
||||||
));
|
));
|
||||||
_update_remote_count();
|
_update_remote_count();
|
||||||
}
|
}
|
||||||
|
tabController.onRemoved = (_, id) => onRemoveId(id);
|
||||||
|
rustDeskWinManager.setMethodHandler(_remoteMethodHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
tabController.onRemoved = (_, id) => onRemoveId(id);
|
|
||||||
|
|
||||||
rustDeskWinManager.setMethodHandler(_remoteMethodHandler);
|
|
||||||
if (!_isScreenRectSet) {
|
if (!_isScreenRectSet) {
|
||||||
Future.delayed(Duration.zero, () {
|
Future.delayed(Duration.zero, () {
|
||||||
restoreWindowPosition(
|
restoreWindowPosition(
|
||||||
|
@ -121,11 +120,6 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final child = Scaffold(
|
final child = Scaffold(
|
||||||
|
|
|
@ -32,14 +32,18 @@ class DesktopServerPage extends StatefulWidget {
|
||||||
class _DesktopServerPageState extends State<DesktopServerPage>
|
class _DesktopServerPageState extends State<DesktopServerPage>
|
||||||
with WindowListener, AutomaticKeepAliveClientMixin {
|
with WindowListener, AutomaticKeepAliveClientMixin {
|
||||||
final tabController = gFFI.serverModel.tabController;
|
final tabController = gFFI.serverModel.tabController;
|
||||||
@override
|
|
||||||
void initState() {
|
_DesktopServerPageState() {
|
||||||
gFFI.ffiModel.updateEventListener(gFFI.sessionId, "");
|
gFFI.ffiModel.updateEventListener(gFFI.sessionId, "");
|
||||||
windowManager.addListener(this);
|
|
||||||
Get.put<DesktopTabController>(tabController);
|
Get.put<DesktopTabController>(tabController);
|
||||||
tabController.onRemoved = (_, id) {
|
tabController.onRemoved = (_, id) {
|
||||||
onRemoveId(id);
|
onRemoveId(id);
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
windowManager.addListener(this);
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,19 +112,7 @@ class ConnectionManagerState extends State<ConnectionManager>
|
||||||
with WidgetsBindingObserver {
|
with WidgetsBindingObserver {
|
||||||
final RxBool _block = false.obs;
|
final RxBool _block = false.obs;
|
||||||
|
|
||||||
@override
|
ConnectionManagerState() {
|
||||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
|
||||||
super.didChangeAppLifecycleState(state);
|
|
||||||
if (state == AppLifecycleState.resumed) {
|
|
||||||
if (!allowRemoteCMModification()) {
|
|
||||||
shouldBeBlocked(_block, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
gFFI.serverModel.updateClientState();
|
|
||||||
gFFI.serverModel.tabController.onSelected = (client_id_str) {
|
gFFI.serverModel.tabController.onSelected = (client_id_str) {
|
||||||
final client_id = int.tryParse(client_id_str);
|
final client_id = int.tryParse(client_id_str);
|
||||||
if (client_id != null) {
|
if (client_id != null) {
|
||||||
|
@ -140,6 +132,21 @@ class ConnectionManagerState extends State<ConnectionManager>
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
gFFI.chatModel.isConnManager = true;
|
gFFI.chatModel.isConnManager = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||||
|
super.didChangeAppLifecycleState(state);
|
||||||
|
if (state == AppLifecycleState.resumed) {
|
||||||
|
if (!allowRemoteCMModification()) {
|
||||||
|
shouldBeBlocked(_block, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
gFFI.serverModel.updateClientState();
|
||||||
WidgetsBinding.instance.addObserver(this);
|
WidgetsBinding.instance.addObserver(this);
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,24 +38,16 @@ class PopupMenuChildrenItem<T> extends mod_menu.PopupMenuEntry<T> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
MyPopupMenuItemState<T, PopupMenuChildrenItem<T>> createState() =>
|
MyPopupMenuItemState<T, PopupMenuChildrenItem<T>> createState() =>
|
||||||
MyPopupMenuItemState<T, PopupMenuChildrenItem<T>>();
|
MyPopupMenuItemState<T, PopupMenuChildrenItem<T>>(enabled?.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyPopupMenuItemState<T, W extends PopupMenuChildrenItem<T>>
|
class MyPopupMenuItemState<T, W extends PopupMenuChildrenItem<T>>
|
||||||
extends State<W> {
|
extends State<W> {
|
||||||
RxBool enabled = true.obs;
|
RxBool enabled = true.obs;
|
||||||
|
|
||||||
@override
|
MyPopupMenuItemState(bool? e) {
|
||||||
void initState() {
|
if (e != null) {
|
||||||
super.initState();
|
enabled.value = e;
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
_initEnabled();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _initEnabled() async {
|
|
||||||
if (widget.enabled != null) {
|
|
||||||
enabled.value = widget.enabled!.value;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1032,11 +1032,6 @@ class _DisplayMenuState extends State<_DisplayMenu> {
|
||||||
FFI get ffi => widget.ffi;
|
FFI get ffi => widget.ffi;
|
||||||
String get id => widget.id;
|
String get id => widget.id;
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
_screenAdjustor.updateScreen();
|
_screenAdjustor.updateScreen();
|
||||||
|
|
|
@ -227,8 +227,7 @@ typedef TabMenuBuilder = Widget Function(String key);
|
||||||
typedef LabelGetter = Rx<String> Function(String key);
|
typedef LabelGetter = Rx<String> Function(String key);
|
||||||
|
|
||||||
/// [_lastClickTime], help to handle double click
|
/// [_lastClickTime], help to handle double click
|
||||||
int _lastClickTime =
|
int _lastClickTime = 0;
|
||||||
DateTime.now().millisecondsSinceEpoch - bind.getDoubleClickTime() - 1000;
|
|
||||||
|
|
||||||
class DesktopTab extends StatefulWidget {
|
class DesktopTab extends StatefulWidget {
|
||||||
final bool showLogo;
|
final bool showLogo;
|
||||||
|
@ -727,16 +726,6 @@ class WindowActionPanel extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class WindowActionPanelState extends State<WindowActionPanel> {
|
class WindowActionPanelState extends State<WindowActionPanel> {
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool showTabDowndown() {
|
bool showTabDowndown() {
|
||||||
return widget.tabController.state.value.tabs.length > 1 &&
|
return widget.tabController.state.value.tabs.length > 1 &&
|
||||||
(widget.tabController.tabType == DesktopTabType.remoteScreen ||
|
(widget.tabController.tabType == DesktopTabType.remoteScreen ||
|
||||||
|
@ -1273,14 +1262,6 @@ class ActionIcon extends StatefulWidget {
|
||||||
class _ActionIconState extends State<ActionIcon> {
|
class _ActionIconState extends State<ActionIcon> {
|
||||||
final hover = false.obs;
|
final hover = false.obs;
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
hover.value = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Tooltip(
|
return Tooltip(
|
||||||
|
|
|
@ -50,10 +50,17 @@ class _ConnectionPageState extends State<ConnectionPage> {
|
||||||
bool isPeersLoaded = false;
|
bool isPeersLoaded = false;
|
||||||
StreamSubscription? _uniLinksSubscription;
|
StreamSubscription? _uniLinksSubscription;
|
||||||
|
|
||||||
|
_ConnectionPageState() {
|
||||||
|
if (!isWeb) _uniLinksSubscription = listenUniLinks();
|
||||||
|
_idController.addListener(() {
|
||||||
|
_idEmpty.value = _idController.text.isEmpty;
|
||||||
|
});
|
||||||
|
Get.put<IDTextEditingController>(_idController);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
if (!isWeb) _uniLinksSubscription = listenUniLinks();
|
|
||||||
if (_idController.text.isEmpty) {
|
if (_idController.text.isEmpty) {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||||
final lastRemoteId = await bind.mainGetLastRemoteId();
|
final lastRemoteId = await bind.mainGetLastRemoteId();
|
||||||
|
@ -72,11 +79,6 @@ class _ConnectionPageState extends State<ConnectionPage> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_idController.addListener(() {
|
|
||||||
_idEmpty.value = _idController.text.isEmpty;
|
|
||||||
});
|
|
||||||
Get.put<IDTextEditingController>(_idController);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -34,7 +34,7 @@ class RemotePage extends StatefulWidget {
|
||||||
final bool? isSharedPassword;
|
final bool? isSharedPassword;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<RemotePage> createState() => _RemotePageState();
|
State<RemotePage> createState() => _RemotePageState(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
class _RemotePageState extends State<RemotePage> {
|
class _RemotePageState extends State<RemotePage> {
|
||||||
|
@ -58,6 +58,12 @@ class _RemotePageState extends State<RemotePage> {
|
||||||
final TextEditingController _textController =
|
final TextEditingController _textController =
|
||||||
TextEditingController(text: initText);
|
TextEditingController(text: initText);
|
||||||
|
|
||||||
|
_RemotePageState(String id) {
|
||||||
|
initSharedStates(id);
|
||||||
|
gFFI.chatModel.voiceCallStatus.value = VoiceCallStatus.notStarted;
|
||||||
|
gFFI.dialogManager.loadMobileActionsOverlayVisible();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
@ -80,13 +86,8 @@ class _RemotePageState extends State<RemotePage> {
|
||||||
gFFI.qualityMonitorModel.checkShowQualityMonitor(sessionId);
|
gFFI.qualityMonitorModel.checkShowQualityMonitor(sessionId);
|
||||||
keyboardSubscription =
|
keyboardSubscription =
|
||||||
keyboardVisibilityController.onChange.listen(onSoftKeyboardChanged);
|
keyboardVisibilityController.onChange.listen(onSoftKeyboardChanged);
|
||||||
initSharedStates(widget.id);
|
|
||||||
gFFI.chatModel
|
gFFI.chatModel
|
||||||
.changeCurrentKey(MessageKey(widget.id, ChatModel.clientModeID));
|
.changeCurrentKey(MessageKey(widget.id, ChatModel.clientModeID));
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
gFFI.chatModel.voiceCallStatus.value = VoiceCallStatus.notStarted;
|
|
||||||
gFFI.dialogManager.loadMobileActionsOverlayVisible();
|
|
||||||
});
|
|
||||||
_blockableOverlayState.applyFfi(gFFI);
|
_blockableOverlayState.applyFfi(gFFI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -778,11 +779,6 @@ class _KeyHelpToolsState extends State<KeyHelpTools> {
|
||||||
onPressed: onPressed);
|
onPressed: onPressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
|
|
||||||
_updateRect() {
|
_updateRect() {
|
||||||
RenderObject? renderObject = _key.currentContext?.findRenderObject();
|
RenderObject? renderObject = _key.currentContext?.findRenderObject();
|
||||||
if (renderObject == null) {
|
if (renderObject == null) {
|
||||||
|
|
|
@ -88,11 +88,7 @@ class _SettingsState extends State<SettingsPage> with WidgetsBindingObserver {
|
||||||
var _hideProxy = false;
|
var _hideProxy = false;
|
||||||
var _hideNetwork = false;
|
var _hideNetwork = false;
|
||||||
|
|
||||||
@override
|
_SettingsState() {
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
WidgetsBinding.instance.addObserver(this);
|
|
||||||
|
|
||||||
_enableAbr = option2bool(
|
_enableAbr = option2bool(
|
||||||
kOptionEnableAbr, bind.mainGetOptionSync(key: kOptionEnableAbr));
|
kOptionEnableAbr, bind.mainGetOptionSync(key: kOptionEnableAbr));
|
||||||
_denyLANDiscovery = !option2bool(kOptionEnableLanDiscovery,
|
_denyLANDiscovery = !option2bool(kOptionEnableLanDiscovery,
|
||||||
|
@ -117,6 +113,12 @@ class _SettingsState extends State<SettingsPage> with WidgetsBindingObserver {
|
||||||
_hideProxy = bind.mainGetBuildinOption(key: kOptionHideProxySetting) == 'Y';
|
_hideProxy = bind.mainGetBuildinOption(key: kOptionHideProxySetting) == 'Y';
|
||||||
_hideNetwork =
|
_hideNetwork =
|
||||||
bind.mainGetBuildinOption(key: kOptionHideNetworkSetting) == 'Y';
|
bind.mainGetBuildinOption(key: kOptionHideNetworkSetting) == 'Y';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
WidgetsBinding.instance.addObserver(this);
|
||||||
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||||
var update = false;
|
var update = false;
|
||||||
|
|
|
@ -41,18 +41,16 @@ class GestureHelp extends StatefulWidget {
|
||||||
final OnTouchModeChange onTouchModeChange;
|
final OnTouchModeChange onTouchModeChange;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<StatefulWidget> createState() => _GestureHelpState();
|
State<StatefulWidget> createState() => _GestureHelpState(touchMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
class _GestureHelpState extends State<GestureHelp> {
|
class _GestureHelpState extends State<GestureHelp> {
|
||||||
var _selectedIndex;
|
late int _selectedIndex;
|
||||||
var _touchMode;
|
late bool _touchMode;
|
||||||
|
|
||||||
@override
|
_GestureHelpState(bool touchMode) {
|
||||||
void initState() {
|
_touchMode = touchMode;
|
||||||
_touchMode = widget.touchMode;
|
|
||||||
_selectedIndex = _touchMode ? 1 : 0;
|
_selectedIndex = _touchMode ? 1 : 0;
|
||||||
super.initState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -230,7 +230,6 @@ mod cpal_impl {
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
fn get_device() -> ResultType<(Device, SupportedStreamConfig)> {
|
fn get_device() -> ResultType<(Device, SupportedStreamConfig)> {
|
||||||
let audio_input = super::get_audio_input();
|
let audio_input = super::get_audio_input();
|
||||||
println!("REMOVE ME =============================== use audio input: {}", &audio_input);
|
|
||||||
if !audio_input.is_empty() {
|
if !audio_input.is_empty() {
|
||||||
return get_audio_input(&audio_input);
|
return get_audio_input(&audio_input);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue