Files
TPSchedule/mobile/lib/features/timetable/course_details.dart
T

67 lines
2.2 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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),
_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)),
),
],
),
);