Skip to content

Commit

Permalink
Merge branch 'rustdesk:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangbo8418 authored Dec 20, 2024
2 parents f1c297a + 9114743 commit f2cd3ad
Show file tree
Hide file tree
Showing 18 changed files with 95 additions and 79 deletions.
13 changes: 13 additions & 0 deletions flutter/lib/common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3625,3 +3625,16 @@ void checkUpdate() {
}
}
}

// https://github.com/flutter/flutter/issues/153560#issuecomment-2497160535
// For TextField, TextFormField
extension WorkaroundFreezeLinuxMint on Widget {
Widget workaroundFreezeLinuxMint() {
// No need to check if is Linux Mint, because this workaround is harmless on other platforms.
if (isLinux) {
return ExcludeSemantics(child: this);
} else {
return this;
}
}
}
10 changes: 5 additions & 5 deletions flutter/lib/common/widgets/address_book.dart
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ class _AddressBookState extends State<AddressBook> {
borderRadius: BorderRadius.circular(8),
),
),
),
).workaroundFreezeLinuxMint(),
),
searchMatchFn: (item, searchValue) {
return item.value
Expand Down Expand Up @@ -556,7 +556,7 @@ class _AddressBookState extends State<AddressBook> {
: translate('ID'),
errorText: errorMsg,
errorMaxLines: 5),
))),
).workaroundFreezeLinuxMint())),
row(
lable: Text(
translate('Alias'),
Expand All @@ -569,7 +569,7 @@ class _AddressBookState extends State<AddressBook> {
? null
: translate('Alias'),
),
)),
).workaroundFreezeLinuxMint()),
),
if (isCurrentAbShared)
row(
Expand Down Expand Up @@ -598,7 +598,7 @@ class _AddressBookState extends State<AddressBook> {
},
),
),
),
).workaroundFreezeLinuxMint(),
)),
if (gFFI.abModel.currentAbTags.isNotEmpty)
Align(
Expand Down Expand Up @@ -704,7 +704,7 @@ class _AddressBookState extends State<AddressBook> {
),
controller: controller,
autofocus: true,
),
).workaroundFreezeLinuxMint(),
),
],
),
Expand Down
2 changes: 1 addition & 1 deletion flutter/lib/common/widgets/chat_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class ChatPage extends StatelessWidget implements PageShape {
);
},
),
);
).workaroundFreezeLinuxMint();
return SelectionArea(child: chat);
}),
],
Expand Down
91 changes: 47 additions & 44 deletions flutter/lib/common/widgets/dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ void changeIdDialog() {
msg = '';
});
},
),
).workaroundFreezeLinuxMint(),
const SizedBox(
height: 8.0,
),
Expand Down Expand Up @@ -201,13 +201,14 @@ void changeWhiteList({Function()? callback}) async {
children: [
Expanded(
child: TextField(
maxLines: null,
decoration: InputDecoration(
errorText: msg.isEmpty ? null : translate(msg),
),
controller: controller,
enabled: !isOptFixed,
autofocus: true),
maxLines: null,
decoration: InputDecoration(
errorText: msg.isEmpty ? null : translate(msg),
),
controller: controller,
enabled: !isOptFixed,
autofocus: true)
.workaroundFreezeLinuxMint(),
),
],
),
Expand Down Expand Up @@ -287,22 +288,23 @@ Future<String> changeDirectAccessPort(
children: [
Expanded(
child: TextField(
maxLines: null,
keyboardType: TextInputType.number,
decoration: InputDecoration(
hintText: '21118',
isCollapsed: true,
prefix: Text('$currentIP : '),
suffix: IconButton(
padding: EdgeInsets.zero,
icon: const Icon(Icons.clear, size: 16),
onPressed: () => controller.clear())),
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(
r'^([0-9]|[1-9]\d|[1-9]\d{2}|[1-9]\d{3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5])$')),
],
controller: controller,
autofocus: true),
maxLines: null,
keyboardType: TextInputType.number,
decoration: InputDecoration(
hintText: '21118',
isCollapsed: true,
prefix: Text('$currentIP : '),
suffix: IconButton(
padding: EdgeInsets.zero,
icon: const Icon(Icons.clear, size: 16),
onPressed: () => controller.clear())),
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(
r'^([0-9]|[1-9]\d|[1-9]\d{2}|[1-9]\d{3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5])$')),
],
controller: controller,
autofocus: true)
.workaroundFreezeLinuxMint(),
),
],
),
Expand Down Expand Up @@ -335,21 +337,22 @@ Future<String> changeAutoDisconnectTimeout(String old) async {
children: [
Expanded(
child: TextField(
maxLines: null,
keyboardType: TextInputType.number,
decoration: InputDecoration(
hintText: '10',
isCollapsed: true,
suffix: IconButton(
padding: EdgeInsets.zero,
icon: const Icon(Icons.clear, size: 16),
onPressed: () => controller.clear())),
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(
r'^([0-9]|[1-9]\d|[1-9]\d{2}|[1-9]\d{3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5])$')),
],
controller: controller,
autofocus: true),
maxLines: null,
keyboardType: TextInputType.number,
decoration: InputDecoration(
hintText: '10',
isCollapsed: true,
suffix: IconButton(
padding: EdgeInsets.zero,
icon: const Icon(Icons.clear, size: 16),
onPressed: () => controller.clear())),
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(
r'^([0-9]|[1-9]\d|[1-9]\d{2}|[1-9]\d{3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5])$')),
],
controller: controller,
autofocus: true)
.workaroundFreezeLinuxMint(),
),
],
),
Expand Down Expand Up @@ -427,7 +430,7 @@ class DialogTextField extends StatelessWidget {
keyboardType: keyboardType,
inputFormatters: inputFormatters,
maxLength: maxLength,
),
).workaroundFreezeLinuxMint(),
),
],
).paddingSymmetric(vertical: 4.0);
Expand Down Expand Up @@ -1501,7 +1504,7 @@ showAuditDialog(FFI ffi) async {
maxLength: 256,
controller: controller,
focusNode: focusNode,
)),
).workaroundFreezeLinuxMint()),
actions: [
dialogButton('Cancel', onPressed: close, isOutline: true),
dialogButton('OK', onPressed: submit)
Expand Down Expand Up @@ -1748,7 +1751,7 @@ void renameDialog(
autofocus: true,
decoration: InputDecoration(labelText: translate('Name')),
validator: validator,
),
).workaroundFreezeLinuxMint(),
),
),
// NOT use Offstage to wrap LinearProgressIndicator
Expand Down Expand Up @@ -1808,7 +1811,7 @@ void changeBot({Function()? callback}) async {
decoration: InputDecoration(
hintText: translate('Token'),
),
);
).workaroundFreezeLinuxMint();

return CustomAlertDialog(
title: Text(translate("Telegram bot")),
Expand Down Expand Up @@ -2178,7 +2181,7 @@ void setSharedAbPasswordDialog(String abName, Peer peer) {
},
),
),
),
).workaroundFreezeLinuxMint(),
if (!gFFI.abModel.current.isPersonal())
Row(children: [
Icon(Icons.info, color: Colors.amber).marginOnly(right: 4),
Expand Down
2 changes: 1 addition & 1 deletion flutter/lib/common/widgets/login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ Future<bool?> verificationCodeDialog(
labelText: "Email", prefixIcon: Icon(Icons.email)),
readOnly: true,
controller: TextEditingController(text: user?.email),
)),
).workaroundFreezeLinuxMint()),
isEmailVerification ? const SizedBox(height: 8) : const Offstage(),
codeField,
/*
Expand Down
2 changes: 1 addition & 1 deletion flutter/lib/common/widgets/my_group.dart
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class _MyGroupState extends State<MyGroup> {
border: InputBorder.none,
isDense: true,
),
)),
).workaroundFreezeLinuxMint()),
],
);
}
Expand Down
6 changes: 3 additions & 3 deletions flutter/lib/common/widgets/peer_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1257,7 +1257,7 @@ void _rdpDialog(String id) async {
hintText: '3389'),
controller: portController,
autofocus: true,
),
).workaroundFreezeLinuxMint(),
),
],
).marginOnly(bottom: isDesktop ? 8 : 0),
Expand All @@ -1277,7 +1277,7 @@ void _rdpDialog(String id) async {
labelText:
isDesktop ? null : translate('Username')),
controller: userController,
),
).workaroundFreezeLinuxMint(),
),
],
).marginOnly(bottom: stateGlobal.isPortrait.isFalse ? 8 : 0)),
Expand Down Expand Up @@ -1305,7 +1305,7 @@ void _rdpDialog(String id) async {
? Icons.visibility_off
: Icons.visibility))),
controller: passwordController,
)),
).workaroundFreezeLinuxMint()),
),
],
))
Expand Down
2 changes: 1 addition & 1 deletion flutter/lib/common/widgets/peer_tab_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ class _PeerSearchBarState extends State<PeerSearchBar> {
border: InputBorder.none,
isDense: true,
),
),
).workaroundFreezeLinuxMint(),
),
// Icon(Icons.close),
IconButton(
Expand Down
2 changes: 1 addition & 1 deletion flutter/lib/desktop/pages/connection_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ class _ConnectionPageState extends State<ConnectionPage>
onSubmitted: (_) {
onConnect();
},
));
).workaroundFreezeLinuxMint());
},
onSelected: (option) {
setState(() {
Expand Down
8 changes: 4 additions & 4 deletions flutter/lib/desktop/pages/desktop_home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
style: TextStyle(
fontSize: 22,
),
),
).workaroundFreezeLinuxMint(),
),
)
],
Expand Down Expand Up @@ -333,7 +333,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
EdgeInsets.only(top: 14, bottom: 10),
),
style: TextStyle(fontSize: 15),
),
).workaroundFreezeLinuxMint(),
),
),
if (showOneTime)
Expand Down Expand Up @@ -940,7 +940,7 @@ void setPasswordDialog({VoidCallback? notEmptyCallback}) async {
});
},
maxLength: maxLength,
),
).workaroundFreezeLinuxMint(),
),
],
),
Expand All @@ -967,7 +967,7 @@ void setPasswordDialog({VoidCallback? notEmptyCallback}) async {
});
},
maxLength: maxLength,
),
).workaroundFreezeLinuxMint(),
),
],
),
Expand Down
12 changes: 6 additions & 6 deletions flutter/lib/desktop/pages/desktop_setting_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1189,7 +1189,7 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin {
contentPadding:
EdgeInsets.symmetric(vertical: 12, horizontal: 12),
),
).marginOnly(right: 15),
).workaroundFreezeLinuxMint().marginOnly(right: 15),
),
Obx(() => ElevatedButton(
onPressed: applyEnabled.value &&
Expand Down Expand Up @@ -1346,7 +1346,7 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin {
contentPadding:
EdgeInsets.symmetric(vertical: 12, horizontal: 12),
),
).marginOnly(right: 15),
).workaroundFreezeLinuxMint().marginOnly(right: 15),
),
Obx(() => ElevatedButton(
onPressed:
Expand Down Expand Up @@ -2312,7 +2312,7 @@ _LabeledTextField(
style: TextStyle(
color: disabledTextColor(context, enabled),
),
),
).workaroundFreezeLinuxMint(),
],
),
],
Expand Down Expand Up @@ -2491,7 +2491,7 @@ void changeSocks5Proxy() async {
controller: proxyController,
autofocus: true,
enabled: !isOptFixed,
),
).workaroundFreezeLinuxMint(),
),
],
).marginOnly(bottom: 8),
Expand All @@ -2511,7 +2511,7 @@ void changeSocks5Proxy() async {
labelText: isMobile ? translate('Username') : null,
),
enabled: !isOptFixed,
),
).workaroundFreezeLinuxMint(),
),
],
).marginOnly(bottom: 8),
Expand All @@ -2537,7 +2537,7 @@ void changeSocks5Proxy() async {
controller: pwdController,
enabled: !isOptFixed,
maxLength: bind.mainMaxEncryptLen(),
)),
).workaroundFreezeLinuxMint()),
),
],
),
Expand Down
4 changes: 2 additions & 2 deletions flutter/lib/desktop/pages/file_manager_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ class _FileManagerViewState extends State<FileManagerView> {
),
controller: name,
autofocus: true,
),
).workaroundFreezeLinuxMint(),
],
),
actions: [
Expand Down Expand Up @@ -1657,7 +1657,7 @@ class _FileManagerViewState extends State<FileManagerView> {
onChanged: _locationStatus.value == LocationStatus.fileSearchBar
? (searchText) => onSearchText(searchText, isLocal)
: null,
),
).workaroundFreezeLinuxMint(),
)
],
);
Expand Down
Loading

0 comments on commit f2cd3ad

Please sign in to comment.