| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268 |
- import 'package:flutter/material.dart';
- import 'package:go_router/go_router.dart';
- import 'package:flutter_riverpod/flutter_riverpod.dart';
- import '../../core/theme/app_colors.dart';
- import '../shell/nav_bar_config.dart';
- import '../../core/utils/date_utils.dart' as du;
- import '../../core/i18n/app_localizations.dart';
- import 'announcement_list_controller.dart';
- class AnnouncementDetailPage extends ConsumerWidget {
- final String id;
- const AnnouncementDetailPage({super.key, required this.id});
- @override
- Widget build(BuildContext context, WidgetRef ref) {
- final item = mockAnnouncements.firstWhere(
- (e) => e.id == id,
- orElse: () => mockAnnouncements.first,
- );
- final l10n = AppLocalizations.of(context);
- ref
- .read(navBarConfigProvider.notifier)
- .update(
- NavBarConfig(
- title: l10n.get('announcementDetail'),
- showBack: true,
- onBack: () => context.pop(),
- ),
- );
- return SingleChildScrollView(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- // 红色横幅区
- Container(
- width: double.infinity,
- padding: const EdgeInsets.all(24),
- color: AppColors.bgCard,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- item.title,
- style: const TextStyle(
- fontSize: 20,
- fontWeight: FontWeight.w700,
- color: AppColors.textPrimary,
- height: 1.4,
- ),
- ),
- const SizedBox(height: 12),
- Row(
- children: [
- Text(
- item.publisherName,
- style: const TextStyle(
- fontSize: 13,
- color: AppColors.textSecondary,
- ),
- ),
- const SizedBox(width: 12),
- Text(
- du.DateUtils.formatDateTime(item.publishTime),
- style: const TextStyle(
- fontSize: 13,
- color: AppColors.textPlaceholder,
- ),
- ),
- ],
- ),
- ],
- ),
- ),
- // 红色分隔线
- Container(width: double.infinity, height: 2, color: AppColors.danger),
- // 正文内容
- Padding(
- padding: const EdgeInsets.all(16),
- child: Container(
- width: double.infinity,
- padding: const EdgeInsets.all(20),
- decoration: BoxDecoration(
- color: AppColors.bgCard,
- borderRadius: BorderRadius.circular(8),
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- '各部门、各位同事:',
- style: const TextStyle(
- fontSize: 14,
- color: AppColors.textPrimary,
- height: 1.7,
- ),
- ),
- const SizedBox(height: 12),
- Text(
- item.content,
- style: const TextStyle(
- fontSize: 14,
- color: AppColors.textSecondary,
- height: 1.7,
- ),
- ),
- ],
- ),
- ),
- ),
- // 附件
- if (item.attachments.isNotEmpty)
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- const Text(
- '附件下载',
- style: TextStyle(
- fontSize: 14,
- fontWeight: FontWeight.w600,
- color: AppColors.textPrimary,
- ),
- ),
- const SizedBox(height: 8),
- ...item.attachments.map(
- (att) => Container(
- width: double.infinity,
- margin: const EdgeInsets.only(bottom: 8),
- padding: const EdgeInsets.all(12),
- decoration: BoxDecoration(
- color: AppColors.bgCard,
- borderRadius: BorderRadius.circular(8),
- ),
- child: Row(
- children: [
- const Icon(
- Icons.description_outlined,
- size: 20,
- color: AppColors.primary,
- ),
- const SizedBox(width: 8),
- Expanded(
- child: Text(
- att,
- style: const TextStyle(
- fontSize: 14,
- color: AppColors.textPrimary,
- ),
- ),
- ),
- Text(
- '${(att.length * 100) ~/ 1000}KB',
- style: const TextStyle(
- fontSize: 12,
- color: AppColors.textPlaceholder,
- ),
- ),
- const SizedBox(width: 8),
- const Icon(
- Icons.download_outlined,
- size: 16,
- color: AppColors.textPlaceholder,
- ),
- ],
- ),
- ),
- ),
- ],
- ),
- ),
- // 审计区
- Padding(
- padding: const EdgeInsets.all(16),
- child: Container(
- width: double.infinity,
- padding: const EdgeInsets.all(16),
- decoration: BoxDecoration(
- color: AppColors.bgCard,
- borderRadius: BorderRadius.circular(8),
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- const Text(
- '全员触达率审计追踪',
- style: TextStyle(
- fontSize: 14,
- fontWeight: FontWeight.w600,
- color: AppColors.textPrimary,
- ),
- ),
- const SizedBox(height: 12),
- Row(
- children: [
- Container(
- padding: const EdgeInsets.symmetric(
- horizontal: 12,
- vertical: 6,
- ),
- decoration: BoxDecoration(
- color: AppColors.successBg,
- borderRadius: BorderRadius.circular(16),
- ),
- child: Text(
- '${item.readCount} 人已读',
- style: const TextStyle(
- fontSize: 12,
- color: AppColors.success,
- ),
- ),
- ),
- const SizedBox(width: 12),
- Container(
- padding: const EdgeInsets.symmetric(
- horizontal: 12,
- vertical: 6,
- ),
- decoration: BoxDecoration(
- color: AppColors.bgPage,
- borderRadius: BorderRadius.circular(16),
- ),
- child: Text(
- '${item.unreadCount} 人未读',
- style: const TextStyle(
- fontSize: 12,
- color: AppColors.statusGray,
- ),
- ),
- ),
- ],
- ),
- const SizedBox(height: 12),
- Container(
- width: double.infinity,
- padding: const EdgeInsets.symmetric(
- horizontal: 16,
- vertical: 10,
- ),
- decoration: BoxDecoration(
- color: AppColors.danger,
- borderRadius: BorderRadius.circular(20),
- ),
- child: const Text(
- '一键强力 DING 催办',
- textAlign: TextAlign.center,
- style: TextStyle(
- fontSize: 14,
- fontWeight: FontWeight.w600,
- color: Colors.white,
- ),
- ),
- ),
- ],
- ),
- ),
- ),
- const SizedBox(height: 24),
- ],
- ),
- );
- }
- }
|