and so on
This commit is contained in:
@@ -2,10 +2,10 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:maibu_satabot_v2/core/di/injection.dart';
|
||||
import 'package:maibu_satabot_v2/core/theme/AppTheme.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/message_center/domain/entities/message_category_entity.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/message_center/presentation/bloc/message_center_cubit.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/message_center/presentation/bloc/message_center_state.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/waring_center/presentation/constants/alarm_constants.dart';
|
||||
|
||||
/// 消息中心页面
|
||||
class MessageCenterPage extends StatelessWidget {
|
||||
@@ -28,7 +28,7 @@ class MessageCenterView extends StatelessWidget {
|
||||
final cubit = context.read<MessageCenterCubit>();
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: AlarmColors.background,
|
||||
backgroundColor: context.appColors.pageBackground,
|
||||
body: BlocConsumer<MessageCenterCubit, MessageCenterState>(
|
||||
listener: (context, state) {
|
||||
if (state is MessageCenterActionInProgress) {
|
||||
@@ -70,11 +70,11 @@ class MessageCenterView extends StatelessWidget {
|
||||
// 右侧:一键已读按钮
|
||||
GestureDetector(
|
||||
onTap: () => cubit.markAllAsRead(),
|
||||
child: const Text(
|
||||
child: Text(
|
||||
'一键已读',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: AlarmColors.primary,
|
||||
color: context.appColors.primary,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
@@ -95,15 +95,15 @@ class MessageCenterView extends StatelessWidget {
|
||||
return DropdownButton<MessageType>(
|
||||
value: selectedType,
|
||||
underline: const SizedBox(),
|
||||
icon: const Icon(
|
||||
icon: Icon(
|
||||
Icons.keyboard_arrow_down,
|
||||
size: 20,
|
||||
color: AlarmColors.textSecondary,
|
||||
color: context.appColors.textSecondary,
|
||||
),
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AlarmColors.textPrimary,
|
||||
color: context.appColors.textPrimary,
|
||||
),
|
||||
items: MessageType.values.map((type) {
|
||||
return DropdownMenuItem<MessageType>(
|
||||
@@ -123,7 +123,7 @@ class MessageCenterView extends StatelessWidget {
|
||||
|
||||
Widget _buildContent(BuildContext context, MessageCenterState state) {
|
||||
if (state is MessageCenterLoading) {
|
||||
return _buildSkeletonScreen();
|
||||
return _buildSkeletonScreen(context);
|
||||
}
|
||||
if (state is MessageCenterError) {
|
||||
return _buildErrorState(context, state.message);
|
||||
@@ -142,9 +142,9 @@ class MessageCenterView extends StatelessWidget {
|
||||
return Center(
|
||||
child: Text(
|
||||
'暂无消息',
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: AlarmColors.textSecondary,
|
||||
color: context.appColors.textSecondary,
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -176,7 +176,7 @@ class MessageCenterView extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildSkeletonScreen() {
|
||||
Widget _buildSkeletonScreen(BuildContext context) {
|
||||
return ListView.separated(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
itemCount: 6,
|
||||
@@ -185,11 +185,11 @@ class MessageCenterView extends StatelessWidget {
|
||||
return Container(
|
||||
height: 80,
|
||||
decoration: BoxDecoration(
|
||||
color: AlarmColors.background,
|
||||
borderRadius: BorderRadius.circular(AlarmDimensions.borderRadius),
|
||||
color: context.appColors.cardBackground,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(color: context.appColors.primary),
|
||||
),
|
||||
);
|
||||
},
|
||||
@@ -204,14 +204,14 @@ class MessageCenterView extends StatelessWidget {
|
||||
Icon(
|
||||
Icons.error_outline,
|
||||
size: 64,
|
||||
color: AlarmColors.danger,
|
||||
color: context.appColors.danger,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
message,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: AlarmColors.textSecondary,
|
||||
color: context.appColors.textSecondary,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
@@ -244,19 +244,19 @@ class MessageCenterView extends StatelessWidget {
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(24),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
color: context.appColors.cardBackground,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const CircularProgressIndicator(),
|
||||
CircularProgressIndicator(color: context.appColors.primary),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'$action中...',
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: AlarmColors.textSecondary,
|
||||
color: context.appColors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -288,8 +288,8 @@ class _MessageCategoryCard extends StatelessWidget {
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: AlarmColors.background,
|
||||
borderRadius: BorderRadius.circular(AlarmDimensions.borderRadius),
|
||||
color: context.appColors.cardBackground,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
@@ -307,16 +307,16 @@ class _MessageCategoryCard extends StatelessWidget {
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: isUnread ? FontWeight.bold : FontWeight.w500,
|
||||
color: AlarmColors.textPrimary,
|
||||
color: context.appColors.textPrimary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
// 内容摘要
|
||||
Text(
|
||||
message.content,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: AlarmColors.textSecondary,
|
||||
color: context.appColors.textSecondary,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
@@ -330,13 +330,13 @@ class _MessageCategoryCard extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
// 未读角标
|
||||
if (isUnread) _buildUnreadBadge(),
|
||||
if (isUnread) _buildUnreadBadge(context),
|
||||
// 时间
|
||||
Text(
|
||||
message.time,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: AlarmColors.textSecondary,
|
||||
color: context.appColors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -391,13 +391,13 @@ class _MessageCategoryCard extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildUnreadBadge() {
|
||||
Widget _buildUnreadBadge(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 4),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: AlarmColors.danger,
|
||||
color: context.appColors.danger,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Text(
|
||||
|
||||
Reference in New Issue
Block a user