fix id input focus problem

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2022-10-16 12:32:52 +08:00
parent 52a21234d4
commit cba450b32f
27 changed files with 43 additions and 10 deletions

View File

@ -36,6 +36,9 @@ class _ConnectionPageState extends State<ConnectionPage>
Timer? _updateTimer;
final RxBool _idInputFocused = false.obs;
final FocusNode _idFocusNode = FocusNode();
@override
void initState() {
super.initState();
@ -121,10 +124,8 @@ class _ConnectionPageState extends State<ConnectionPage>
/// UI for the remote ID TextField.
/// Search for a peer and connect to it if the id exists.
Widget _buildRemoteIDTextField(BuildContext context) {
RxBool inputFocused = false.obs;
FocusNode focusNode = FocusNode();
focusNode.addListener(() {
inputFocused.value = focusNode.hasFocus;
_idFocusNode.addListener(() {
_idInputFocused.value = _idFocusNode.hasFocus;
});
var w = Container(
width: 320 + 20 * 2,
@ -155,7 +156,7 @@ class _ConnectionPageState extends State<ConnectionPage>
autocorrect: false,
enableSuggestions: false,
keyboardType: TextInputType.visiblePassword,
focusNode: focusNode,
focusNode: _idFocusNode,
style: const TextStyle(
fontFamily: 'WorkSans',
fontSize: 22,
@ -165,7 +166,7 @@ class _ConnectionPageState extends State<ConnectionPage>
cursorColor:
Theme.of(context).textTheme.titleLarge?.color,
decoration: InputDecoration(
hintText: inputFocused.value
hintText: _idInputFocused.value
? null
: translate('Enter Remote ID'),
border: OutlineInputBorder(

View File

@ -977,9 +977,11 @@ Widget _OptionCheckBox(BuildContext context, String label, String key,
],
),
).marginOnly(left: _kCheckBoxLeftMargin),
onTap: () {
onChanged(!ref.value);
},
onTap: enabled
? () {
onChanged(!ref.value);
}
: null,
);
});
}

View File

@ -364,6 +364,10 @@ class _RemoteMenubarState extends State<RemoteMenubar> {
}
Widget _buildKeyboard(BuildContext context) {
FfiModel ffiModel = Provider.of<FfiModel>(context);
if (ffiModel.permissions['keyboard'] == false) {
return Offstage();
}
return mod_menu.PopupMenuButton(
padding: EdgeInsets.zero,
icon: const Icon(
@ -517,7 +521,7 @@ class _RemoteMenubarState extends State<RemoteMenubar> {
));
}
}
if (gFFI.ffiModel.permissions["restart"] != false &&
if (perms["restart"] != false &&
(pi.platform == "Linux" ||
pi.platform == "Windows" ||
pi.platform == "Mac OS")) {

View File

@ -556,6 +556,9 @@ class Client {
data['keyboard'] = keyboard;
data['clipboard'] = clipboard;
data['audio'] = audio;
data['file'] = file;
data['restart'] = restart;
data['recording'] = recording;
data['disconnected'] = disconnected;
return data;
}

View File

@ -373,5 +373,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Disconnected", "会话已结束"),
("Other", "其他"),
("Confirm before closing multiple tabs", "关闭多个标签页时向您确认"),
("Keyboard Settings", "键盘设置"),
].iter().cloned().collect();
}

View File

@ -373,5 +373,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Disconnected", ""),
("Other", ""),
("Confirm before closing multiple tabs", ""),
("Keyboard Settings", ""),
].iter().cloned().collect();
}

View File

@ -373,5 +373,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Disconnected", "Afbrudt"),
("Other", ""),
("Confirm before closing multiple tabs", ""),
("Keyboard Settings", ""),
].iter().cloned().collect();
}

View File

@ -373,5 +373,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Disconnected", ""),
("Other", ""),
("Confirm before closing multiple tabs", ""),
("Keyboard Settings", ""),
].iter().cloned().collect();
}

View File

@ -373,5 +373,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Disconnected", ""),
("Other", ""),
("Confirm before closing multiple tabs", ""),
("Keyboard Settings", ""),
].iter().cloned().collect();
}

View File

@ -373,5 +373,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Disconnected", ""),
("Other", ""),
("Confirm before closing multiple tabs", ""),
("Keyboard Settings", ""),
].iter().cloned().collect();
}

View File

@ -373,5 +373,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Disconnected", ""),
("Other", ""),
("Confirm before closing multiple tabs", ""),
("Keyboard Settings", ""),
].iter().cloned().collect();
}

View File

@ -373,5 +373,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Disconnected", ""),
("Other", ""),
("Confirm before closing multiple tabs", ""),
("Keyboard Settings", ""),
].iter().cloned().collect();
}

View File

@ -373,5 +373,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Disconnected", ""),
("Other", ""),
("Confirm before closing multiple tabs", ""),
("Keyboard Settings", ""),
].iter().cloned().collect();
}

View File

@ -373,5 +373,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Disconnected", ""),
("Other", ""),
("Confirm before closing multiple tabs", ""),
("Keyboard Settings", ""),
].iter().cloned().collect();
}

View File

@ -373,5 +373,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Disconnected", ""),
("Other", "他の"),
("Confirm before closing multiple tabs", "同時に複数のタブを閉じる前に確認する"),
("Keyboard Settings", ""),
].iter().cloned().collect();
}

View File

@ -373,5 +373,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Disconnected", ""),
("Other", ""),
("Confirm before closing multiple tabs", ""),
("Keyboard Settings", ""),
].iter().cloned().collect();
}

View File

@ -373,5 +373,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Disconnected", ""),
("Other", ""),
("Confirm before closing multiple tabs", ""),
("Keyboard Settings", ""),
].iter().cloned().collect();
}

View File

@ -373,5 +373,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Disconnected", ""),
("Other", ""),
("Confirm before closing multiple tabs", ""),
("Keyboard Settings", ""),
].iter().cloned().collect();
}

View File

@ -373,5 +373,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Disconnected", ""),
("Other", ""),
("Confirm before closing multiple tabs", ""),
("Keyboard Settings", ""),
].iter().cloned().collect();
}

View File

@ -373,5 +373,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Disconnected", ""),
("Other", ""),
("Confirm before closing multiple tabs", ""),
("Keyboard Settings", ""),
].iter().cloned().collect();
}

View File

@ -373,5 +373,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Disconnected", ""),
("Other", ""),
("Confirm before closing multiple tabs", ""),
("Keyboard Settings", ""),
].iter().cloned().collect();
}

View File

@ -373,5 +373,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Disconnected", ""),
("Other", ""),
("Confirm before closing multiple tabs", ""),
("Keyboard Settings", ""),
].iter().cloned().collect();
}

View File

@ -373,5 +373,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Disconnected", ""),
("Other", ""),
("Confirm before closing multiple tabs", ""),
("Keyboard Settings", ""),
].iter().cloned().collect();
}

View File

@ -373,5 +373,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Disconnected", ""),
("Other", ""),
("Confirm before closing multiple tabs", ""),
("Keyboard Settings", ""),
].iter().cloned().collect();
}

View File

@ -373,5 +373,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Disconnected", "會話已結束"),
("Other", "其他"),
("Confirm before closing multiple tabs", "關閉多個分頁前跟我確認"),
("Keyboard Settings", "鍵盤設置"),
].iter().cloned().collect();
}

View File

@ -373,5 +373,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Disconnected", ""),
("Other", ""),
("Confirm before closing multiple tabs", ""),
("Keyboard Settings", ""),
].iter().cloned().collect();
}

View File

@ -373,5 +373,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Disconnected", ""),
("Other", ""),
("Confirm before closing multiple tabs", ""),
("Keyboard Settings", ""),
].iter().cloned().collect();
}