160 lines
4.6 KiB
Dart
160 lines
4.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_animate/flutter_animate.dart';
|
|
import '../theme.dart';
|
|
|
|
class SystemMessagesPage extends StatelessWidget {
|
|
const SystemMessagesPage({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final messages = <_SystemMessage>[
|
|
_SystemMessage(
|
|
title: '版本更新',
|
|
content: '智念商家端 v1.0.1 已发布,新增应用插件中心,优化首页和消息中心交互体验。',
|
|
time: '今天 09:30',
|
|
type: '版本更新',
|
|
typeColor: const Color(0xFF3B82F6),
|
|
),
|
|
_SystemMessage(
|
|
title: '春节运营公告',
|
|
content: '春节期间平台手续费立减 30%,详情可在「活动发布」中查看活动模板。',
|
|
time: '昨天 18:20',
|
|
type: '运营公告',
|
|
typeColor: const Color(0xFF10B981),
|
|
),
|
|
_SystemMessage(
|
|
title: '安全提醒',
|
|
content: '检测到近期有钓鱼链接冒用商家端信息,请勿在陌生短信中点击链接登录。',
|
|
time: '3 天前',
|
|
type: '安全提醒',
|
|
typeColor: const Color(0xFFF59E0B),
|
|
),
|
|
];
|
|
|
|
return Scaffold(
|
|
backgroundColor: AppColors.background,
|
|
appBar: AppBar(
|
|
title: const Text('系统通知'),
|
|
backgroundColor: AppColors.surface,
|
|
elevation: 0,
|
|
scrolledUnderElevation: 0,
|
|
surfaceTintColor: Colors.transparent,
|
|
),
|
|
body: messages.isEmpty
|
|
? _buildEmpty()
|
|
: ListView.builder(
|
|
padding: const EdgeInsets.fromLTRB(16, 16, 16, 24),
|
|
itemCount: messages.length,
|
|
itemBuilder: (context, index) {
|
|
final m = messages[index];
|
|
return _buildMessageCard(m, index);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildMessageCard(_SystemMessage m, int index) {
|
|
return Container(
|
|
margin: const EdgeInsets.only(bottom: 12),
|
|
padding: const EdgeInsets.all(16),
|
|
decoration: BoxDecoration(
|
|
color: AppColors.surface,
|
|
borderRadius: BorderRadius.circular(16),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.black.withOpacity(0.03),
|
|
blurRadius: 10,
|
|
offset: const Offset(0, 2),
|
|
),
|
|
],
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3),
|
|
decoration: BoxDecoration(
|
|
color: m.typeColor.withOpacity(0.1),
|
|
borderRadius: BorderRadius.circular(6),
|
|
),
|
|
child: Text(
|
|
m.type,
|
|
style: TextStyle(
|
|
fontSize: 11,
|
|
color: m.typeColor,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
),
|
|
const Spacer(),
|
|
Text(
|
|
m.time,
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
color: AppColors.textTertiary,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 12),
|
|
Text(
|
|
m.title,
|
|
style: TextStyle(
|
|
fontSize: 15,
|
|
fontWeight: FontWeight.w600,
|
|
color: AppColors.textPrimary,
|
|
),
|
|
),
|
|
const SizedBox(height: 6),
|
|
Text(
|
|
m.content,
|
|
style: TextStyle(
|
|
fontSize: 13,
|
|
color: AppColors.textSecondary,
|
|
height: 1.55,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
).animate().fadeIn(duration: 300.ms, delay: (index * 60).ms).slideY(begin: 0.1, end: 0, duration: 300.ms);
|
|
}
|
|
|
|
Widget _buildEmpty() {
|
|
return Center(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Icon(
|
|
Icons.notifications_off_outlined,
|
|
size: 64,
|
|
color: AppColors.textTertiary.withOpacity(0.5),
|
|
),
|
|
const SizedBox(height: 16),
|
|
Text(
|
|
'暂无系统通知',
|
|
style: TextStyle(fontSize: 16, color: AppColors.textSecondary),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class _SystemMessage {
|
|
final String title;
|
|
final String content;
|
|
final String time;
|
|
final String type;
|
|
final Color typeColor;
|
|
|
|
const _SystemMessage({
|
|
required this.title,
|
|
required this.content,
|
|
required this.time,
|
|
required this.type,
|
|
required this.typeColor,
|
|
});
|
|
}
|