mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-13 11:35:56 +00: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:
@@ -38,24 +38,16 @@ class PopupMenuChildrenItem<T> extends mod_menu.PopupMenuEntry<T> {
|
||||
|
||||
@override
|
||||
MyPopupMenuItemState<T, PopupMenuChildrenItem<T>> createState() =>
|
||||
MyPopupMenuItemState<T, PopupMenuChildrenItem<T>>();
|
||||
MyPopupMenuItemState<T, PopupMenuChildrenItem<T>>(enabled?.value);
|
||||
}
|
||||
|
||||
class MyPopupMenuItemState<T, W extends PopupMenuChildrenItem<T>>
|
||||
extends State<W> {
|
||||
RxBool enabled = true.obs;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
_initEnabled();
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _initEnabled() async {
|
||||
if (widget.enabled != null) {
|
||||
enabled.value = widget.enabled!.value;
|
||||
MyPopupMenuItemState(bool? e) {
|
||||
if (e != null) {
|
||||
enabled.value = e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1032,11 +1032,6 @@ class _DisplayMenuState extends State<_DisplayMenu> {
|
||||
FFI get ffi => widget.ffi;
|
||||
String get id => widget.id;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
_screenAdjustor.updateScreen();
|
||||
|
||||
@@ -227,8 +227,7 @@ typedef TabMenuBuilder = Widget Function(String key);
|
||||
typedef LabelGetter = Rx<String> Function(String key);
|
||||
|
||||
/// [_lastClickTime], help to handle double click
|
||||
int _lastClickTime =
|
||||
DateTime.now().millisecondsSinceEpoch - bind.getDoubleClickTime() - 1000;
|
||||
int _lastClickTime = 0;
|
||||
|
||||
class DesktopTab extends StatefulWidget {
|
||||
final bool showLogo;
|
||||
@@ -727,16 +726,6 @@ class WindowActionPanel extends StatefulWidget {
|
||||
}
|
||||
|
||||
class WindowActionPanelState extends State<WindowActionPanel> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
bool showTabDowndown() {
|
||||
return widget.tabController.state.value.tabs.length > 1 &&
|
||||
(widget.tabController.tabType == DesktopTabType.remoteScreen ||
|
||||
@@ -1273,14 +1262,6 @@ class ActionIcon extends StatefulWidget {
|
||||
class _ActionIconState extends State<ActionIcon> {
|
||||
final hover = false.obs;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
hover.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Tooltip(
|
||||
|
||||
Reference in New Issue
Block a user