feat: select school terms and smooth refractive Dock motion
This commit is contained in:
@@ -41,6 +41,14 @@ class _ImportPreviewState extends State<ImportPreview> {
|
||||
style: const TextStyle(color: river),
|
||||
),
|
||||
if (draft.semesterLabel != null) Text('学期:${draft.semesterLabel}'),
|
||||
if (draft.schoolTerm != null)
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(top: 8),
|
||||
child: Text(
|
||||
'文件仅包含这个学期;查询其他学期请使用学校连接中的“更新学期”。',
|
||||
style: TextStyle(fontSize: 12, height: 1.6),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 18),
|
||||
if (empty)
|
||||
Text(draft.explicitlyEmpty ? '此操作会清空当前课表。' : '没有识别到课程,当前课表保持不变。'),
|
||||
|
||||
@@ -18,10 +18,12 @@ class ProfilePage extends StatelessWidget {
|
||||
this.authStatus = '未登录',
|
||||
this.onLogout,
|
||||
this.logoutLabel = '退出学校登录',
|
||||
this.onUpdateTerm,
|
||||
});
|
||||
final AppController controller;
|
||||
final VoidCallback onLogin;
|
||||
final VoidCallback? onLogout;
|
||||
final VoidCallback? onUpdateTerm;
|
||||
final String authStatus, logoutLabel;
|
||||
Future<void> _import(BuildContext context) async {
|
||||
try {
|
||||
@@ -190,6 +192,13 @@ class ProfilePage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Divider(height: 1, color: ink.withValues(alpha: 0.06)),
|
||||
_tile(
|
||||
Icons.date_range_rounded,
|
||||
'更新学期',
|
||||
controller.snapshot.schoolTerm?.label ?? '选择学校查询学期',
|
||||
onUpdateTerm ?? onLogin,
|
||||
),
|
||||
Divider(height: 1, color: ink.withValues(alpha: 0.06)),
|
||||
_tile(
|
||||
Icons.file_download_outlined,
|
||||
'从文件导入',
|
||||
|
||||
@@ -8,8 +8,13 @@ import '../../domain/semester.dart';
|
||||
import '../../services/notification_service.dart';
|
||||
|
||||
class SettingsPage extends StatefulWidget {
|
||||
const SettingsPage({super.key, required this.controller});
|
||||
const SettingsPage({
|
||||
super.key,
|
||||
required this.controller,
|
||||
this.focusSemester = false,
|
||||
});
|
||||
final AppController controller;
|
||||
final bool focusSemester;
|
||||
@override
|
||||
State<SettingsPage> createState() => _SettingsPageState();
|
||||
}
|
||||
@@ -20,6 +25,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
double? _courseHeightDraft;
|
||||
bool _savingHeight = false;
|
||||
String? _weeksError, _dateError;
|
||||
final _scroll = ScrollController();
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -27,11 +33,19 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
_weeks = TextEditingController(
|
||||
text: '${widget.controller.snapshot.settings.semester?.totalWeeks ?? 20}',
|
||||
);
|
||||
if (widget.focusSemester) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (mounted && _scroll.hasClients) {
|
||||
_scroll.jumpTo(_scroll.position.maxScrollExtent);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_weeks.dispose();
|
||||
_scroll.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@@ -132,6 +146,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
),
|
||||
),
|
||||
body: ListView(
|
||||
controller: _scroll,
|
||||
padding: const EdgeInsets.fromLTRB(20, 12, 20, 40),
|
||||
children: [
|
||||
if (c.isDemo)
|
||||
|
||||
Reference in New Issue
Block a user