feat: select school before connecting timetable
This commit is contained in:
@@ -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