feat: select school terms and smooth refractive Dock motion

This commit is contained in:
Codex
2026-10-13 19:08:36 +08:00
parent 3e2d8864af
commit 50fcc70e8e
33 changed files with 1245 additions and 94 deletions
@@ -3,11 +3,13 @@ import 'package:flutter/material.dart';
import '../../app/app_controller.dart';
import '../../app/app_theme.dart';
import '../../domain/schedule_engine.dart';
import '../profile/settings_page.dart';
import 'week_grid.dart';
class TimetablePage extends StatefulWidget {
const TimetablePage({super.key, required this.controller});
const TimetablePage({super.key, required this.controller, this.onSync});
final AppController controller;
final VoidCallback? onSync;
@override
State<TimetablePage> createState() => _TimetablePageState();
}
@@ -40,13 +42,32 @@ class _TimetablePageState extends State<TimetablePage> {
140 + MediaQuery.paddingOf(context).bottom,
),
children: [
const Padding(
Padding(
padding: EdgeInsets.symmetric(horizontal: 14),
child: Text(
'RSchedule',
style: TextStyle(fontSize: 22, fontWeight: FontWeight.w700),
child: Row(
children: [
const Expanded(
child: Text(
'课表',
style: TextStyle(fontSize: 22, fontWeight: FontWeight.w700),
),
),
IconButton(
tooltip: '刷新课表',
onPressed: widget.onSync,
icon: const Icon(Icons.sync_rounded),
),
],
),
),
if (!c.isDemo && c.snapshot.schoolTerm != null)
Padding(
padding: const EdgeInsets.fromLTRB(14, 0, 14, 8),
child: Text(
c.snapshot.schoolTerm!.label,
style: TextStyle(fontSize: 12, color: ink.withValues(alpha: 0.5)),
),
),
const SizedBox(height: 10),
SurfaceCard(
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 0),
@@ -142,6 +163,51 @@ class _TimetablePageState extends State<TimetablePage> {
textAlign: TextAlign.center,
style: TextStyle(fontSize: 11, color: ink.withValues(alpha: 0.35)),
),
] else if (c.visibleCourses.isNotEmpty) ...[
const SizedBox(height: 36),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 14),
child: SurfaceCard(
child: Column(
children: [
const Icon(
Icons.event_available_rounded,
size: 44,
color: river,
),
const SizedBox(height: 18),
const Text(
'课表已导入,请设置学期开始日',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600),
),
const SizedBox(height: 10),
Text(
'${c.visibleCourses.length} 条课程安排已保存',
style: const TextStyle(fontSize: 13, color: river),
),
const SizedBox(height: 10),
const Text(
'课程按教学周保存。设置真实的学期开始日后,\n才能显示每周课表并安排课前提醒。',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 12, height: 1.8),
),
const SizedBox(height: 20),
FilledButton.icon(
onPressed: () => Navigator.push(
context,
MaterialPageRoute<void>(
builder: (_) =>
SettingsPage(controller: c, focusSemester: true),
),
),
icon: const Icon(Icons.edit_calendar_rounded, size: 18),
label: const Text('设置学期开始日'),
),
],
),
),
),
] else ...[
const SizedBox(height: 38),
const Icon(