feat: select school before connecting timetable
This commit is contained in:
@@ -118,7 +118,7 @@ class ExamsPage extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
const Text(
|
||||
'连接研究生系统,或导入学校考试页面的 HTML。',
|
||||
'选择学校连接教务系统,或导入学校考试页面的 HTML。',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 13, height: 1.8),
|
||||
),
|
||||
|
||||
@@ -18,6 +18,7 @@ class ProfilePage extends StatelessWidget {
|
||||
super.key,
|
||||
required this.controller,
|
||||
required this.onLogin,
|
||||
this.schoolName,
|
||||
this.authStatus = '未登录',
|
||||
this.onLogout,
|
||||
this.logoutLabel = '退出学校登录',
|
||||
@@ -26,6 +27,7 @@ class ProfilePage extends StatelessWidget {
|
||||
});
|
||||
final AppController controller;
|
||||
final VoidCallback onLogin;
|
||||
final String? schoolName;
|
||||
final VoidCallback? onLogout;
|
||||
final VoidCallback? onUpdateTerm;
|
||||
final String authStatus, logoutLabel;
|
||||
@@ -98,12 +100,12 @@ class ProfilePage extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const Text(
|
||||
'连接学校课表',
|
||||
'学校课表',
|
||||
style: TextStyle(fontSize: 20, fontWeight: FontWeight.w700),
|
||||
),
|
||||
const SizedBox(height: 7),
|
||||
Text(
|
||||
'电子科技大学 · 研究生\n$authStatus',
|
||||
'${schoolName ?? '选择学校后连接教务系统'}\n$authStatus',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
height: 1.8,
|
||||
@@ -115,7 +117,7 @@ class ProfilePage extends StatelessWidget {
|
||||
width: double.infinity,
|
||||
child: FilledButton(
|
||||
onPressed: onLogin,
|
||||
child: Text(onLogout == null ? '登录学校账户' : '打开学校课表'),
|
||||
child: const Text('选择学校'),
|
||||
),
|
||||
),
|
||||
if (onLogout != null)
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../app/app_theme.dart';
|
||||
|
||||
/// Only list schools whose login and import workflow is available.
|
||||
enum SupportedSchool {
|
||||
uestcGraduate('电子科技大学(研究生)', '研究生课表与考试安排');
|
||||
|
||||
const SupportedSchool(this.label, this.description);
|
||||
final String label, description;
|
||||
}
|
||||
|
||||
class SchoolSelectionPage extends StatelessWidget {
|
||||
const SchoolSelectionPage({super.key, this.selected});
|
||||
|
||||
final SupportedSchool? selected;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Scaffold(
|
||||
appBar: AppBar(title: const Text('选择学校')),
|
||||
body: SafeArea(
|
||||
top: false,
|
||||
child: ListView(
|
||||
padding: const EdgeInsets.fromLTRB(22, 16, 22, 24),
|
||||
children: [
|
||||
Text(
|
||||
'选择你的学校,登录后导入课表和考试。',
|
||||
style: TextStyle(fontSize: 13, color: ink.withValues(alpha: 0.6)),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
for (final school in SupportedSchool.values) ...[
|
||||
SurfaceCard(
|
||||
padding: EdgeInsets.zero,
|
||||
child: ListTile(
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 12,
|
||||
),
|
||||
leading: const Icon(Icons.school_rounded, color: river),
|
||||
title: Text(
|
||||
school.label,
|
||||
style: const TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
subtitle: Text(school.description),
|
||||
trailing: Icon(
|
||||
school == selected
|
||||
? Icons.check_circle_rounded
|
||||
: Icons.chevron_right_rounded,
|
||||
color: river,
|
||||
),
|
||||
onTap: () => Navigator.pop(context, school),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user