Skip to content

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

buildPresetPasswordWarning for android

rustdesk4e8cbe3db139
diff --git a/flutter/lib/common.dart b/flutter/lib/common.dart
index a878995c9..3106aaaaf 100644
--- a/flutter/lib/common.dart
+++ b/flutter/lib/common.dart
@@ -3176,3 +3176,41 @@ bool isInHomePage() {
final controller = Get.find<DesktopTabController>();
return controller.state.value.selected == 0;
}
+
+Widget buildPresetPasswordWarning() {
+ return FutureBuilder<bool>(
+ future: bind.isPresetPassword(),
+ builder: (BuildContext context, AsyncSnapshot<bool> snapshot) {
+ if (snapshot.connectionState == ConnectionState.waiting) {
+ return CircularProgressIndicator(); // Show a loading spinner while waiting for the Future to complete
+ } else if (snapshot.hasError) {
+ return Text(
+ 'Error: ${snapshot.error}'); // Show an error message if the Future completed with an error
+ } else if (snapshot.hasData && snapshot.data == true) {
+ return Container(
+ color: Colors.yellow,
+ child: Column(
+ children: [
+ Align(
+ child: Text(
+ translate("Security Alert"),
+ style: TextStyle(
+ color: Colors.red,
+ fontSize: 20,
+ fontWeight: FontWeight.bold,
+ ),
+ )).paddingOnly(bottom: 8),
+ Text(
+ translate("preset_password_warning"),
+ style: TextStyle(color: Colors.red),
+ )
+ ],
+ ).paddingAll(8),
+ ); // Show a warning message if the Future completed with true
+ } else {
+ return SizedBox
+ .shrink(); // Show nothing if the Future completed with false or null
+ }
+ },
+ );
+}
diff --git a/flutter/lib/desktop/pages/desktop_home_page.dart b/flutter/lib/desktop/pages/desktop_home_page.dart
index c2902806f..dd87e0939 100644
--- a/flutter/lib/desktop/pages/desktop_home_page.dart
+++ b/flutter/lib/desktop/pages/desktop_home_page.dart
@@ -69,44 +69,6 @@ class _DesktopHomePageState extends State<DesktopHomePage>
);
}
- Widget buildPresetPasswordWarning() {
- return FutureBuilder<bool>(
- future: bind.isPresetPassword(),
- builder: (BuildContext context, AsyncSnapshot<bool> snapshot) {
- if (snapshot.connectionState == ConnectionState.waiting) {
- return CircularProgressIndicator(); // Show a loading spinner while waiting for the Future to complete
- } else if (snapshot.hasError) {
- return Text(
- 'Error: ${snapshot.error}'); // Show an error message if the Future completed with an error
- } else if (snapshot.hasData && snapshot.data == true) {
- return Container(
- color: Colors.yellow,
- child: Column(
- children: [
- Align(
- child: Text(
- translate("Security Alert"),
- style: TextStyle(
- color: Colors.red,
- fontSize: 20,
- fontWeight: FontWeight.bold,
- ),
- )).paddingOnly(bottom: 8),
- Text(
- translate("preset_password_warning"),
- style: TextStyle(color: Colors.red),
- )
- ],
- ).paddingAll(8),
- ); // Show a warning message if the Future completed with true
- } else {
- return SizedBox
- .shrink(); // Show nothing if the Future completed with false or null
- }
- },
- );
- }
-
Widget buildLeftPane(BuildContext context) {
final isIncomingOnly = bind.isIncomingOnly();
final isOutgoingOnly = bind.isOutgoingOnly();
diff --git a/flutter/lib/mobile/pages/server_page.dart b/flutter/lib/mobile/pages/server_page.dart
index e097b04a6..120381ebe 100644
--- a/flutter/lib/mobile/pages/server_page.dart
+++ b/flutter/lib/mobile/pages/server_page.dart
@@ -158,6 +158,7 @@ class _ServerPageState extends State<ServerPage> {
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
+ buildPresetPasswordWarning(),
gFFI.serverModel.isStart
? ServerInfo()
: ServiceNotRunningNotification(),