forked from firka/student-legacy
fixed exam related popup things
This commit is contained in:
parent
1a3d78a5bc
commit
e0bf8ac5e5
@ -8,7 +8,8 @@ import 'package:refilc_kreta_api/models/lesson.dart';
|
||||
import 'package:refilc/utils/format.dart';
|
||||
import 'package:refilc_mobile_ui/common/panel/panel.dart';
|
||||
import 'package:refilc_mobile_ui/common/round_border_icon.dart';
|
||||
import 'package:refilc_mobile_ui/common/widgets/exam/exam_view.dart';
|
||||
// import 'package:refilc_mobile_ui/common/widgets/exam/exam_view.dart';
|
||||
import 'package:refilc_mobile_ui/common/widgets/exam/exam_viewable.dart';
|
||||
import 'package:refilc_mobile_ui/common/widgets/homework/homework_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
|
||||
@ -109,7 +110,8 @@ class LessonTile extends StatelessWidget {
|
||||
title: exam.description != ""
|
||||
? exam.description
|
||||
: exam.mode?.description ?? "exam".i18n,
|
||||
onPressed: () => ExamView.show(exam, context: context),
|
||||
// onPressed: () => ExamView.show(exam, context: context),
|
||||
onPressed: () => ExamPopup.show(context: context, exam: exam),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
// ignore_for_file: use_build_context_synchronously
|
||||
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:i18n_extension/i18n_extension.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:refilc/helpers/subject.dart';
|
||||
@ -294,7 +295,7 @@ class ExamPopup extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
Text(
|
||||
'${DateFormat('H:mm').format(lesson!.start)} - ${DateFormat('H:mm').format(lesson!.end)}',
|
||||
'${DateFormat('EEEE, MMM d, H:mm', I18n.locale.countryCode).format(lesson!.start).capital()} - ${DateFormat('H:mm').format(lesson!.end)}',
|
||||
style: TextStyle(
|
||||
color:
|
||||
AppColors.of(context).text.withOpacity(0.85),
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@ -8,7 +9,9 @@ import 'package:refilc/models/settings.dart';
|
||||
import 'package:refilc/theme/colors/colors.dart';
|
||||
import 'package:refilc/theme/colors/utils.dart';
|
||||
import 'package:refilc/utils/format.dart';
|
||||
import 'package:refilc_kreta_api/models/exam.dart';
|
||||
import 'package:refilc_kreta_api/models/lesson.dart';
|
||||
import 'package:refilc_kreta_api/providers/exam_provider.dart';
|
||||
import 'package:refilc_mobile_ui/common/bottom_sheet_menu/rounded_bottom_sheet.dart';
|
||||
import 'package:refilc_mobile_ui/common/round_border_icon.dart';
|
||||
import 'package:refilc/ui/widgets/lesson/lesson_tile.dart';
|
||||
@ -283,6 +286,18 @@ class TimetableLessonPopup extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Exam? lessonExam;
|
||||
|
||||
if (lesson.exam != "") {
|
||||
Exam exam = Provider.of<ExamProvider>(context, listen: false)
|
||||
.exams
|
||||
.firstWhere((t) => t.id == lesson.exam,
|
||||
orElse: () => Exam.fromJson({}));
|
||||
if (exam.id != "") {
|
||||
lessonExam = exam;
|
||||
}
|
||||
}
|
||||
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).scaffoldBackgroundColor,
|
||||
@ -491,9 +506,11 @@ class TimetableLessonPopup extends StatelessWidget {
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
borderRadius: const BorderRadius.vertical(
|
||||
top: Radius.circular(6.0),
|
||||
bottom: Radius.circular(12.0),
|
||||
borderRadius: BorderRadius.vertical(
|
||||
top: const Radius.circular(6.0),
|
||||
bottom: lesson.exam != ''
|
||||
? const Radius.circular(6.0)
|
||||
: const Radius.circular(12.0),
|
||||
),
|
||||
),
|
||||
padding: const EdgeInsets.all(14.0),
|
||||
@ -512,6 +529,56 @@ class TimetableLessonPopup extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
if (lesson.exam != '')
|
||||
const SizedBox(
|
||||
height: 6.0,
|
||||
),
|
||||
if (lesson.exam != '' && lessonExam != null)
|
||||
Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
borderRadius: const BorderRadius.vertical(
|
||||
top: Radius.circular(6.0),
|
||||
bottom: Radius.circular(12.0)),
|
||||
),
|
||||
padding: const EdgeInsets.all(14.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Icon(
|
||||
FeatherIcons.file,
|
||||
size: 20.0,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10.0,
|
||||
),
|
||||
Text(
|
||||
lessonExam.description.capital(),
|
||||
style: TextStyle(
|
||||
color: AppColors.of(context)
|
||||
.text
|
||||
.withOpacity(0.9),
|
||||
fontSize: 16.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
lessonExam.mode?.description ?? 'Dolgozat',
|
||||
style: TextStyle(
|
||||
color:
|
||||
AppColors.of(context).text.withOpacity(0.85),
|
||||
fontSize: 14.0,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// const SizedBox(
|
||||
// height: 24.0,
|
||||
// ),
|
||||
|
Loading…
x
Reference in New Issue
Block a user