refactor: del unused or dead code and optimize reusable code

This commit is contained in:
csf
2022-09-13 21:36:38 +08:00
parent d3eac8539d
commit a28fd5d772
10 changed files with 259 additions and 974 deletions

View File

@@ -898,3 +898,14 @@ Future<List<Peer>>? matchPeers(String searchText, List<Peer> peers) async {
}
return filteredList;
}
/// Get the image for the current [platform].
Widget getPlatformImage(String platform, {double size = 50}) {
platform = platform.toLowerCase();
if (platform == 'mac os') {
platform = 'mac';
} else if (platform != 'linux' && platform != 'android') {
platform = 'win';
}
return Image.asset('assets/$platform.png', height: size, width: size);
}