maybe finished teacher rename
This commit is contained in:
@@ -12,7 +12,8 @@ class ExamView extends StatelessWidget {
|
||||
|
||||
final Exam exam;
|
||||
|
||||
static show(Exam exam, {required BuildContext context}) => showBottomCard(context: context, child: ExamView(exam));
|
||||
static show(Exam exam, {required BuildContext context}) =>
|
||||
showBottomCard(context: context, child: ExamView(exam));
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -27,7 +28,8 @@ class ExamView extends StatelessWidget {
|
||||
leading: Padding(
|
||||
padding: const EdgeInsets.only(left: 6.0),
|
||||
child: Icon(
|
||||
SubjectIcon.resolveVariant(subjectName: exam.subjectName, context: context),
|
||||
SubjectIcon.resolveVariant(
|
||||
subjectName: exam.subjectName, context: context),
|
||||
size: 36.0,
|
||||
color: AppColors.of(context).text.withOpacity(.75),
|
||||
),
|
||||
@@ -39,7 +41,10 @@ class ExamView extends StatelessWidget {
|
||||
style: const TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
subtitle: Text(
|
||||
exam.teacher,
|
||||
(exam.teacher.isRenamed
|
||||
? exam.teacher.renamedTo
|
||||
: exam.teacher.name) ??
|
||||
'',
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontWeight: FontWeight.w500),
|
||||
@@ -51,9 +56,14 @@ class ExamView extends StatelessWidget {
|
||||
),
|
||||
|
||||
// Details
|
||||
if (exam.writeDate.year != 0) Detail(title: "date".i18n, description: exam.writeDate.format(context)),
|
||||
if (exam.description != "") Detail(title: "description".i18n, description: exam.description),
|
||||
if (exam.mode != null) Detail(title: "mode".i18n, description: exam.mode!.description),
|
||||
if (exam.writeDate.year != 0)
|
||||
Detail(
|
||||
title: "date".i18n,
|
||||
description: exam.writeDate.format(context)),
|
||||
if (exam.description != "")
|
||||
Detail(title: "description".i18n, description: exam.description),
|
||||
if (exam.mode != null)
|
||||
Detail(title: "mode".i18n, description: exam.mode!.description),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -11,7 +11,8 @@ import 'grade_view.i18n.dart';
|
||||
class GradeView extends StatelessWidget {
|
||||
const GradeView(this.grade, {Key? key}) : super(key: key);
|
||||
|
||||
static show(Grade grade, {required BuildContext context}) => showBottomCard(context: context, child: GradeView(grade));
|
||||
static show(Grade grade, {required BuildContext context}) =>
|
||||
showBottomCard(context: context, child: GradeView(grade));
|
||||
|
||||
final Grade grade;
|
||||
|
||||
@@ -30,10 +31,21 @@ class GradeView extends StatelessWidget {
|
||||
grade.subject.renamedTo ?? grade.subject.name.capital(),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(fontWeight: FontWeight.w600, fontStyle: grade.subject.isRenamed && settingsProvider.renamedSubjectsItalics ? FontStyle.italic : null),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontStyle: grade.subject.isRenamed &&
|
||||
settingsProvider.renamedSubjectsItalics
|
||||
? FontStyle.italic
|
||||
: null),
|
||||
),
|
||||
subtitle: Text(
|
||||
!Provider.of<SettingsProvider>(context, listen: false).presentationMode ? grade.teacher : "Tanár",
|
||||
!Provider.of<SettingsProvider>(context, listen: false)
|
||||
.presentationMode
|
||||
? (grade.teacher.isRenamed
|
||||
? grade.teacher.renamedTo
|
||||
: grade.teacher.name) ??
|
||||
''
|
||||
: "Tanár",
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontWeight: FontWeight.w500),
|
||||
@@ -49,13 +61,20 @@ class GradeView extends StatelessWidget {
|
||||
title: "value".i18n,
|
||||
description: "${grade.value.valueName} " + percentText(),
|
||||
),
|
||||
if (grade.description != "") Detail(title: "description".i18n, description: grade.description),
|
||||
if (grade.mode.description != "") Detail(title: "mode".i18n, description: grade.mode.description),
|
||||
if (grade.writeDate.year != 0) Detail(title: "date".i18n, description: grade.writeDate.format(context)),
|
||||
if (grade.description != "")
|
||||
Detail(title: "description".i18n, description: grade.description),
|
||||
if (grade.mode.description != "")
|
||||
Detail(title: "mode".i18n, description: grade.mode.description),
|
||||
if (grade.writeDate.year != 0)
|
||||
Detail(
|
||||
title: "date".i18n,
|
||||
description: grade.writeDate.format(context)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String percentText() => grade.value.weight != 100 && grade.value.weight > 0 ? "${grade.value.weight}%" : "";
|
||||
String percentText() => grade.value.weight != 100 && grade.value.weight > 0
|
||||
? "${grade.value.weight}%"
|
||||
: "";
|
||||
}
|
||||
|
||||
@@ -51,10 +51,18 @@ class HomeworkView extends StatelessWidget {
|
||||
homework.subject.renamedTo ?? homework.subject.name.capital(),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(fontWeight: FontWeight.w600, fontStyle: homework.subject.isRenamed && settingsProvider.renamedSubjectsItalics ? FontStyle.italic : null),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontStyle: homework.subject.isRenamed &&
|
||||
settingsProvider.renamedSubjectsItalics
|
||||
? FontStyle.italic
|
||||
: null),
|
||||
),
|
||||
subtitle: Text(
|
||||
homework.teacher,
|
||||
(homework.teacher.isRenamed
|
||||
? homework.teacher.renamedTo
|
||||
: homework.teacher.name) ??
|
||||
'',
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontWeight: FontWeight.w500),
|
||||
|
||||
@@ -54,10 +54,23 @@ class LessonView extends StatelessWidget {
|
||||
lesson.subject.renamedTo ?? lesson.subject.name.capital(),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(fontWeight: FontWeight.w600, fontStyle: lesson.subject.isRenamed && settingsProvider.renamedSubjectsItalics ? FontStyle.italic : null),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontStyle: lesson.subject.isRenamed &&
|
||||
settingsProvider.renamedSubjectsItalics
|
||||
? FontStyle.italic
|
||||
: null),
|
||||
),
|
||||
subtitle: Text(
|
||||
lesson.substituteTeacher == "" ? lesson.teacher : lesson.substituteTeacher,
|
||||
((lesson.substituteTeacher == null ||
|
||||
lesson.substituteTeacher!.name == "")
|
||||
? (lesson.teacher.isRenamed
|
||||
? lesson.teacher.renamedTo
|
||||
: lesson.teacher.name)
|
||||
: (lesson.substituteTeacher!.isRenamed
|
||||
? lesson.substituteTeacher!.renamedTo
|
||||
: lesson.substituteTeacher!.name)) ??
|
||||
'',
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontWeight: FontWeight.w500),
|
||||
@@ -69,10 +82,18 @@ class LessonView extends StatelessWidget {
|
||||
),
|
||||
|
||||
// Details
|
||||
if (lesson.room != "") Detail(title: "Room".i18n, description: lesson.room.replaceAll("_", " ")),
|
||||
if (lesson.description != "") Detail(title: "Description".i18n, description: lesson.description),
|
||||
if (lesson.lessonYearIndex != null) Detail(title: "Lesson Number".i18n, description: "${lesson.lessonYearIndex}."),
|
||||
if (lesson.groupName != "") Detail(title: "Group".i18n, description: lesson.groupName),
|
||||
if (lesson.room != "")
|
||||
Detail(
|
||||
title: "Room".i18n,
|
||||
description: lesson.room.replaceAll("_", " ")),
|
||||
if (lesson.description != "")
|
||||
Detail(title: "Description".i18n, description: lesson.description),
|
||||
if (lesson.lessonYearIndex != null)
|
||||
Detail(
|
||||
title: "Lesson Number".i18n,
|
||||
description: "${lesson.lessonYearIndex}."),
|
||||
if (lesson.groupName != "")
|
||||
Detail(title: "Group".i18n, description: lesson.groupName),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -4,7 +4,8 @@ import 'package:filcnaplo_mobile_ui/common/profile_image/profile_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class NoteTile extends StatelessWidget {
|
||||
const NoteTile(this.note, {Key? key, this.onTap, this.padding}) : super(key: key);
|
||||
const NoteTile(this.note, {Key? key, this.onTap, this.padding})
|
||||
: super(key: key);
|
||||
|
||||
final Note note;
|
||||
final void Function()? onTap;
|
||||
@@ -20,11 +21,20 @@ class NoteTile extends StatelessWidget {
|
||||
visualDensity: VisualDensity.compact,
|
||||
contentPadding: const EdgeInsets.only(left: 8.0, right: 12.0),
|
||||
onTap: onTap,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14.0)),
|
||||
shape:
|
||||
RoundedRectangleBorder(borderRadius: BorderRadius.circular(14.0)),
|
||||
leading: ProfileImage(
|
||||
name: note.teacher,
|
||||
name: (note.teacher.isRenamed
|
||||
? note.teacher.renamedTo
|
||||
: note.teacher.name) ??
|
||||
'',
|
||||
radius: 22.0,
|
||||
backgroundColor: ColorUtils.stringToColor(note.teacher),
|
||||
backgroundColor: ColorUtils.stringToColor(
|
||||
(note.teacher.isRenamed
|
||||
? note.teacher.renamedTo
|
||||
: note.teacher.name) ??
|
||||
'',
|
||||
),
|
||||
),
|
||||
title: Text(
|
||||
note.title,
|
||||
|
||||
@@ -12,7 +12,8 @@ class NoteView extends StatelessWidget {
|
||||
|
||||
final Note note;
|
||||
|
||||
static void show(Note note, {required BuildContext context}) => showSlidingBottomSheet(context: context, child: NoteView(note));
|
||||
static void show(Note note, {required BuildContext context}) =>
|
||||
showSlidingBottomSheet(context: context, child: NoteView(note));
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -25,9 +26,17 @@ class NoteView extends StatelessWidget {
|
||||
// Header
|
||||
ListTile(
|
||||
leading: ProfileImage(
|
||||
name: note.teacher,
|
||||
name: (note.teacher.isRenamed
|
||||
? note.teacher.renamedTo
|
||||
: note.teacher.name) ??
|
||||
'',
|
||||
radius: 22.0,
|
||||
backgroundColor: ColorUtils.stringToColor(note.teacher),
|
||||
backgroundColor: ColorUtils.stringToColor(
|
||||
(note.teacher.isRenamed
|
||||
? note.teacher.renamedTo
|
||||
: note.teacher.name) ??
|
||||
'',
|
||||
),
|
||||
),
|
||||
title: Text(
|
||||
note.title,
|
||||
@@ -36,7 +45,10 @@ class NoteView extends StatelessWidget {
|
||||
style: const TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
subtitle: Text(
|
||||
note.teacher,
|
||||
(note.teacher.isRenamed
|
||||
? note.teacher.renamedTo
|
||||
: note.teacher.name) ??
|
||||
'',
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontWeight: FontWeight.w500),
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'dart:math';
|
||||
import 'package:filcnaplo_kreta_api/models/category.dart';
|
||||
import 'package:filcnaplo_kreta_api/models/grade.dart';
|
||||
import 'package:filcnaplo_kreta_api/models/subject.dart';
|
||||
import 'package:filcnaplo_kreta_api/models/teacher.dart';
|
||||
import 'package:filcnaplo_mobile_ui/common/custom_snack_bar.dart';
|
||||
import 'package:filcnaplo_mobile_ui/common/material_action_button.dart';
|
||||
import 'package:filcnaplo/ui/widgets/grade/grade_tile.dart';
|
||||
@@ -42,7 +43,8 @@ class _GradeCalculatorState extends State<GradeCalculator> {
|
||||
padding: const EdgeInsets.only(bottom: 8.0),
|
||||
child: Text(
|
||||
"Grade Calculator".i18n,
|
||||
style: const TextStyle(fontSize: 20.0, fontWeight: FontWeight.w600),
|
||||
style:
|
||||
const TextStyle(fontSize: 20.0, fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -63,7 +65,9 @@ class _GradeCalculatorState extends State<GradeCalculator> {
|
||||
Container(
|
||||
width: 80.0,
|
||||
padding: const EdgeInsets.only(right: 12.0),
|
||||
child: Center(child: GradeValueWidget(GradeValue(newValue.toInt(), "", "", 0))),
|
||||
child: Center(
|
||||
child: GradeValueWidget(
|
||||
GradeValue(newValue.toInt(), "", "", 0))),
|
||||
),
|
||||
]),
|
||||
|
||||
@@ -90,7 +94,8 @@ class _GradeCalculatorState extends State<GradeCalculator> {
|
||||
child: Center(
|
||||
child: TextField(
|
||||
controller: _weightController,
|
||||
style: const TextStyle(fontWeight: FontWeight.w600, fontSize: 22.0),
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w600, fontSize: 22.0),
|
||||
autocorrect: false,
|
||||
textAlign: TextAlign.right,
|
||||
keyboardType: TextInputType.number,
|
||||
@@ -122,7 +127,8 @@ class _GradeCalculatorState extends State<GradeCalculator> {
|
||||
child: Text("Add Grade".i18n),
|
||||
onPressed: () {
|
||||
if (calculatorProvider.ghosts.length >= 50) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(CustomSnackBar(content: Text("limit_reached".i18n), context: context));
|
||||
ScaffoldMessenger.of(context).showSnackBar(CustomSnackBar(
|
||||
content: Text("limit_reached".i18n), context: context));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -133,7 +139,11 @@ class _GradeCalculatorState extends State<GradeCalculator> {
|
||||
grades.sort((a, b) => -a.writeDate.compareTo(b.writeDate));
|
||||
date = grades.first.date.add(const Duration(days: 7));
|
||||
} else {
|
||||
List<Grade> grades = calculatorProvider.grades.where((e) => e.type == GradeType.midYear && e.subject == widget.subject).toList();
|
||||
List<Grade> grades = calculatorProvider.grades
|
||||
.where((e) =>
|
||||
e.type == GradeType.midYear &&
|
||||
e.subject == widget.subject)
|
||||
.toList();
|
||||
grades.sort((a, b) => -a.writeDate.compareTo(b.writeDate));
|
||||
date = grades.first.date;
|
||||
}
|
||||
@@ -143,8 +153,9 @@ class _GradeCalculatorState extends State<GradeCalculator> {
|
||||
date: date,
|
||||
writeDate: date,
|
||||
description: "Ghost Grade".i18n,
|
||||
value: GradeValue(newValue.toInt(), "", "", newWeight.toInt()),
|
||||
teacher: "Ghost",
|
||||
value:
|
||||
GradeValue(newValue.toInt(), "", "", newWeight.toInt()),
|
||||
teacher: Teacher.fromString("Ghost"),
|
||||
type: GradeType.ghost,
|
||||
form: "",
|
||||
subject: widget.subject,
|
||||
|
||||
Reference in New Issue
Block a user