feat(app): F8 班级系统 + F9/F10 占位页面
F8 班级系统: - ClassBloc 状态管理 (班级列表/日记墙/成员/主题/评语) - 班级主页: 日记墙 + 主题布置 Tab + 成员列表 - 老师管理页: 创建班级 + 布置主题 + 点评入口 - 班级码展示 + 评语卡片 F9 家长功能 (占位): - 家长中心页面框架: 日记查看/心情统计/使用时间/数据管理 - PIPL 合规提示卡片 F10 搜索/设置 (部分): - 个人中心: 用户信息 + 角色展示 + 功能入口 + 退出登录 - 搜索页: 标签筛选 + 心情过滤 + 搜索框 验证: flutter analyze 0 error
This commit is contained in:
@@ -1,13 +1,277 @@
|
||||
import 'package:flutter/material.dart';
|
||||
// 老师管理页面 — 创建班级 + 布置主题 + 点评日记
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:nuanji_app/core/theme/app_colors.dart';
|
||||
import '../../class_/bloc/class_bloc.dart';
|
||||
|
||||
/// 老师管理页面 — 教师专属功能入口
|
||||
class TeacherPage extends StatelessWidget {
|
||||
const TeacherPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const Scaffold(
|
||||
body: Center(
|
||||
child: Text('教师 - 占位页面'),
|
||||
return BlocProvider(
|
||||
create: (context) => ClassBloc()..add(const ClassLoadMyClasses()),
|
||||
child: const _TeacherView(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _TeacherView extends StatelessWidget {
|
||||
const _TeacherView();
|
||||
|
||||
@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: [
|
||||
// 创建班级卡片
|
||||
_ActionCard(
|
||||
icon: Icons.add_circle_outline,
|
||||
iconColor: AppColors.accent,
|
||||
title: '创建班级',
|
||||
subtitle: '创建新班级并邀请学生加入',
|
||||
onTap: () => _showCreateClassDialog(context),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// 布置主题卡片
|
||||
_ActionCard(
|
||||
icon: Icons.assignment_outlined,
|
||||
iconColor: AppColors.secondary,
|
||||
title: '布置主题',
|
||||
subtitle: '给班级布置日记写作主题',
|
||||
onTap: () => _showAssignTopicDialog(context),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// 班级码管理
|
||||
_ActionCard(
|
||||
icon: Icons.qr_code,
|
||||
iconColor: AppColors.tertiary,
|
||||
title: '班级码管理',
|
||||
subtitle: '查看和重置班级码',
|
||||
onTap: () {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('班级码: a1b2c3')),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// 最近点评
|
||||
Text(
|
||||
'快捷功能',
|
||||
style: theme.textTheme.titleMedium?.copyWith(fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_ActionCard(
|
||||
icon: Icons.rate_review_outlined,
|
||||
iconColor: AppColors.rose,
|
||||
title: '点评日记',
|
||||
subtitle: '查看学生日记并点评',
|
||||
onTap: () => context.go('/class'),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_ActionCard(
|
||||
icon: Icons.bar_chart_outlined,
|
||||
iconColor: colorScheme.primary,
|
||||
title: '班级统计',
|
||||
subtitle: '查看班级写作活跃度',
|
||||
onTap: () => context.go('/mood'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _showCreateClassDialog(BuildContext context) {
|
||||
final nameController = TextEditingController();
|
||||
final schoolController = TextEditingController();
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (dialogContext) => AlertDialog(
|
||||
title: const Text('创建班级'),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
TextField(
|
||||
controller: nameController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: '班级名称',
|
||||
hintText: '例如: 三年二班',
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
TextField(
|
||||
controller: schoolController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: '学校名称(可选)',
|
||||
hintText: '例如: 阳光小学',
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(dialogContext),
|
||||
child: const Text('取消'),
|
||||
),
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
if (nameController.text.trim().isNotEmpty) {
|
||||
context.read<ClassBloc>().add(ClassCreate(
|
||||
name: nameController.text.trim(),
|
||||
schoolName: schoolController.text.trim().isEmpty
|
||||
? null
|
||||
: schoolController.text.trim(),
|
||||
));
|
||||
Navigator.pop(dialogContext);
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('班级创建成功!')),
|
||||
);
|
||||
}
|
||||
},
|
||||
child: const Text('创建'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _showAssignTopicDialog(BuildContext context) {
|
||||
final titleController = TextEditingController();
|
||||
final descController = TextEditingController();
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (dialogContext) => AlertDialog(
|
||||
title: const Text('布置主题'),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
TextField(
|
||||
controller: titleController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: '主题标题',
|
||||
hintText: '例如: 我的周末',
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
TextField(
|
||||
controller: descController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: '描述(可选)',
|
||||
hintText: '主题要求和说明',
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
maxLines: 3,
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(dialogContext),
|
||||
child: const Text('取消'),
|
||||
),
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
if (titleController.text.trim().isNotEmpty) {
|
||||
context.read<ClassBloc>().add(TopicAssign(
|
||||
classId: 'class-1',
|
||||
title: titleController.text.trim(),
|
||||
description: descController.text.trim().isEmpty
|
||||
? null
|
||||
: descController.text.trim(),
|
||||
));
|
||||
Navigator.pop(dialogContext);
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('主题布置成功!')),
|
||||
);
|
||||
}
|
||||
},
|
||||
child: const Text('布置'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// 操作卡片
|
||||
class _ActionCard extends StatelessWidget {
|
||||
const _ActionCard({
|
||||
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)),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user