Skip to content

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

fix loadLogo

rustdeskfb12ee7f2ae0
diff --git a/flutter/lib/common.dart b/flutter/lib/common.dart
index 2ceee5262..22546e11c 100644
--- a/flutter/lib/common.dart
+++ b/flutter/lib/common.dart
@@ -3089,24 +3089,25 @@ Color? disabledTextColor(BuildContext context, bool enabled) {
}
// max 300 x 60
-Widget? loadLogo() {
- bool isFound = true;
- final image = Image.asset(
- 'assets/logo.png',
- fit: BoxFit.contain,
- errorBuilder: (ctx, error, stackTrace) {
- isFound = false;
- return Container();
- },
- );
- if (isFound) {
- return Container(
- constraints: BoxConstraints(maxWidth: 300, maxHeight: 60),
- child: image,
- ).marginOnly(left: 12, right: 12, top: 12);
- } else {
- return null;
- }
+Widget loadLogo() {
+ return FutureBuilder<ByteData>(
+ future: rootBundle.load('assets/logo.png'),
+ builder: (BuildContext context, AsyncSnapshot<ByteData> snapshot) {
+ if (snapshot.hasData) {
+ final image = Image.asset(
+ 'assets/logo.png',
+ fit: BoxFit.contain,
+ errorBuilder: (ctx, error, stackTrace) {
+ return Container();
+ },
+ );
+ return Container(
+ constraints: BoxConstraints(maxWidth: 300, maxHeight: 60),
+ child: image,
+ ).marginOnly(left: 12, right: 12, top: 12);
+ }
+ return const Offstage();
+ });
}
Widget loadIcon(double size) {
diff --git a/flutter/lib/desktop/pages/desktop_home_page.dart b/flutter/lib/desktop/pages/desktop_home_page.dart
index 9ca609704..ac5e60028 100644
--- a/flutter/lib/desktop/pages/desktop_home_page.dart
+++ b/flutter/lib/desktop/pages/desktop_home_page.dart
@@ -110,7 +110,6 @@ class _DesktopHomePageState extends State<DesktopHomePage>
Widget buildLeftPane(BuildContext context) {
final isIncomingOnly = bind.isIncomingOnly();
final isOutgoingOnly = bind.isOutgoingOnly();
- final logo = loadLogo();
final children = <Widget>[
if (!isOutgoingOnly) buildPresetPasswordWarning(),
if (bind.isCustomClient())
@@ -133,12 +132,11 @@ class _DesktopHomePageState extends State<DesktopHomePage>
),
).marginOnly(top: 6),
),
- if (logo != null)
- Align(
- alignment: Alignment.center,
- child: logo.marginOnly(bottom: 0.0),
- ),
- buildTip(context, logo),
+ Align(
+ alignment: Alignment.center,
+ child: loadLogo(),
+ ),
+ buildTip(context),
if (!isOutgoingOnly) buildIDBoard(context),
if (!isOutgoingOnly) buildPasswordBoard(context),
FutureBuilder<Widget>(
@@ -413,7 +411,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
);
}
- buildTip(BuildContext context, Widget? logo) {
+ buildTip(BuildContext context) {
final isOutgoingOnly = bind.isOutgoingOnly();
return Padding(
padding: