diff --git a/assets/images/DefaultPicture.jpg b/assets/images/DefaultPicture.jpg new file mode 100644 index 000000000..ef039c301 Binary files /dev/null and b/assets/images/DefaultPicture.jpg differ diff --git a/assets/images/defaultPicture.png b/assets/images/defaultPicture.png new file mode 100644 index 000000000..57953cc0b Binary files /dev/null and b/assets/images/defaultPicture.png differ diff --git a/assets/images/headphone_new3.png b/assets/images/headphone_new3.png deleted file mode 100644 index 6906348ce..000000000 Binary files a/assets/images/headphone_new3.png and /dev/null differ diff --git a/assets/images/headphone_new4.png b/assets/images/headphone_new4.png deleted file mode 100644 index 7161868f8..000000000 Binary files a/assets/images/headphone_new4.png and /dev/null differ diff --git a/lib/modules/home/controllers/home_controller.dart b/lib/modules/home/controllers/home_controller.dart index ab2478230..a7729e491 100644 --- a/lib/modules/home/controllers/home_controller.dart +++ b/lib/modules/home/controllers/home_controller.dart @@ -542,9 +542,7 @@ class HomeController extends GetxController { } // 使用默认耳机图片 - return isDarkMode - ? 'assets/images/headphone_new3.png' - : 'assets/images/headphone_new4.png'; + return 'assets/images/defaultPicture.png'; } /// 判断是否为网络图片 diff --git a/lib/modules/home/views/home_view.dart b/lib/modules/home/views/home_view.dart index 6be0315bd..55122a5b6 100644 --- a/lib/modules/home/views/home_view.dart +++ b/lib/modules/home/views/home_view.dart @@ -85,10 +85,12 @@ class HomeView extends GetView { // 顶部标题栏 _buildAppBar(isDarkMode), + SizedBox(height: 10.h), + // 顶部图片 _buildEarbudsImage(), - SizedBox(height: 20.h), + SizedBox(height: 10.h), // 设备状态卡片 IntroStepBuilder( @@ -229,7 +231,7 @@ class HomeView extends GetView { Center( child: ClipRRect( // 添加 ClipRRect - borderRadius: BorderRadius.circular(16.r), + borderRadius: BorderRadius.circular(20.r), child: GetBuilder( builder: (controller) { final imagePath = controller.getDeviceImagePath(isDarkMode); @@ -238,16 +240,16 @@ class HomeView extends GetView { return isNetwork ? Image.network( imagePath, + width: double.infinity, height: 220.h, - fit: BoxFit.contain, + fit: BoxFit.cover, errorBuilder: (context, error, stackTrace) { // 网络图片加载失败时使用默认图片 return Image.asset( - isDarkMode - ? 'assets/images/headphone_new3.png' - : 'assets/images/headphone_new4.png', + 'assets/images/defaultPicture.png', + width: double.infinity, height: 220.h, - fit: BoxFit.contain, + fit: BoxFit.cover, ); }, loadingBuilder: (context, child, loadingProgress) { @@ -268,16 +270,16 @@ class HomeView extends GetView { ) : Image.asset( imagePath, + width: double.infinity, height: 220.h, - fit: BoxFit.contain, + fit: BoxFit.cover, errorBuilder: (context, error, stackTrace) { // 本地图片加载失败时使用默认图片 return Image.asset( - isDarkMode - ? 'assets/images/headphone_new3.png' - : 'assets/images/headphone_new4.png', + 'assets/images/defaultPicture.png', + width: double.infinity, height: 220.h, - fit: BoxFit.contain, + fit: BoxFit.cover, ); }, ); diff --git a/lib/modules/ota_upgrade/views/ota_upgrade_view.dart b/lib/modules/ota_upgrade/views/ota_upgrade_view.dart index a1663da02..8872e9947 100644 --- a/lib/modules/ota_upgrade/views/ota_upgrade_view.dart +++ b/lib/modules/ota_upgrade/views/ota_upgrade_view.dart @@ -173,7 +173,7 @@ class OtaUpgradeView extends GetView { // 设备图标 Widget _buildDeviceIcon(bool isDarkMode) { return Container( - padding: EdgeInsets.all(16.w), + padding: EdgeInsets.all(6.w), decoration: BoxDecoration( color: isDarkMode ? Colors.white.withValues(alpha: 0.05) @@ -191,46 +191,52 @@ class OtaUpgradeView extends GetView { final imagePath = controller.lastConnectedDeviceImage; if (imagePath == null || imagePath.isEmpty) { - return Image.asset( - isDarkMode - ? 'assets/images/headphone_new3.png' - : 'assets/images/headphone_new4.png', - height: 100.h, - fit: BoxFit.contain, + return ClipRRect( + borderRadius: BorderRadius.circular(12.r), + child: SizedBox( + width: 120.h, + height: 120.h, + child: Image.asset( + 'assets/images/defaultPicture.jpg', + fit: BoxFit.cover, + ), + ), ); } - // 网络图片 - return Image.network( - imagePath, - height: 100.h, - fit: BoxFit.contain, - loadingBuilder: (context, child, loadingProgress) { - if (loadingProgress == null) return child; - return SizedBox( - height: 100.h, - child: Center( - child: CircularProgressIndicator( - value: loadingProgress.expectedTotalBytes != null - ? loadingProgress.cumulativeBytesLoaded / - loadingProgress.expectedTotalBytes! - : null, - strokeWidth: 2, - color: isDarkMode ? Colors.white : Colors.blue, - ), - ), - ); - }, - errorBuilder: (context, error, stackTrace) { - // 网络图片加载失败时使用默认图片 - return Image.asset( - isDarkMode - ? 'assets/images/headphone_new3.png' - : 'assets/images/headphone_new4.png', - height: 100.h, - fit: BoxFit.contain, - ); - }, + // 网络图片(正方形裁剪) + return ClipRRect( + borderRadius: BorderRadius.circular(16.r), + child: SizedBox( + width: 100.h, + height: 100.h, + child: Image.network( + imagePath, + fit: BoxFit.cover, + loadingBuilder: (context, child, loadingProgress) { + if (loadingProgress == null) return child; + return SizedBox( + height: 100.h, + child: Center( + child: CircularProgressIndicator( + value: loadingProgress.expectedTotalBytes != null + ? loadingProgress.cumulativeBytesLoaded / + loadingProgress.expectedTotalBytes! + : null, + strokeWidth: 2, + color: isDarkMode ? Colors.white : Colors.blue, + ), + ), + ); + }, + errorBuilder: (context, error, stackTrace) { + return Image.asset( + 'assets/images/defaultPicture.jpg', + fit: BoxFit.cover, + ); + }, + ), + ), ); }, ), diff --git a/pubspec.yaml b/pubspec.yaml index d58b22f96..d1e00321e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -142,8 +142,8 @@ flutter: - assets/fonts/NotoSansSC-Regular.ttf - assets/lottie/ - assets/js/ - - assets/images/headphone_new4.png - - assets/images/headphone_new3.png + - assets/images/defaultPicture.png + - assets/images/defaultPicture.jpg - assets/images/qqmusic.png - assets/images/music.png - assets/weather/