Browse Source

修改图片

newdev_shunjiawei
tanlongsheng 2 years ago
parent
commit
fdb63fdefe
  1. BIN
      assets/images/explore1.png
  2. BIN
      assets/images/explore2.jpg
  3. BIN
      assets/images/glasses_light.jpg
  4. BIN
      assets/images/robot_dark.png
  5. BIN
      assets/images/robot_light.png
  6. 2
      lib/core/translations/language/en_us.dart
  7. 2
      lib/core/translations/language/zh_cn.dart
  8. 4
      lib/data/services/speech_impl/voice_clone_tts_service.dart
  9. 170
      lib/modules/explore/views/explore_view.dart
  10. 51
      lib/modules/home/views/home_view.dart
  11. 5
      pubspec.yaml

BIN
assets/images/explore1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 592 KiB

BIN
assets/images/explore2.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 KiB

BIN
assets/images/glasses_light.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

BIN
assets/images/robot_dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 423 KiB

BIN
assets/images/robot_light.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 KiB

2
lib/core/translations/language/en_us.dart

@ -84,6 +84,8 @@ const Map<String, String> enUS = {
// 发现页
"searchAi": "Search AI features...",
"exploreSlogan": "Smart Earbuds, Infinite Possibilities",
"exploreSlogan1": "Intelligent companion, Infinite Possibilities",
"exploreSlogan2": "Smart glasses, Infinite Possibilities",
"exploreAi": "Explore AI features provided by DeepSound",
"aiFunction": "AI Features",
"allRoundAssistant": "All-round Assistant",

2
lib/core/translations/language/zh_cn.dart

@ -83,6 +83,8 @@ const Map<String, String> zhCN = {
// 发现页
"searchAi": "搜索AI功能...",
"exploreSlogan": "智能耳机,无限可能",
"exploreSlogan1": "智能陪伴,无限可能",
"exploreSlogan2": "智能眼镜,无限可能",
"exploreAi": "探索DeepSound提供的AI功能",
"aiFunction": "AI功能",
"allRoundAssistant": "全能助理",

4
lib/data/services/speech_impl/voice_clone_tts_service.dart

@ -360,7 +360,7 @@ class VoiceCloneTtsService extends GetxService implements TtsService {
Future<bool> stop() async {
try {
_textQueue.clear();
_player.stop();
await _player.stop();
_playlist.clear();
_audioBytes = BytesBuilder();
if (_isSpeaking.value) {
@ -382,10 +382,10 @@ class VoiceCloneTtsService extends GetxService implements TtsService {
if (!_isInitialized) return;
try {
await stop();
_player.dispose();
// 关闭事件流控制器
await _eventController.close();
_isInitialized = false;
_player.dispose();
} catch (e) {
Logger.error('释放资源失败: $e');
}

170
lib/modules/explore/views/explore_view.dart

@ -30,7 +30,38 @@ class ExploreView extends GetView<ExploreController> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// 特色功能
_buildFeaturedCard(),
Container(
height: 180.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(24.r),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.2),
blurRadius: 10,
offset: const Offset(0, 4),
),
],
),
child: PageView(
children: [
_buildFeaturedCard(
'assets/images/explore.png',
'exploreSlogan'.tr, // 智能耳机,无限可能
'exploreAi'.tr, // 探索DeepSound提供的AI功能
),
_buildFeaturedCard(
'assets/images/explore1.png',
'exploreSlogan1'.tr, // 智能陪伴,无限可能
'exploreAi'.tr, // 探索DeepSound提供的AI功能
),
_buildFeaturedCard(
'assets/images/explore2.jpg',
'exploreSlogan2'.tr, // 智能眼镜,无限可能
'exploreAi'.tr, // 探索DeepSound提供的AI功能
),
],
),
),
// AI功能列表
SizedBox(height: 24.h),
@ -132,90 +163,77 @@ class ExploreView extends GetView<ExploreController> {
}
// 特色功能卡片
Widget _buildFeaturedCard() {
return Container(
height: 180.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(24.r),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.2),
blurRadius: 10,
offset: const Offset(0, 4),
),
],
),
child: Stack(
children: [
// 背景图片
ClipRRect(
borderRadius: BorderRadius.circular(24.r),
child: Container(
color: Colors.blue.shade900, // 预设颜色,图片加载失败时显示
child: Image.asset(
'assets/images/explore.png',
width: double.infinity,
height: 180.h,
fit: BoxFit.cover,
errorBuilder: (context, error, stackTrace) {
return Container(
color: Colors.blue.shade900,
width: double.infinity,
height: 180.h,
child: Icon(
Icons.image_not_supported,
color: Colors.white,
size: 40.sp,
),
);
},
),
Widget _buildFeaturedCard(String image, String title, String description) {
return Stack(
children: [
// 背景图片
ClipRRect(
borderRadius: BorderRadius.circular(24.r),
child: Container(
color: Colors.blue.shade900, // 预设颜色,图片加载失败时显示
child: Image.asset(
image,
width: double.infinity,
height: 180.h,
fit: BoxFit.cover,
errorBuilder: (context, error, stackTrace) {
return Container(
color: Colors.blue.shade900,
width: double.infinity,
height: 180.h,
child: Icon(
Icons.image_not_supported,
color: Colors.white,
size: 40.sp,
),
);
},
),
),
),
// 渐变遮罩
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(24.r),
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Colors.black.withOpacity(0.1),
Colors.black.withOpacity(0.6),
],
),
// 渐变遮罩
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(24.r),
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Colors.black.withOpacity(0.1),
Colors.black.withOpacity(0.6),
],
),
),
),
// 文本内容
Padding(
padding: EdgeInsets.all(24.w),
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'exploreSlogan'.tr, // 智能耳机,无限可能
style: TextStyle(
fontSize: 22.sp,
fontWeight: FontWeight.bold,
color: Colors.white,
),
// 文本内容
Padding(
padding: EdgeInsets.all(24.w),
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: TextStyle(
fontSize: 22.sp,
fontWeight: FontWeight.bold,
color: Colors.white,
),
SizedBox(height: 4.h),
Text(
'exploreAi'.tr, // 探索DeepSound提供的AI功能
style: TextStyle(
fontSize: 14.sp,
color: Colors.white.withOpacity(0.8),
),
),
SizedBox(height: 4.h),
Text(
description,
style: TextStyle(
fontSize: 14.sp,
color: Colors.white.withOpacity(0.8),
),
],
),
),
],
),
],
),
),
],
);
}

51
lib/modules/home/views/home_view.dart

@ -89,9 +89,7 @@ class HomeView extends GetView<HomeController> {
_buildAppBar(isDarkMode),
// 顶部图片
Center(
child: _buildEarbudsImage(),
),
_buildEarbudsImage(),
SizedBox(height: 20.h),
// 设备状态卡片
@ -102,8 +100,6 @@ class HomeView extends GetView<HomeController> {
_buildSectionTitle(isDarkMode),
SizedBox(height: 16.h),
_buildPremiumAILayout(),
],
),
),
@ -156,15 +152,38 @@ class HomeView extends GetView<HomeController> {
// 耳机图片
Widget _buildEarbudsImage() {
final bool isDarkMode = Get.isDarkMode;
return Container(
return SizedBox(
height: 220.h,
alignment: Alignment.center,
child: Image.asset(
isDarkMode
? 'assets/images/headphone_dark.png'
: 'assets/images/headphone_light.png',
height: 180.h,
fit: BoxFit.contain,
child: PageView(
children: [
Center(
child: Image.asset(
isDarkMode
? 'assets/images/headphone_dark.png'
: 'assets/images/headphone_light.png',
height: 180.h,
fit: BoxFit.contain,
),
),
Center(
child: Image.asset(
isDarkMode
? 'assets/images/robot_dark.png'
: 'assets/images/robot_light.png',
height: 180.h,
fit: BoxFit.contain,
),
),
Center(
child: Image.asset(
isDarkMode
? 'assets/images/glasses_light.jpg'
: 'assets/images/glasses_light.jpg',
height: 180.h,
fit: BoxFit.contain,
),
),
],
),
);
}
@ -673,7 +692,8 @@ class HomeView extends GetView<HomeController> {
child: Text(
description,
style: TextStyle(
color: isDarkMode ? Colors.grey[400] : Colors.grey[600],
color:
isDarkMode ? Colors.grey[400] : Colors.grey[600],
fontSize: 12.sp,
),
maxLines: 2,
@ -706,7 +726,8 @@ class HomeView extends GetView<HomeController> {
child: Text(
description,
style: TextStyle(
color: isDarkMode ? Colors.grey[400] : Colors.grey[600],
color:
isDarkMode ? Colors.grey[400] : Colors.grey[600],
fontSize: 10.sp,
),
maxLines: 2,

5
pubspec.yaml

@ -72,7 +72,12 @@ flutter:
assets:
- assets/images/headphone_light.png
- assets/images/headphone_dark.png
- assets/images/robot_light.png
- assets/images/robot_dark.png
- assets/images/glasses_light.jpg
- assets/images/agents/
- assets/images/explore.png
- assets/images/explore1.png
- assets/images/explore2.jpg
- assets/lottie/
- .env

Loading…
Cancel
Save