71 lines
2.5 KiB
Dart
71 lines
2.5 KiB
Dart
import 'package:flutter/material.dart';
|
||
|
||
import '../../domain/course_occurrence.dart';
|
||
import '../../domain/lesson_times.dart';
|
||
import '../../app/app_theme.dart';
|
||
|
||
void showCourseDetails(BuildContext context, CourseOccurrence event) {
|
||
showModalBottomSheet<void>(
|
||
context: context,
|
||
isScrollControlled: true,
|
||
showDragHandle: true,
|
||
backgroundColor: canvas,
|
||
builder: (context) => SafeArea(
|
||
child: SingleChildScrollView(
|
||
padding: const EdgeInsets.fromLTRB(24, 8, 24, 32),
|
||
child: Column(
|
||
crossAxisAlignment: CrossAxisAlignment.start,
|
||
mainAxisSize: MainAxisSize.min,
|
||
children: [
|
||
Text(
|
||
event.course.name,
|
||
style: const TextStyle(fontSize: 25, fontWeight: FontWeight.w700),
|
||
),
|
||
const SizedBox(height: 20),
|
||
_line(Icons.person_outline_rounded, event.course.teacher),
|
||
_line(Icons.location_on_outlined, event.course.room),
|
||
if (event.course.courseCode.isNotEmpty)
|
||
_line(Icons.tag_rounded, '课程代码:${event.course.courseCode}'),
|
||
if (event.course.notes.isNotEmpty)
|
||
_line(Icons.info_outline_rounded, event.course.notes),
|
||
_line(
|
||
Icons.schedule_rounded,
|
||
'${minuteLabel(event.start.hour * 60 + event.start.minute)}–${minuteLabel(event.end.hour * 60 + event.end.minute)} · 第 ${event.course.startPeriod}–${event.course.endPeriod} 节',
|
||
),
|
||
_line(
|
||
Icons.date_range_outlined,
|
||
'第 ${event.week} 周 · ${event.start.month} 月 ${event.start.day} 日',
|
||
),
|
||
_line(
|
||
Icons.repeat_rounded,
|
||
'上课周次:${(event.course.weeks.toList()..sort()).join('、')}',
|
||
),
|
||
const SizedBox(height: 18),
|
||
SizedBox(
|
||
width: double.infinity,
|
||
child: FilledButton(
|
||
onPressed: () => Navigator.pop(context),
|
||
child: const Text('知道了'),
|
||
),
|
||
),
|
||
],
|
||
),
|
||
),
|
||
),
|
||
);
|
||
}
|
||
|
||
Widget _line(IconData icon, String text) => Padding(
|
||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||
child: Row(
|
||
crossAxisAlignment: CrossAxisAlignment.start,
|
||
children: [
|
||
Icon(icon, size: 21, color: river),
|
||
const SizedBox(width: 12),
|
||
Expanded(
|
||
child: Text(text, style: const TextStyle(fontSize: 15, height: 1.5)),
|
||
),
|
||
],
|
||
),
|
||
);
|