Browse Source

feat(theme): 支持暗色模式主题适配

- 在模板列表视图中增加暗色模式颜色支持
- 调整模板详情页面文本与背景颜色的暗色模式兼容
- 修正模板编辑页面输入框及按钮颜色以适配暗色模式
- 更新模板视图组件颜色,根据当前主题动态切换
- 按钮、标签、边框等UI元素颜色增强暗色和明色模式区分
- 移除暗色模式下不必要的阴影效果,提升视觉一致性
newdev_shunjiawei
lxm 7 months ago
parent
commit
06803c6896
  1. 34
      lib/modules/meeting/views/template/template_all_view.dart
  2. 20
      lib/modules/meeting/views/template/template_details_view.dart
  3. 32
      lib/modules/meeting/views/template/template_edit_view.dart
  4. 33
      lib/modules/meeting/views/template/template_view.dart

34
lib/modules/meeting/views/template/template_all_view.dart

@ -124,7 +124,7 @@ class _TemplateAllViewState extends State<TemplateAllView> {
padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 20.w),
itemBuilder: (BuildContext context, int index) {
Map data = _templateList[index];
return _item(data);
return _item(data, isDarkMode);
},
),
),
@ -141,14 +141,18 @@ class _TemplateAllViewState extends State<TemplateAllView> {
height: 48.w,
alignment: Alignment.center,
decoration: BoxDecoration(
color: _templateData.isNotEmpty ? Colors.black : Colors.grey,
color: _templateData.isNotEmpty
? (isDarkMode ? Colors.white : Colors.black)
: Colors.grey,
borderRadius: BorderRadius.circular(12.r),
),
child: Text(
'就用这个模版',
style: TextStyle(
fontSize: 16.sp,
color: Colors.white,
color: _templateData.isNotEmpty
? (isDarkMode ? Colors.black : Colors.white)
: Colors.white,
),
),
),
@ -158,11 +162,11 @@ class _TemplateAllViewState extends State<TemplateAllView> {
);
}
Widget _item(Map template) {
Widget _item(Map template, bool isDarkMode) {
return Container(
clipBehavior: Clip.hardEdge,
decoration: BoxDecoration(
color: Colors.white,
color: isDarkMode ? const Color(0xFF2D2D2D) : Colors.white,
borderRadius: BorderRadius.circular(14.w),
),
child: GestureDetector(
@ -176,7 +180,7 @@ class _TemplateAllViewState extends State<TemplateAllView> {
Container(
padding: EdgeInsets.all(5.w),
decoration: BoxDecoration(
color: Colors.white,
color: isDarkMode ? const Color(0xFF2D2D2D) : Colors.white,
gradient: _templateData['id'] == template['id']
? const LinearGradient(
colors: [Colors.blue, Colors.pinkAccent],
@ -190,7 +194,7 @@ class _TemplateAllViewState extends State<TemplateAllView> {
padding: EdgeInsets.all(10.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.w),
color: Colors.white,
color: isDarkMode ? const Color(0xFF2D2D2D) : Colors.white,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -209,7 +213,7 @@ class _TemplateAllViewState extends State<TemplateAllView> {
template['name'],
style: TextStyle(
fontSize: 16.sp,
color: Colors.black87,
color: isDarkMode ? Colors.white : Colors.black87,
fontWeight: FontWeight.bold,
),
),
@ -224,14 +228,18 @@ class _TemplateAllViewState extends State<TemplateAllView> {
padding: EdgeInsets.symmetric(
horizontal: 5.w, vertical: 2.w),
decoration: BoxDecoration(
color: Colors.grey[200],
color: isDarkMode
? Colors.grey[700]
: Colors.grey[200],
borderRadius: BorderRadius.circular(4.r),
),
child: Text(
template['tag'][idx],
style: TextStyle(
fontSize: 10.sp,
color: Colors.grey[600],
color: isDarkMode
? Colors.grey[300]
: Colors.grey[600],
),
),
);
@ -243,7 +251,9 @@ class _TemplateAllViewState extends State<TemplateAllView> {
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12.sp,
color: Colors.grey[600],
color: isDarkMode
? Colors.grey[400]
: Colors.grey[600],
),
),
],
@ -277,7 +287,7 @@ class _TemplateAllViewState extends State<TemplateAllView> {
padding: EdgeInsets.all(10.w),
child: Icon(
Icons.fullscreen,
color: Colors.grey[600],
color: isDarkMode ? Colors.grey[400] : Colors.grey[600],
size: 26.w,
),
),

20
lib/modules/meeting/views/template/template_details_view.dart

@ -80,6 +80,7 @@ class _TemplateDetailsViewState extends State<TemplateDetailsView> {
style: TextStyle(
fontSize: 20.sp,
fontWeight: FontWeight.bold,
color: isDarkMode ? Colors.white : Colors.black87,
),
),
),
@ -90,6 +91,7 @@ class _TemplateDetailsViewState extends State<TemplateDetailsView> {
style: TextStyle(
fontSize: 12.sp,
fontWeight: FontWeight.bold,
color: isDarkMode ? Colors.white70 : Colors.black87,
),
),
),
@ -102,14 +104,15 @@ class _TemplateDetailsViewState extends State<TemplateDetailsView> {
padding:
EdgeInsets.symmetric(horizontal: 5.w, vertical: 2.w),
decoration: BoxDecoration(
color: Colors.grey[200],
color: isDarkMode ? Colors.grey[700] : Colors.grey[200],
borderRadius: BorderRadius.circular(4.r),
),
child: Text(
_templateData['tag'][idx],
style: TextStyle(
fontSize: 10.sp,
color: Colors.grey[600],
color:
isDarkMode ? Colors.grey[300] : Colors.grey[600],
),
),
);
@ -123,6 +126,7 @@ class _TemplateDetailsViewState extends State<TemplateDetailsView> {
style: TextStyle(
fontSize: 12.sp,
fontWeight: FontWeight.bold,
color: isDarkMode ? Colors.white70 : Colors.black87,
),
),
),
@ -130,7 +134,7 @@ class _TemplateDetailsViewState extends State<TemplateDetailsView> {
_templateData['desc'],
style: TextStyle(
fontSize: 14.sp,
color: Colors.grey[600],
color: isDarkMode ? Colors.grey[400] : Colors.grey[600],
),
),
Padding(
@ -140,11 +144,17 @@ class _TemplateDetailsViewState extends State<TemplateDetailsView> {
style: TextStyle(
fontSize: 12.sp,
fontWeight: FontWeight.bold,
color: isDarkMode ? Colors.white70 : Colors.black87,
),
),
),
MarkdownBody(
data: _templateData['prompt'],
styleSheet: MarkdownStyleSheet(
p: TextStyle(
color: isDarkMode ? Colors.grey[300] : Colors.black87,
),
),
),
],
),
@ -173,14 +183,14 @@ class _TemplateDetailsViewState extends State<TemplateDetailsView> {
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12.r),
border: Border.all(
color: Colors.black,
color: isDarkMode ? Colors.white : Colors.black,
),
),
child: Text(
'修改',
style: TextStyle(
fontSize: 16.sp,
color: Colors.black,
color: isDarkMode ? Colors.white : Colors.black,
),
),
),

32
lib/modules/meeting/views/template/template_edit_view.dart

@ -130,7 +130,7 @@ class _TemplateEditViewState extends State<TemplateEditView> {
color: _nameController.text.isNotEmpty &&
_descController.text.isNotEmpty &&
_promptController.text.isNotEmpty
? Colors.black
? (isDarkMode ? Colors.white : Colors.black)
: Colors.grey,
borderRadius: BorderRadius.circular(12.r),
),
@ -138,7 +138,11 @@ class _TemplateEditViewState extends State<TemplateEditView> {
'提交',
style: TextStyle(
fontSize: 16.sp,
color: Colors.white,
color: _nameController.text.isNotEmpty &&
_descController.text.isNotEmpty &&
_promptController.text.isNotEmpty
? (isDarkMode ? Colors.black : Colors.white)
: Colors.white,
),
),
),
@ -168,7 +172,7 @@ class _TemplateEditViewState extends State<TemplateEditView> {
title,
style: TextStyle(
fontSize: 14.sp,
color: isDarkMode ? Colors.white60 : Colors.black87,
color: isDarkMode ? Colors.white70 : Colors.black87,
),
),
),
@ -200,28 +204,30 @@ class _TemplateEditViewState extends State<TemplateEditView> {
margin: EdgeInsets.only(top: 10.w, bottom: 20.w),
alignment: Alignment.center,
decoration: BoxDecoration(
color: Colors.white,
color: isDarkMode ? const Color(0xFF2D2D2D) : Colors.white,
borderRadius: BorderRadius.circular(12.w),
boxShadow: [
BoxShadow(
color: Colors.black.withValues(alpha: 0.05),
blurRadius: 10,
offset: const Offset(0, 2),
),
],
boxShadow: isDarkMode
? null
: [
BoxShadow(
color: Colors.black.withValues(alpha: 0.05),
blurRadius: 10,
offset: const Offset(0, 2),
),
],
),
child: TextField(
controller: controller,
minLines: minLines,
maxLines: maxLines,
style: TextStyle(
color: Colors.black87,
color: isDarkMode ? Colors.white : Colors.black87,
fontSize: 14.sp,
),
decoration: InputDecoration(
hintText: hintText ?? '请输入$title',
hintStyle: TextStyle(
color: Colors.black54,
color: isDarkMode ? Colors.grey[500] : Colors.black54,
fontSize: 14.sp,
),
isDense: true,

33
lib/modules/meeting/views/template/template_view.dart

@ -179,6 +179,7 @@ class _TemplateViewState extends State<TemplateView> {
}
Widget _item(Map data, bool isLast) {
final isDarkMode = Theme.of(context).brightness == Brightness.dark;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -200,13 +201,13 @@ class _TemplateViewState extends State<TemplateView> {
data['name'],
style: TextStyle(
fontSize: 18.sp,
color: Colors.black87,
color: isDarkMode ? Colors.white : Colors.black87,
fontWeight: FontWeight.bold,
),
),
const Icon(
Icon(
Icons.keyboard_arrow_right,
color: Colors.grey,
color: isDarkMode ? Colors.grey[400] : Colors.grey,
)
],
),
@ -242,6 +243,7 @@ class _TemplateViewState extends State<TemplateView> {
}
Widget _template(Map template, bool isEdit) {
final isDarkMode = Theme.of(context).brightness == Brightness.dark;
return Container(
width: 200.w,
margin: EdgeInsets.symmetric(horizontal: 4.w),
@ -260,7 +262,7 @@ class _TemplateViewState extends State<TemplateView> {
Container(
padding: EdgeInsets.all(5.w),
decoration: BoxDecoration(
color: Colors.white,
color: isDarkMode ? const Color(0xFF2D2D2D) : Colors.white,
gradient: _templateData['id'] == template['id']
? const LinearGradient(
colors: [Colors.blue, Colors.pinkAccent],
@ -274,7 +276,7 @@ class _TemplateViewState extends State<TemplateView> {
padding: EdgeInsets.all(10.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.w),
color: Colors.white,
color: isDarkMode ? const Color(0xFF2D2D2D) : Colors.white,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -293,7 +295,7 @@ class _TemplateViewState extends State<TemplateView> {
template['name'],
style: TextStyle(
fontSize: 16.sp,
color: Colors.black87,
color: isDarkMode ? Colors.white : Colors.black87,
fontWeight: FontWeight.bold,
),
),
@ -308,14 +310,18 @@ class _TemplateViewState extends State<TemplateView> {
padding: EdgeInsets.symmetric(
horizontal: 5.w, vertical: 2.w),
decoration: BoxDecoration(
color: Colors.grey[200],
color: isDarkMode
? Colors.grey[700]
: Colors.grey[200],
borderRadius: BorderRadius.circular(4.r),
),
child: Text(
template['tag'][idx],
style: TextStyle(
fontSize: 10.sp,
color: Colors.grey[600],
color: isDarkMode
? Colors.grey[300]
: Colors.grey[600],
),
),
);
@ -327,7 +333,9 @@ class _TemplateViewState extends State<TemplateView> {
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12.sp,
color: Colors.grey[600],
color: isDarkMode
? Colors.grey[400]
: Colors.grey[600],
),
),
],
@ -347,7 +355,7 @@ class _TemplateViewState extends State<TemplateView> {
padding: EdgeInsets.all(10.w),
child: Icon(
Icons.fullscreen,
color: Colors.grey[600],
color: isDarkMode ? Colors.grey[400] : Colors.grey[600],
size: 26.w,
),
),
@ -403,6 +411,7 @@ class _TemplateViewState extends State<TemplateView> {
}
Widget _createTemplate(int categoryid) {
final isDarkMode = Theme.of(context).brightness == Brightness.dark;
return GestureDetector(
onTap: () async {
await Get.to(() => TemplateEditView(categoryid: categoryid));
@ -418,7 +427,7 @@ class _TemplateViewState extends State<TemplateView> {
borderRadius: BorderRadius.circular(14.w),
),
child: Container(
color: Colors.white,
color: isDarkMode ? const Color(0xFF2D2D2D) : Colors.white,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
@ -436,7 +445,7 @@ class _TemplateViewState extends State<TemplateView> {
'创建',
style: TextStyle(
fontSize: 16.sp,
color: Colors.black87,
color: isDarkMode ? Colors.white : Colors.black87,
fontWeight: FontWeight.bold,
),
),

Loading…
Cancel
Save