fix loadLogo

This commit is contained in:
rustdesk
2024-03-16 21:55:03 +08:00
parent 48842b6f2a
commit fb12ee7f2a
2 changed files with 25 additions and 26 deletions

View File

@@ -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) {