F8 班级系统: - ClassBloc 状态管理 (班级列表/日记墙/成员/主题/评语) - 班级主页: 日记墙 + 主题布置 Tab + 成员列表 - 老师管理页: 创建班级 + 布置主题 + 点评入口 - 班级码展示 + 评语卡片 F9 家长功能 (占位): - 家长中心页面框架: 日记查看/心情统计/使用时间/数据管理 - PIPL 合规提示卡片 F10 搜索/设置 (部分): - 个人中心: 用户信息 + 角色展示 + 功能入口 + 退出登录 - 搜索页: 标签筛选 + 心情过滤 + 搜索框 验证: flutter analyze 0 error
189 lines
6.7 KiB
Dart
189 lines
6.7 KiB
Dart
// 家长页面 — 只读查看 + 孩子数据管理
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:nuanji_app/core/theme/app_colors.dart';
|
|
|
|
/// 家长中心页面 — 家长查看孩子日记和统计
|
|
class ParentPage extends StatelessWidget {
|
|
const ParentPage({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = Theme.of(context);
|
|
final colorScheme = theme.colorScheme;
|
|
|
|
return Scaffold(
|
|
appBar: AppBar(title: const Text('家长中心')),
|
|
body: SingleChildScrollView(
|
|
padding: const EdgeInsets.all(16),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
// 孩子信息卡片
|
|
Card(
|
|
elevation: 0,
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(22)),
|
|
color: colorScheme.primaryContainer,
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(20),
|
|
child: Row(
|
|
children: [
|
|
CircleAvatar(
|
|
radius: 28,
|
|
backgroundColor: AppColors.rose.withValues(alpha: 0.2),
|
|
child: const Text('👶', style: TextStyle(fontSize: 24)),
|
|
),
|
|
const SizedBox(width: 16),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text('孩子的日记', style: theme.textTheme.titleMedium?.copyWith(fontWeight: FontWeight.bold)),
|
|
const SizedBox(height: 4),
|
|
Text('查看和管理孩子的日记数据', style: theme.textTheme.bodySmall?.copyWith(
|
|
color: colorScheme.onSurface.withValues(alpha: 0.6),
|
|
)),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 20),
|
|
|
|
// 功能列表
|
|
_ParentActionCard(
|
|
icon: Icons.auto_stories_outlined,
|
|
iconColor: AppColors.accent,
|
|
title: '日记查看',
|
|
subtitle: '只读查看孩子的日记和评语',
|
|
onTap: () => ScaffoldMessenger.of(context).showSnackBar(
|
|
const SnackBar(content: Text('F9: 家长日记查看待实现')),
|
|
),
|
|
),
|
|
const SizedBox(height: 12),
|
|
_ParentActionCard(
|
|
icon: Icons.bar_chart_outlined,
|
|
iconColor: AppColors.secondary,
|
|
title: '心情统计',
|
|
subtitle: '查看孩子的写作频率和心情趋势',
|
|
onTap: () => ScaffoldMessenger.of(context).showSnackBar(
|
|
const SnackBar(content: Text('F9: 心情统计待实现')),
|
|
),
|
|
),
|
|
const SizedBox(height: 12),
|
|
_ParentActionCard(
|
|
icon: Icons.timer_outlined,
|
|
iconColor: AppColors.tertiary,
|
|
title: '使用时间',
|
|
subtitle: '设置孩子每天的使用时间限制',
|
|
onTap: () => ScaffoldMessenger.of(context).showSnackBar(
|
|
const SnackBar(content: Text('F9: 使用时间限制待实现')),
|
|
),
|
|
),
|
|
const SizedBox(height: 12),
|
|
_ParentActionCard(
|
|
icon: Icons.download_outlined,
|
|
iconColor: colorScheme.primary,
|
|
title: '数据管理',
|
|
subtitle: '导出或删除孩子的日记数据',
|
|
onTap: () => ScaffoldMessenger.of(context).showSnackBar(
|
|
const SnackBar(content: Text('F9: 数据管理待实现')),
|
|
),
|
|
),
|
|
const SizedBox(height: 24),
|
|
|
|
// PIPL 提示
|
|
Container(
|
|
padding: const EdgeInsets.all(12),
|
|
decoration: BoxDecoration(
|
|
color: colorScheme.surfaceContainerHighest,
|
|
borderRadius: BorderRadius.circular(12),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Icon(Icons.shield_outlined, size: 18, color: colorScheme.onSurface.withValues(alpha: 0.5)),
|
|
const SizedBox(width: 8),
|
|
Expanded(
|
|
child: Text(
|
|
'根据《个人信息保护法》,您有权查阅、更正、删除和导出孩子的数据。',
|
|
style: theme.textTheme.bodySmall?.copyWith(
|
|
color: colorScheme.onSurface.withValues(alpha: 0.5),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class _ParentActionCard extends StatelessWidget {
|
|
const _ParentActionCard({
|
|
required this.icon,
|
|
required this.iconColor,
|
|
required this.title,
|
|
required this.subtitle,
|
|
required this.onTap,
|
|
});
|
|
|
|
final IconData icon;
|
|
final Color iconColor;
|
|
final String title;
|
|
final String subtitle;
|
|
final VoidCallback onTap;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = Theme.of(context);
|
|
final colorScheme = theme.colorScheme;
|
|
|
|
return Card(
|
|
elevation: 0,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(16),
|
|
side: BorderSide(color: colorScheme.outlineVariant),
|
|
),
|
|
child: InkWell(
|
|
onTap: onTap,
|
|
borderRadius: BorderRadius.circular(16),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(16),
|
|
child: Row(
|
|
children: [
|
|
Container(
|
|
width: 44,
|
|
height: 44,
|
|
decoration: BoxDecoration(
|
|
color: iconColor.withValues(alpha: 0.12),
|
|
borderRadius: BorderRadius.circular(12),
|
|
),
|
|
child: Icon(icon, color: iconColor, size: 22),
|
|
),
|
|
const SizedBox(width: 16),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(title, style: theme.textTheme.titleSmall?.copyWith(fontWeight: FontWeight.w600)),
|
|
const SizedBox(height: 2),
|
|
Text(subtitle, style: theme.textTheme.bodySmall?.copyWith(
|
|
color: colorScheme.onSurface.withValues(alpha: 0.5),
|
|
)),
|
|
],
|
|
),
|
|
),
|
|
Icon(Icons.chevron_right, color: colorScheme.onSurface.withValues(alpha: 0.3)),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|