mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-06-07 09:52:49 +08:00
fix loadLogo
This commit is contained in:
parent
48842b6f2a
commit
fb12ee7f2a
@ -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) {
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user