05f972e98a
- Replace Color(0xFFF8FAFC) with AppColors.surfaceSecondary (11 uses) - Replace Color(0xFFF8FAFF) with AppColors.surfaceTertiary (9 uses) - Replace Color(0xFFE2E8F0) with AppColors.borderSecondary (5 uses) - Replace Color(0xFFDCE5F4) with AppColors.borderTertiary (5 uses) - Replace Color(0xFFCFE1FB) with AppColors.borderQuaternary (5 uses) - Replace Color(0xFFF59E0B) with AppColors.warning (4 uses) - Replace Color(0xFFEAF3FF) with AppColors.surfaceInfo (4 uses) - Replace Color(0xFF10B981) with AppColors.success (4 uses) - Replace Color(0xFFEF4444) with AppColors.error (3 uses) - Replace Color(0xFFF3F7FF) with AppColors.surfaceInfoLight (3 uses) Files migrated: - settings_screen.dart (7 colors migrated) - contacts_screen.dart (3 colors migrated) - calendar_event_detail_screen.dart (10 colors migrated) - features_screen.dart (3 colors migrated) - toast_type_config.dart (3 colors migrated) - memory_screen.dart (4 colors migrated) - account_screen.dart (3 colors migrated) - add_contact_screen.dart (2 colors migrated) Total: 37 hardcoded colors replaced with design tokens Verification: - flutter analyze: passed - flutter test: passed
207 lines
6.2 KiB
Dart
207 lines
6.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../../../../core/theme/design_tokens.dart';
|
|
import '../../../../shared/widgets/page_header.dart' as widgets;
|
|
|
|
class FeaturesScreen extends StatefulWidget {
|
|
const FeaturesScreen({super.key});
|
|
|
|
@override
|
|
State<FeaturesScreen> createState() => _FeaturesScreenState();
|
|
}
|
|
|
|
class _FeaturesScreenState extends State<FeaturesScreen> {
|
|
bool _dailyReminderEnabled = true;
|
|
bool _dailySummaryEnabled = false;
|
|
bool _weeklyReportEnabled = true;
|
|
bool _weeklyDigestEnabled = false;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: AppColors.surfaceSecondary,
|
|
body: SafeArea(
|
|
child: Column(
|
|
children: [
|
|
const widgets.PageHeader(leading: widgets.BackButton()),
|
|
Expanded(
|
|
child: SingleChildScrollView(
|
|
padding: const EdgeInsets.fromLTRB(20, 8, 20, 20),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
_buildSectionTitle('每日'),
|
|
const SizedBox(height: 8),
|
|
_buildDailyList(),
|
|
const SizedBox(height: 16),
|
|
_buildSectionTitle('每周'),
|
|
const SizedBox(height: 8),
|
|
_buildWeeklyList(),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildSectionTitle(String title) {
|
|
return Text(
|
|
title,
|
|
style: const TextStyle(
|
|
fontSize: 13,
|
|
fontWeight: FontWeight.w600,
|
|
color: AppColors.slate500,
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildDailyList() {
|
|
return Column(
|
|
children: [
|
|
_buildFeatureCard(
|
|
icon: Icons.alarm,
|
|
iconColor: const Color(0xFF14B8A6),
|
|
iconBg: const Color(0xFFECFEFF),
|
|
iconBorder: const Color(0xFFC9F4F2),
|
|
title: '会议提醒',
|
|
subtitle: '每次会议前 15 分钟提醒',
|
|
value: _dailyReminderEnabled,
|
|
onChanged: (v) => setState(() => _dailyReminderEnabled = v),
|
|
),
|
|
const SizedBox(height: 10),
|
|
_buildFeatureCard(
|
|
icon: Icons.summarize,
|
|
iconColor: const Color(0xFF2563EB),
|
|
iconBg: const Color(0xFFEEF6FF),
|
|
iconBorder: const Color(0xFFDCEAFF),
|
|
title: '每日摘要',
|
|
subtitle: '每天 18:00 发送当日摘要',
|
|
value: _dailySummaryEnabled,
|
|
onChanged: (v) => setState(() => _dailySummaryEnabled = v),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget _buildWeeklyList() {
|
|
return Column(
|
|
children: [
|
|
_buildFeatureCard(
|
|
icon: Icons.calendar_view_week,
|
|
iconColor: AppColors.success,
|
|
iconBg: const Color(0xFFECFDF5),
|
|
iconBorder: const Color(0xFFCDEEDC),
|
|
title: '周报生成',
|
|
subtitle: '每周一自动生成周报',
|
|
value: _weeklyReportEnabled,
|
|
onChanged: (v) => setState(() => _weeklyReportEnabled = v),
|
|
),
|
|
const SizedBox(height: 10),
|
|
_buildFeatureCard(
|
|
icon: Icons.article,
|
|
iconColor: AppColors.warning,
|
|
iconBg: const Color(0xFFFFF7ED),
|
|
iconBorder: const Color(0xFFFDE6CD),
|
|
title: '每周摘要',
|
|
subtitle: '每周日发送本周活动汇总',
|
|
value: _weeklyDigestEnabled,
|
|
onChanged: (v) => setState(() => _weeklyDigestEnabled = v),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget _buildFeatureCard({
|
|
required IconData icon,
|
|
required Color iconColor,
|
|
required Color iconBg,
|
|
required Color iconBorder,
|
|
required String title,
|
|
required String subtitle,
|
|
required bool value,
|
|
required ValueChanged<bool> onChanged,
|
|
}) {
|
|
return Container(
|
|
padding: const EdgeInsets.all(14),
|
|
decoration: BoxDecoration(
|
|
color: AppColors.white,
|
|
borderRadius: BorderRadius.circular(16),
|
|
border: Border.all(color: const Color(0xFFE4ECF6)),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Container(
|
|
width: 40,
|
|
height: 40,
|
|
decoration: BoxDecoration(
|
|
color: iconBg,
|
|
borderRadius: BorderRadius.circular(12),
|
|
border: Border.all(color: iconBorder),
|
|
),
|
|
child: Icon(icon, size: 18, color: iconColor),
|
|
),
|
|
const SizedBox(width: 12),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
title,
|
|
style: const TextStyle(
|
|
fontSize: 15,
|
|
fontWeight: FontWeight.w600,
|
|
color: AppColors.slate900,
|
|
),
|
|
),
|
|
const SizedBox(height: 4),
|
|
Text(
|
|
subtitle,
|
|
style: const TextStyle(
|
|
fontSize: 12,
|
|
fontWeight: FontWeight.normal,
|
|
color: AppColors.slate500,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
_buildToggle(value, onChanged),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildToggle(bool value, ValueChanged<bool> onChanged) {
|
|
return GestureDetector(
|
|
onTap: () => onChanged(!value),
|
|
child: Container(
|
|
width: 44,
|
|
height: 24,
|
|
padding: const EdgeInsets.all(2),
|
|
decoration: BoxDecoration(
|
|
color: value ? const Color(0xFFBFDBFE) : const Color(0xFFF1F5FC),
|
|
borderRadius: BorderRadius.circular(12),
|
|
border: Border.all(
|
|
color: value ? const Color(0xFF93C5FD) : const Color(0xFFD5DFEE),
|
|
),
|
|
),
|
|
child: AnimatedAlign(
|
|
duration: const Duration(milliseconds: 150),
|
|
alignment: value ? Alignment.centerRight : Alignment.centerLeft,
|
|
child: Container(
|
|
width: 20,
|
|
height: 20,
|
|
decoration: BoxDecoration(
|
|
color: AppColors.white,
|
|
borderRadius: BorderRadius.circular(10),
|
|
border: Border.all(color: const Color(0xFFCCDDF8)),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|