Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

replace offstage with if-else for LinearProgressIndicator in dialog

21pages979203cbdb0a
diff --git a/flutter/lib/common/widgets/address_book.dart b/flutter/lib/common/widgets/address_book.dart
index 4aa1326bf..86a5b2c55 100644
--- a/flutter/lib/common/widgets/address_book.dart
+++ b/flutter/lib/common/widgets/address_book.dart
@@ -46,6 +46,7 @@ class _AddressBookState extends State<AddressBook> {
}
return Column(
children: [
+ // NOT use Offstage to wrap LinearProgressIndicator
if (gFFI.abModel.retrying.value) LinearProgressIndicator(),
_buildErrorBanner(
err: gFFI.abModel.pullError,
@@ -397,8 +398,8 @@ class _AddressBookState extends State<AddressBook> {
const SizedBox(
height: 4.0,
),
- Offstage(
- offstage: !isInProgress, child: const LinearProgressIndicator())
+ // NOT use Offstage to wrap LinearProgressIndicator
+ if (isInProgress) const LinearProgressIndicator(),
],
),
actions: [
@@ -463,8 +464,8 @@ class _AddressBookState extends State<AddressBook> {
const SizedBox(
height: 4.0,
),
- Offstage(
- offstage: !isInProgress, child: const LinearProgressIndicator())
+ // NOT use Offstage to wrap LinearProgressIndicator
+ if (isInProgress) const LinearProgressIndicator(),
],
),
actions: [
diff --git a/flutter/lib/common/widgets/dialog.dart b/flutter/lib/common/widgets/dialog.dart
index 40f0901aa..ce4b68ae0 100644
--- a/flutter/lib/common/widgets/dialog.dart
+++ b/flutter/lib/common/widgets/dialog.dart
@@ -156,8 +156,8 @@ void changeIdDialog() {
}).toList(),
)).marginOnly(bottom: 8)
: SizedBox.shrink(),
- Offstage(
- offstage: !isInProgress, child: const LinearProgressIndicator())
+ // NOT use Offstage to wrap LinearProgressIndicator
+ if (isInProgress) const LinearProgressIndicator(),
],
),
actions: [
@@ -202,8 +202,8 @@ void changeWhiteList({Function()? callback}) async {
const SizedBox(
height: 4.0,
),
- Offstage(
- offstage: !isInProgress, child: const LinearProgressIndicator())
+ // NOT use Offstage to wrap LinearProgressIndicator
+ if (isInProgress) const LinearProgressIndicator(),
],
),
actions: [
@@ -1435,8 +1435,8 @@ void editAbTagDialog(
.toList(growable: false),
),
),
- Offstage(
- offstage: !isInProgress, child: const LinearProgressIndicator())
+ // NOT use Offstage to wrap LinearProgressIndicator
+ if (isInProgress) const LinearProgressIndicator(),
],
),
actions: [
@@ -1496,9 +1496,9 @@ void renameDialog(
),
),
),
- Obx(() => Offstage(
- offstage: isInProgress.isFalse,
- child: const LinearProgressIndicator())),
+ // NOT use Offstage to wrap LinearProgressIndicator
+ Obx(() =>
+ isInProgress.value ? const LinearProgressIndicator() : Offstage())
],
),
actions: [
diff --git a/flutter/lib/common/widgets/login.dart b/flutter/lib/common/widgets/login.dart
index d7037e58f..7c17e9dea 100644
--- a/flutter/lib/common/widgets/login.dart
+++ b/flutter/lib/common/widgets/login.dart
@@ -12,7 +12,15 @@ import 'package:url_launcher/url_launcher.dart';
import '../../common.dart';
import './dialog.dart';
-const kOpSvgList = ['github', 'google', 'apple', 'okta', 'facebook', 'azure', 'auth0'];
+const kOpSvgList = [
+ 'github',
+ 'google',
+ 'apple',
+ 'okta',
+ 'facebook',
+ 'azure',
+ 'auth0'
+];
class _IconOP extends StatelessWidget {
final String op;
@@ -27,7 +35,8 @@ class _IconOP extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final svgFile = kOpSvgList.contains(op.toLowerCase()) ? op.toLowerCase() : 'default';
+ final svgFile =
+ kOpSvgList.contains(op.toLowerCase()) ? op.toLowerCase() : 'default';
return Container(
margin: margin,
child: icon == null
@@ -345,9 +354,8 @@ class LoginWidgetUserPass extends StatelessWidget {
autoFocus: false,
errorText: passMsg,
),
- Offstage(
- offstage: !isInProgress,
- child: const LinearProgressIndicator()),
+ // NOT use Offstage to wrap LinearProgressIndicator
+ if (isInProgress) const LinearProgressIndicator(),
const SizedBox(height: 12.0),
FittedBox(
child:
@@ -664,9 +672,8 @@ Future<bool?> verificationCodeDialog(UserPayload? user) async {
},
),
*/
- Offstage(
- offstage: !isInProgress,
- child: const LinearProgressIndicator()),
+ // NOT use Offstage to wrap LinearProgressIndicator
+ if (isInProgress) const LinearProgressIndicator(),
],
),
onCancel: close,
diff --git a/flutter/lib/common/widgets/peer_tab_page.dart b/flutter/lib/common/widgets/peer_tab_page.dart
index c05eb6243..b4c9b4018 100644
--- a/flutter/lib/common/widgets/peer_tab_page.dart
+++ b/flutter/lib/common/widgets/peer_tab_page.dart
@@ -208,28 +208,26 @@ class _PeerTabPageState extends State<PeerTabPage>
}
Widget _createRefresh() {
+ if (gFFI.peerTabModel.currentTab < 3) return Offstage();
final textColor = Theme.of(context).textTheme.titleLarge?.color;
- return Offstage(
- offstage: gFFI.peerTabModel.currentTab < 3, // local tab can't see effect
- child: Container(
- padding: EdgeInsets.all(4.0),
- child: AnimatedRotationWidget(
- onPressed: () {
- if (gFFI.peerTabModel.currentTab < entries.length) {
- entries[gFFI.peerTabModel.currentTab].load();
- }
- },
- spinning: gFFI.abModel.abLoading,
- child: RotatedBox(
- quarterTurns: 2,
- child: Tooltip(
- message: translate('Refresh'),
- child: Icon(
- Icons.refresh,
- size: 18,
- color: textColor,
- )))),
- ),
+ return Container(
+ padding: EdgeInsets.all(4.0),
+ child: AnimatedRotationWidget(
+ onPressed: () {
+ if (gFFI.peerTabModel.currentTab < entries.length) {
+ entries[gFFI.peerTabModel.currentTab].load();
+ }
+ },
+ spinning: gFFI.abModel.abLoading,
+ child: RotatedBox(
+ quarterTurns: 2,
+ child: Tooltip(
+ message: translate('Refresh'),
+ child: Icon(
+ Icons.refresh,
+ size: 18,
+ color: textColor,
+ )))),
);
}
diff --git a/flutter/lib/desktop/pages/desktop_setting_page.dart b/flutter/lib/desktop/pages/desktop_setting_page.dart
index b868042a4..f158efb82 100644
--- a/flutter/lib/desktop/pages/desktop_setting_page.dart
+++ b/flutter/lib/desktop/pages/desktop_setting_page.dart
@@ -2065,9 +2065,9 @@ void changeSocks5Proxy() async {
),
],
),
- Offstage(
- offstage: !isInProgress,
- child: const LinearProgressIndicator().marginOnly(top: 8))
+ // NOT use Offstage to wrap LinearProgressIndicator
+ if (isInProgress)
+ const LinearProgressIndicator().marginOnly(top: 8),
],
),
),
diff --git a/flutter/lib/desktop/pages/install_page.dart b/flutter/lib/desktop/pages/install_page.dart
index 871030e15..44ba06263 100644
--- a/flutter/lib/desktop/pages/install_page.dart
+++ b/flutter/lib/desktop/pages/install_page.dart
@@ -182,8 +182,8 @@ class _InstallPageBodyState extends State<_InstallPageBody>
.marginOnly(bottom: em),
InkWell(
hoverColor: Colors.transparent,
- onTap: () =>
- launchUrlString('https://rustdesk.com/privacy.html'),
+ onTap: () => launchUrlString(
+ 'https://rustdesk.com/privacy.html'),
child: Tooltip(
message: 'https://rustdesk.com/privacy.html',
child: Row(children: [
@@ -204,11 +204,10 @@ class _InstallPageBodyState extends State<_InstallPageBody>
Row(
children: [
Expanded(
- child: Obx(() => Offstage(
- offstage: !showProgress.value,
- child:
- LinearProgressIndicator().marginOnly(right: 10),
- )),
+ // NOT use Offstage to wrap LinearProgressIndicator
+ child: Obx(() => showProgress.value
+ ? LinearProgressIndicator().marginOnly(right: 10)
+ : Offstage()),
),
Obx(
() => OutlinedButton.icon(
diff --git a/flutter/lib/mobile/widgets/dialog.dart b/flutter/lib/mobile/widgets/dialog.dart
index 8c321e785..550b37d72 100644
--- a/flutter/lib/mobile/widgets/dialog.dart
+++ b/flutter/lib/mobile/widgets/dialog.dart
@@ -223,9 +223,8 @@ void showServerSettingsWithValue(
labelText: 'Key',
),
),
- Offstage(
- offstage: !isInProgress,
- child: LinearProgressIndicator())
+ // NOT use Offstage to wrap LinearProgressIndicator
+ if (isInProgress) const LinearProgressIndicator(),
])),
actions: [
dialogButton('Cancel', onPressed: () {