Browse Source

feat(explore): 新增精简布局,隐藏 AI 全能助手时使用

按 AppConfig.hideAiAssistant 分发:true 时显示翻译/会议助手上下堆叠 banner 卡,
图标右上角、标题/描述左下角,复用 controller.aiFeatures[1] 与 [2] 数据。
newdev_shunjiawei
lxm 6 months ago
parent
commit
5fff07ebff
  1. 113
      lib/modules/explore/views/explore_view.dart

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

@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
//import 'dart:ui'; //import 'dart:ui';
import '../controllers/explore_controller.dart'; import '../controllers/explore_controller.dart';
import '../../../core/widgets/common_bottom_nav.dart'; import '../../../core/widgets/common_bottom_nav.dart';
import '../../../data/models/appconfig.dart';
class ExploreView extends GetView<ExploreController> { class ExploreView extends GetView<ExploreController> {
const ExploreView({Key? key}) : super(key: key); const ExploreView({Key? key}) : super(key: key);
@ -65,7 +66,9 @@ class ExploreView extends GetView<ExploreController> {
// AI功能列表 // AI功能列表
SizedBox(height: 24.h), SizedBox(height: 24.h),
_buildCustomAILayout(isDarkMode), AppConfig.hideAiAssistant
? _buildSimplifiedAILayout(isDarkMode)
: _buildCustomAILayout(isDarkMode),
], ],
), ),
), ),
@ -439,4 +442,112 @@ class ExploreView extends GetView<ExploreController> {
), ),
); );
} }
// 精简布局:隐藏"AI全能助手",仅保留翻译 + 会议助手,上下堆叠 banner 卡
// 复用 controller.aiFeatures 中索引 1(翻译)和 2(会议助手)的数据
Widget _buildSimplifiedAILayout(bool isDarkMode) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'aiFunction'.tr, // AI功能
style: TextStyle(
fontSize: 18.sp,
fontWeight: FontWeight.w600,
color: isDarkMode ? Colors.white : Colors.grey[800],
),
),
SizedBox(height: 16.h),
// 翻译(banner 卡)
_buildSimplifiedBannerCard(controller.aiFeatures[1], 1, isDarkMode),
SizedBox(height: 12.h),
// 会议助手(banner 卡)
_buildSimplifiedBannerCard(controller.aiFeatures[2], 2, isDarkMode),
],
);
}
// 精简布局下的 banner 卡(图标右上角,标题/描述左下角)
Widget _buildSimplifiedBannerCard(
AIFeature feature, int index, bool isDarkMode) {
return GestureDetector(
onTap: () => controller.onAIFeatureTap(index),
child: Container(
height: 130.h,
padding: EdgeInsets.all(16.w),
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
feature.startColor.withOpacity(0.3),
feature.endColor.withOpacity(0.3),
],
),
borderRadius: BorderRadius.circular(20.r),
boxShadow: [
BoxShadow(
color: isDarkMode
? Colors.black.withOpacity(0.2)
: Colors.grey.withOpacity(0.1),
blurRadius: 8,
offset: const Offset(0, 4),
),
],
),
child: Stack(
children: [
// 图标右上角
Positioned(
top: 0,
right: 0,
child: Container(
width: 44.w,
height: 44.w,
decoration: BoxDecoration(
color: feature.iconColor.withOpacity(0.2),
shape: BoxShape.circle,
),
child: Icon(
feature.icon,
size: 22.sp,
color: feature.iconColor,
),
),
),
// 标题 + 描述左下角
Align(
alignment: Alignment.bottomLeft,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
feature.title,
style: TextStyle(
fontSize: 16.sp,
fontWeight: FontWeight.w600,
color: isDarkMode ? Colors.white : Colors.grey[800],
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
SizedBox(height: 4.h),
Text(
feature.description,
style: TextStyle(
fontSize: 12.sp,
color: isDarkMode ? Colors.grey[400] : Colors.grey[600],
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
],
),
),
],
),
),
);
}
} }

Loading…
Cancel
Save