feat(app): 多页面动态化 — 搜索/资料/教师/贴纸库/模板/日历
- SearchPage: 热搜词从日记标签频率动态生成 + 模板搜索网格 - ProfilePage: 成就徽章从 AchievementBloc 动态加载 + 头像首字母 - TeacherPage: 班级码改为对话框展示 (班级名+码+人数) - StickerLibraryPage: 分类从 API 动态合并 + 精选包卡片动态化 - TemplateGalleryPage: 适配动态数据 - ClassPage: 微调 - HomePage: 路由适配 - CalendarBloc: 新增测试 - AppRouter: 路由更新
This commit is contained in:
@@ -67,11 +67,7 @@ class _TeacherView extends StatelessWidget {
|
||||
iconColor: AppColors.tertiary,
|
||||
title: '班级码管理',
|
||||
subtitle: '查看和重置班级码',
|
||||
onTap: () {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('班级码: a1b2c3')),
|
||||
);
|
||||
},
|
||||
onTap: () => _showClassCodes(context),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
@@ -159,6 +155,40 @@ class _TeacherView extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
void _showClassCodes(BuildContext context) {
|
||||
final classState = context.read<ClassBloc>().state;
|
||||
final classes = classState is ClassListLoaded ? classState.classes : <SchoolClass>[];
|
||||
|
||||
if (classes.isEmpty) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('请先创建班级')),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (dialogContext) => AlertDialog(
|
||||
title: const Text('班级码管理'),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: classes.map((c) => ListTile(
|
||||
leading: const Icon(Icons.qr_code, color: AppColors.tertiary),
|
||||
title: Text(c.name),
|
||||
subtitle: Text('班级码: ${c.classCode} · ${c.memberCount} 人'),
|
||||
dense: true,
|
||||
)).toList(),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(dialogContext),
|
||||
child: const Text('关闭'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _showAssignTopicDialog(BuildContext context) {
|
||||
final titleController = TextEditingController();
|
||||
final descController = TextEditingController();
|
||||
|
||||
Reference in New Issue
Block a user