idk, git is weird
This commit is contained in:
parent
25a92f3714
commit
1058608034
@ -17,11 +17,16 @@ import 'package:provider/provider.dart';
|
|||||||
import 'lesson_tile.i18n.dart';
|
import 'lesson_tile.i18n.dart';
|
||||||
|
|
||||||
class LessonTile extends StatelessWidget {
|
class LessonTile extends StatelessWidget {
|
||||||
const LessonTile(this.lesson, {super.key, this.onTap, this.swapDesc = false});
|
const LessonTile(this.lesson,
|
||||||
|
{super.key,
|
||||||
|
this.onTap,
|
||||||
|
this.swapDesc = false,
|
||||||
|
this.subjectPageView = false});
|
||||||
|
|
||||||
final Lesson lesson;
|
final Lesson lesson;
|
||||||
final bool swapDesc;
|
final bool swapDesc;
|
||||||
final void Function()? onTap;
|
final void Function()? onTap;
|
||||||
|
final bool subjectPageView;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -147,73 +152,90 @@ class LessonTile extends StatelessWidget {
|
|||||||
contentPadding: const EdgeInsets.symmetric(horizontal: 4.0),
|
contentPadding: const EdgeInsets.symmetric(horizontal: 4.0),
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(12.0)),
|
borderRadius: BorderRadius.circular(12.0)),
|
||||||
title: Text(
|
title: !subjectPageView
|
||||||
!lesson.isEmpty
|
? Text(
|
||||||
? lesson.subject.renamedTo ??
|
!lesson.isEmpty
|
||||||
lesson.subject.name.capital()
|
? lesson.subject.renamedTo ??
|
||||||
: "empty".i18n,
|
lesson.subject.name.capital()
|
||||||
maxLines: 2,
|
: "empty".i18n,
|
||||||
overflow: TextOverflow.ellipsis,
|
maxLines: 2,
|
||||||
style: TextStyle(
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
fontSize: 16.5,
|
|
||||||
color: fill
|
|
||||||
? accent
|
|
||||||
: AppColors.of(context)
|
|
||||||
.text
|
|
||||||
.withOpacity(!lesson.isEmpty ? 1.0 : 0.5),
|
|
||||||
fontStyle: lesson.subject.isRenamed &&
|
|
||||||
settingsProvider.renamedSubjectsItalics
|
|
||||||
? FontStyle.italic
|
|
||||||
: null),
|
|
||||||
),
|
|
||||||
subtitle: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
// Row(
|
|
||||||
// children: [
|
|
||||||
// Container(
|
|
||||||
// padding: const EdgeInsets.symmetric(
|
|
||||||
// horizontal: 6.0, vertical: 3.5),
|
|
||||||
// decoration: BoxDecoration(
|
|
||||||
// color: Theme.of(context)
|
|
||||||
// .colorScheme
|
|
||||||
// .secondary
|
|
||||||
// .withOpacity(.15),
|
|
||||||
// borderRadius: BorderRadius.circular(10.0),
|
|
||||||
// ),
|
|
||||||
// child: Text(
|
|
||||||
// lesson.room,
|
|
||||||
// style: TextStyle(
|
|
||||||
// height: 1.1,
|
|
||||||
// fontSize: 12.5,
|
|
||||||
// fontWeight: FontWeight.w600,
|
|
||||||
// color: Theme.of(context)
|
|
||||||
// .colorScheme
|
|
||||||
// .secondary
|
|
||||||
// .withOpacity(.9),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// )
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// if (cleanDesc != '')
|
|
||||||
// const SizedBox(
|
|
||||||
// height: 10.0,
|
|
||||||
// ),
|
|
||||||
if (cleanDesc != '')
|
|
||||||
Text(
|
|
||||||
cleanDesc,
|
|
||||||
maxLines: 1,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
textAlign: TextAlign.start,
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 14.0,
|
fontWeight: FontWeight.w600,
|
||||||
color: fill ? accent.withOpacity(0.5) : null,
|
fontSize: 16.5,
|
||||||
|
color: fill
|
||||||
|
? accent
|
||||||
|
: AppColors.of(context)
|
||||||
|
.text
|
||||||
|
.withOpacity(!lesson.isEmpty ? 1.0 : 0.5),
|
||||||
|
fontStyle: lesson.subject.isRenamed &&
|
||||||
|
settingsProvider.renamedSubjectsItalics
|
||||||
|
? FontStyle.italic
|
||||||
|
: null),
|
||||||
|
)
|
||||||
|
: Transform.translate(
|
||||||
|
offset: const Offset(0, -2.0),
|
||||||
|
child: Text(
|
||||||
|
"${DateFormat("H:mm").format(lesson.start)}-${DateFormat("H:mm").format(lesson.end)}",
|
||||||
|
textAlign: TextAlign.start,
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontSize: 14.0,
|
||||||
|
color: fill
|
||||||
|
? accent.withOpacity(.9)
|
||||||
|
: AppColors.of(context).text.withOpacity(.9),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
subtitle: !subjectPageView
|
||||||
),
|
? Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
// Row(
|
||||||
|
// children: [
|
||||||
|
// Container(
|
||||||
|
// padding: const EdgeInsets.symmetric(
|
||||||
|
// horizontal: 6.0, vertical: 3.5),
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// color: Theme.of(context)
|
||||||
|
// .colorScheme
|
||||||
|
// .secondary
|
||||||
|
// .withOpacity(.15),
|
||||||
|
// borderRadius: BorderRadius.circular(10.0),
|
||||||
|
// ),
|
||||||
|
// child: Text(
|
||||||
|
// lesson.room,
|
||||||
|
// style: TextStyle(
|
||||||
|
// height: 1.1,
|
||||||
|
// fontSize: 12.5,
|
||||||
|
// fontWeight: FontWeight.w600,
|
||||||
|
// color: Theme.of(context)
|
||||||
|
// .colorScheme
|
||||||
|
// .secondary
|
||||||
|
// .withOpacity(.9),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// )
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// if (cleanDesc != '')
|
||||||
|
// const SizedBox(
|
||||||
|
// height: 10.0,
|
||||||
|
// ),
|
||||||
|
if (cleanDesc != '')
|
||||||
|
Text(
|
||||||
|
cleanDesc,
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
textAlign: TextAlign.start,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14.0,
|
||||||
|
color: fill ? accent.withOpacity(0.5) : null,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
|
||||||
// subtitle: description != ""
|
// subtitle: description != ""
|
||||||
// ? Text(
|
// ? Text(
|
||||||
@ -237,8 +259,8 @@ class LessonTile extends StatelessWidget {
|
|||||||
color: fill ? accent : AppColors.of(context).text,
|
color: fill ? accent : AppColors.of(context).text,
|
||||||
width: 1.0,
|
width: 1.0,
|
||||||
icon: SizedBox(
|
icon: SizedBox(
|
||||||
width: 25,
|
width: subjectPageView ? 22 : 25,
|
||||||
height: 25,
|
height: subjectPageView ? 22 : 25,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(left: 3.0),
|
padding: const EdgeInsets.only(left: 3.0),
|
||||||
@ -246,7 +268,7 @@ class LessonTile extends StatelessWidget {
|
|||||||
lesson.lessonIndex + lessonIndexTrailing,
|
lesson.lessonIndex + lessonIndexTrailing,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 17.5,
|
fontSize: subjectPageView ? 15.5 : 17.5,
|
||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w700,
|
||||||
color: fill ? accent : null,
|
color: fill ? accent : null,
|
||||||
),
|
),
|
||||||
@ -349,28 +371,31 @@ class LessonTile extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
if (!subjectPageView)
|
||||||
width: 10,
|
const SizedBox(
|
||||||
),
|
width: 10,
|
||||||
Stack(
|
),
|
||||||
alignment: Alignment.center,
|
if (!subjectPageView)
|
||||||
children: [
|
Stack(
|
||||||
// xix alignment hack :p
|
alignment: Alignment.center,
|
||||||
const Opacity(opacity: 0, child: Text("EE:EE")),
|
children: [
|
||||||
Text(
|
// xix alignment hack :p
|
||||||
"${DateFormat("H:mm").format(lesson.start)}\n${DateFormat("H:mm").format(lesson.end)}",
|
const Opacity(
|
||||||
textAlign: TextAlign.center,
|
opacity: 0, child: Text("EE:EE")),
|
||||||
style: TextStyle(
|
Text(
|
||||||
fontWeight: FontWeight.w500,
|
"${DateFormat("H:mm").format(lesson.start)}\n${DateFormat("H:mm").format(lesson.end)}",
|
||||||
color: fill
|
textAlign: TextAlign.center,
|
||||||
? accent.withOpacity(.9)
|
style: TextStyle(
|
||||||
: AppColors.of(context)
|
fontWeight: FontWeight.w500,
|
||||||
.text
|
color: fill
|
||||||
.withOpacity(.9),
|
? accent.withOpacity(.9)
|
||||||
|
: AppColors.of(context)
|
||||||
|
.text
|
||||||
|
.withOpacity(.9),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
|
@ -4,7 +4,12 @@ import 'package:animations/animations.dart';
|
|||||||
import 'package:refilc/api/providers/database_provider.dart';
|
import 'package:refilc/api/providers/database_provider.dart';
|
||||||
import 'package:refilc/api/providers/user_provider.dart';
|
import 'package:refilc/api/providers/user_provider.dart';
|
||||||
import 'package:refilc/models/settings.dart';
|
import 'package:refilc/models/settings.dart';
|
||||||
|
import 'package:refilc/ui/widgets/lesson/lesson_tile.dart';
|
||||||
import 'package:refilc/utils/format.dart';
|
import 'package:refilc/utils/format.dart';
|
||||||
|
import 'package:refilc_kreta_api/controllers/timetable_controller.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_kreta_api/client/api.dart';
|
// import 'package:refilc_kreta_api/client/api.dart';
|
||||||
// import 'package:refilc_kreta_api/client/client.dart';
|
// import 'package:refilc_kreta_api/client/client.dart';
|
||||||
import 'package:refilc_kreta_api/providers/grade_provider.dart';
|
import 'package:refilc_kreta_api/providers/grade_provider.dart';
|
||||||
@ -14,10 +19,13 @@ import 'package:refilc_kreta_api/models/grade.dart';
|
|||||||
import 'package:refilc_kreta_api/models/subject.dart';
|
import 'package:refilc_kreta_api/models/subject.dart';
|
||||||
import 'package:refilc_mobile_ui/common/average_display.dart';
|
import 'package:refilc_mobile_ui/common/average_display.dart';
|
||||||
import 'package:refilc_mobile_ui/common/bottom_sheet_menu/rounded_bottom_sheet.dart';
|
import 'package:refilc_mobile_ui/common/bottom_sheet_menu/rounded_bottom_sheet.dart';
|
||||||
|
import 'package:refilc_mobile_ui/common/filter_bar.dart';
|
||||||
import 'package:refilc_mobile_ui/common/panel/panel.dart';
|
import 'package:refilc_mobile_ui/common/panel/panel.dart';
|
||||||
|
import 'package:refilc_mobile_ui/common/splitted_panel/splitted_panel.dart';
|
||||||
import 'package:refilc_mobile_ui/common/trend_display.dart';
|
import 'package:refilc_mobile_ui/common/trend_display.dart';
|
||||||
import 'package:refilc_mobile_ui/common/widgets/cretification/certification_tile.dart';
|
import 'package:refilc_mobile_ui/common/widgets/cretification/certification_tile.dart';
|
||||||
import 'package:refilc/ui/widgets/grade/grade_tile.dart';
|
import 'package:refilc/ui/widgets/grade/grade_tile.dart';
|
||||||
|
import 'package:refilc_mobile_ui/common/widgets/exam/exam_viewable.dart';
|
||||||
import 'package:refilc_mobile_ui/common/widgets/grade/grade_viewable.dart';
|
import 'package:refilc_mobile_ui/common/widgets/grade/grade_viewable.dart';
|
||||||
import 'package:refilc_mobile_ui/common/hero_scrollview.dart';
|
import 'package:refilc_mobile_ui/common/hero_scrollview.dart';
|
||||||
import 'package:refilc_mobile_ui/pages/grades/calculator/grade_calculator.dart';
|
import 'package:refilc_mobile_ui/pages/grades/calculator/grade_calculator.dart';
|
||||||
@ -53,12 +61,14 @@ class GradeSubjectView extends StatefulWidget {
|
|||||||
State<GradeSubjectView> createState() => _GradeSubjectViewState();
|
State<GradeSubjectView> createState() => _GradeSubjectViewState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _GradeSubjectViewState extends State<GradeSubjectView> {
|
class _GradeSubjectViewState extends State<GradeSubjectView>
|
||||||
|
with TickerProviderStateMixin {
|
||||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||||
|
|
||||||
// Controllers
|
// Controllers
|
||||||
PersistentBottomSheetController? _sheetController;
|
PersistentBottomSheetController? _sheetController;
|
||||||
final ScrollController _scrollController = ScrollController();
|
final ScrollController _scrollController = ScrollController();
|
||||||
|
late TabController _tabController;
|
||||||
|
|
||||||
List<Widget> gradeTiles = [];
|
List<Widget> gradeTiles = [];
|
||||||
|
|
||||||
@ -68,6 +78,9 @@ class _GradeSubjectViewState extends State<GradeSubjectView> {
|
|||||||
late SettingsProvider settingsProvider;
|
late SettingsProvider settingsProvider;
|
||||||
late DatabaseProvider dbProvider;
|
late DatabaseProvider dbProvider;
|
||||||
late UserProvider user;
|
late UserProvider user;
|
||||||
|
late ExamProvider examProvider;
|
||||||
|
|
||||||
|
late TimetableController _timetableController;
|
||||||
|
|
||||||
late double average;
|
late double average;
|
||||||
late Widget gradeGraph;
|
late Widget gradeGraph;
|
||||||
@ -79,6 +92,8 @@ class _GradeSubjectViewState extends State<GradeSubjectView> {
|
|||||||
List<Grade> getSubjectGrades(GradeSubject subject) => !gradeCalcMode
|
List<Grade> getSubjectGrades(GradeSubject subject) => !gradeCalcMode
|
||||||
? gradeProvider.grades.where((e) => e.subject == subject).toList()
|
? gradeProvider.grades.where((e) => e.subject == subject).toList()
|
||||||
: calculatorProvider.grades.where((e) => e.subject == subject).toList();
|
: calculatorProvider.grades.where((e) => e.subject == subject).toList();
|
||||||
|
List<Exam> getSubjectExams(GradeSubject subject) =>
|
||||||
|
examProvider.exams.where((e) => e.subject == subject).toList();
|
||||||
|
|
||||||
bool showGraph(List<Grade> subjectGrades) {
|
bool showGraph(List<Grade> subjectGrades) {
|
||||||
if (gradeCalcMode) return true;
|
if (gradeCalcMode) return true;
|
||||||
@ -93,7 +108,11 @@ class _GradeSubjectViewState extends State<GradeSubjectView> {
|
|||||||
return subjectGrades.where((e) => e.type == GradeType.midYear).length > 1;
|
return subjectGrades.where((e) => e.type == GradeType.midYear).length > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void buildTiles(List<Grade> subjectGrades) {
|
void buildTiles(
|
||||||
|
List<Grade> subjectGrades, {
|
||||||
|
List<Lesson>? nextWeekLessons,
|
||||||
|
List<Exam>? subjectExams,
|
||||||
|
}) {
|
||||||
List<Widget> tiles = [];
|
List<Widget> tiles = [];
|
||||||
|
|
||||||
tiles.add(Panel(
|
tiles.add(Panel(
|
||||||
@ -128,57 +147,99 @@ class _GradeSubjectViewState extends State<GradeSubjectView> {
|
|||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
||||||
if (showGraph(subjectGrades)) {
|
tiles.addAll(
|
||||||
|
[
|
||||||
|
const SizedBox(
|
||||||
|
height: 5.0,
|
||||||
|
),
|
||||||
|
FilterBar(
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
|
items: [
|
||||||
|
Tab(text: "grades".i18n),
|
||||||
|
Tab(text: "timetable".i18n),
|
||||||
|
Tab(text: "exams".i18n),
|
||||||
|
],
|
||||||
|
controller: _tabController,
|
||||||
|
disableFading: true,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
|
if (showGraph(subjectGrades) && _tabController.index == 0) {
|
||||||
tiles.add(gradeGraph);
|
tiles.add(gradeGraph);
|
||||||
} else {
|
} else {
|
||||||
tiles.add(Container(height: 24.0));
|
tiles.add(Container(height: 20.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
tiles.add(Padding(
|
if (_tabController.index == 0) {
|
||||||
padding: const EdgeInsets.only(bottom: 24.0),
|
tiles.add(Padding(
|
||||||
child: Panel(
|
padding: const EdgeInsets.only(bottom: 24.0),
|
||||||
child: GradesCount(grades: getSubjectGrades(widget.subject).toList()),
|
child: Panel(
|
||||||
),
|
child: GradesCount(grades: getSubjectGrades(widget.subject).toList()),
|
||||||
));
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
// ignore: no_leading_underscores_for_local_identifiers
|
// ignore: no_leading_underscores_for_local_identifiers
|
||||||
List<Widget> _gradeTiles = [];
|
List<Widget> _tiles = [];
|
||||||
|
|
||||||
if (!gradeCalcMode) {
|
if (!gradeCalcMode) {
|
||||||
subjectGrades.sort((a, b) => -a.date.compareTo(b.date));
|
if (_tabController.index == 0) {
|
||||||
|
subjectGrades.sort((a, b) => -a.date.compareTo(b.date));
|
||||||
|
|
||||||
_gradeTiles.add(const SizedBox(
|
_tiles.add(const SizedBox(
|
||||||
height: 4.0,
|
height: 4.0,
|
||||||
));
|
));
|
||||||
|
|
||||||
for (var grade in subjectGrades) {
|
for (var grade in subjectGrades) {
|
||||||
if (grade.type == GradeType.midYear) {
|
if (grade.type == GradeType.midYear) {
|
||||||
_gradeTiles.add(GradeViewable(grade));
|
_tiles.add(GradeViewable(grade));
|
||||||
} else {
|
} else {
|
||||||
_gradeTiles.add(CertificationTile(
|
_tiles.add(CertificationTile(
|
||||||
grade,
|
grade,
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
bottom: 8.0,
|
bottom: 8.0,
|
||||||
top: (subjectGrades.first.id == grade.id) ? 0.0 : 8.0),
|
top: (subjectGrades.first.id == grade.id) ? 0.0 : 8.0),
|
||||||
newStyle: true,
|
newStyle: true,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_tiles.add(const SizedBox(
|
||||||
|
height: 4.0,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
if (_tabController.index == 1) {
|
||||||
|
nextWeekLessons!.sort((a, b) => -a.date.compareTo(b.date));
|
||||||
|
|
||||||
|
for (var lesson in nextWeekLessons) {
|
||||||
|
_tiles.add(LessonTile(
|
||||||
|
lesson,
|
||||||
|
subjectPageView: true,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (_tabController.index == 2) {
|
||||||
|
subjectExams!.sort((a, b) => -a.writeDate.compareTo(b.writeDate));
|
||||||
|
|
||||||
_gradeTiles.add(const SizedBox(
|
for (var exam in subjectExams) {
|
||||||
height: 4.0,
|
_tiles.add(ExamViewable(
|
||||||
));
|
exam,
|
||||||
|
showSubject: false,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (subjectGrades.isNotEmpty) {
|
} else if (subjectGrades.isNotEmpty) {
|
||||||
_gradeTiles.add(const SizedBox(
|
_tiles.add(const SizedBox(
|
||||||
height: 8.0,
|
height: 8.0,
|
||||||
));
|
));
|
||||||
|
|
||||||
subjectGrades.sort((a, b) => -a.date.compareTo(b.date));
|
subjectGrades.sort((a, b) => -a.date.compareTo(b.date));
|
||||||
for (var grade in subjectGrades) {
|
for (var grade in subjectGrades) {
|
||||||
_gradeTiles.add(GradeTile(grade));
|
_tiles.add(GradeTile(grade));
|
||||||
}
|
}
|
||||||
|
|
||||||
_gradeTiles.add(const SizedBox(
|
_tiles.add(const SizedBox(
|
||||||
height: 8.0,
|
height: 8.0,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@ -197,15 +258,29 @@ class _GradeSubjectViewState extends State<GradeSubjectView> {
|
|||||||
child: child,
|
child: child,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: _gradeTiles.isNotEmpty
|
child: _tiles.isNotEmpty
|
||||||
? Panel(
|
? (_tabController.index == 0
|
||||||
key: ValueKey(gradeCalcMode),
|
? Panel(
|
||||||
title: Text(
|
key: ValueKey(gradeCalcMode),
|
||||||
gradeCalcMode ? "Ghost Grades".i18n : "Grades".i18n,
|
title: Text(
|
||||||
),
|
gradeCalcMode ? "Ghost Grades".i18n : "Grades".i18n,
|
||||||
child: Column(
|
),
|
||||||
children: _gradeTiles,
|
child: Column(
|
||||||
))
|
children: _tiles,
|
||||||
|
))
|
||||||
|
: _tabController.index == 1
|
||||||
|
? SplittedPanel(
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
|
cardPadding: const EdgeInsets.only(
|
||||||
|
left: 6.0, right: 12.0, top: 6.0, bottom: 6.0),
|
||||||
|
title: Text("upcoming_lessons".i18n),
|
||||||
|
children: _tiles,
|
||||||
|
)
|
||||||
|
: SplittedPanel(
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
|
title: Text("exams".i18n),
|
||||||
|
children: _tiles,
|
||||||
|
))
|
||||||
: const SizedBox(),
|
: const SizedBox(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -220,6 +295,15 @@ class _GradeSubjectViewState extends State<GradeSubjectView> {
|
|||||||
super.initState();
|
super.initState();
|
||||||
user = Provider.of<UserProvider>(context, listen: false);
|
user = Provider.of<UserProvider>(context, listen: false);
|
||||||
dbProvider = Provider.of<DatabaseProvider>(context, listen: false);
|
dbProvider = Provider.of<DatabaseProvider>(context, listen: false);
|
||||||
|
|
||||||
|
_tabController = TabController(length: 3, vsync: this);
|
||||||
|
|
||||||
|
_timetableController = TimetableController();
|
||||||
|
_timetableController.jump(_timetableController.currentWeek,
|
||||||
|
context: context, initial: true, skip: true);
|
||||||
|
if (DateTime.now().day > 5) {
|
||||||
|
_timetableController.next(context);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void fetchGoalPlans() async {
|
void fetchGoalPlans() async {
|
||||||
@ -234,6 +318,13 @@ class _GradeSubjectViewState extends State<GradeSubjectView> {
|
|||||||
gradeProvider = Provider.of<GradeProvider>(context);
|
gradeProvider = Provider.of<GradeProvider>(context);
|
||||||
calculatorProvider = Provider.of<GradeCalculatorProvider>(context);
|
calculatorProvider = Provider.of<GradeCalculatorProvider>(context);
|
||||||
settingsProvider = Provider.of<SettingsProvider>(context);
|
settingsProvider = Provider.of<SettingsProvider>(context);
|
||||||
|
examProvider = Provider.of<ExamProvider>(context);
|
||||||
|
|
||||||
|
List<Lesson> nextWeekLessons = (_timetableController.days ?? [])
|
||||||
|
.expand((e) => e)
|
||||||
|
.where((e) => e.subject.id == widget.subject.id)
|
||||||
|
.toList();
|
||||||
|
List<Exam> subjectExams = getSubjectExams(widget.subject);
|
||||||
|
|
||||||
List<Grade> subjectGrades = getSubjectGrades(widget.subject).toList();
|
List<Grade> subjectGrades = getSubjectGrades(widget.subject).toList();
|
||||||
average = AverageHelper.averageEvals(subjectGrades);
|
average = AverageHelper.averageEvals(subjectGrades);
|
||||||
@ -266,7 +357,11 @@ class _GradeSubjectViewState extends State<GradeSubjectView> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (!gradeCalcMode) {
|
if (!gradeCalcMode) {
|
||||||
buildTiles(subjectGrades);
|
buildTiles(
|
||||||
|
subjectGrades,
|
||||||
|
nextWeekLessons: nextWeekLessons,
|
||||||
|
subjectExams: subjectExams,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
List<Grade> ghostGrades = calculatorProvider.ghosts
|
List<Grade> ghostGrades = calculatorProvider.ghosts
|
||||||
.where((e) => e.subject == widget.subject)
|
.where((e) => e.subject == widget.subject)
|
||||||
@ -324,94 +419,105 @@ class _GradeSubjectViewState extends State<GradeSubjectView> {
|
|||||||
onRefresh: () async {},
|
onRefresh: () async {},
|
||||||
color: Theme.of(context).colorScheme.secondary,
|
color: Theme.of(context).colorScheme.secondary,
|
||||||
child: HeroScrollView(
|
child: HeroScrollView(
|
||||||
showTitleUnscroll: false,
|
showTitleUnscroll: false,
|
||||||
onClose: () {
|
onClose: () {
|
||||||
if (_sheetController != null && gradeCalcMode) {
|
if (_sheetController != null && gradeCalcMode) {
|
||||||
_sheetController!.close();
|
_sheetController!.close();
|
||||||
} else {
|
} else {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
navBarItems: [
|
navBarItems: [
|
||||||
const SizedBox(width: 6.0),
|
const SizedBox(width: 6.0),
|
||||||
if (widget.groupAverage != 0)
|
if (widget.groupAverage != 0)
|
||||||
Center(
|
Center(
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Theme.of(context).scaffoldBackgroundColor,
|
color: Theme.of(context).scaffoldBackgroundColor,
|
||||||
borderRadius: BorderRadius.circular(50.0),
|
borderRadius: BorderRadius.circular(50.0),
|
||||||
),
|
|
||||||
child: AverageDisplay(
|
|
||||||
average: widget.groupAverage, border: true),
|
|
||||||
),
|
),
|
||||||
|
child: AverageDisplay(
|
||||||
|
average: widget.groupAverage, border: true),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 6.0),
|
),
|
||||||
if (average != 0)
|
const SizedBox(width: 6.0),
|
||||||
Center(
|
if (average != 0)
|
||||||
child: Container(
|
Center(
|
||||||
decoration: BoxDecoration(
|
child: Container(
|
||||||
color: Theme.of(context).scaffoldBackgroundColor,
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(50.0),
|
color: Theme.of(context).scaffoldBackgroundColor,
|
||||||
),
|
borderRadius: BorderRadius.circular(50.0),
|
||||||
child: AverageDisplay(average: average),
|
|
||||||
),
|
),
|
||||||
|
child: AverageDisplay(average: average),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 6.0),
|
),
|
||||||
if (plan != '')
|
const SizedBox(width: 6.0),
|
||||||
Center(
|
if (plan != '')
|
||||||
child: Container(
|
Center(
|
||||||
decoration: BoxDecoration(
|
child: Container(
|
||||||
color: Theme.of(context).scaffoldBackgroundColor,
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(50.0),
|
color: Theme.of(context).scaffoldBackgroundColor,
|
||||||
),
|
borderRadius: BorderRadius.circular(50.0),
|
||||||
child: GestureDetector(
|
),
|
||||||
onTap: () {
|
child: GestureDetector(
|
||||||
Navigator.of(context).push(CupertinoPageRoute(
|
onTap: () {
|
||||||
builder: (context) =>
|
Navigator.of(context).push(CupertinoPageRoute(
|
||||||
GoalStateScreen(subject: widget.subject)));
|
builder: (context) =>
|
||||||
},
|
GoalStateScreen(subject: widget.subject)));
|
||||||
child: Container(
|
},
|
||||||
width: 54.0,
|
child: Container(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
width: 54.0,
|
||||||
decoration: BoxDecoration(
|
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||||
borderRadius: BorderRadius.circular(45.0),
|
decoration: BoxDecoration(
|
||||||
color: Theme.of(context)
|
borderRadius: BorderRadius.circular(45.0),
|
||||||
.colorScheme
|
color: Theme.of(context)
|
||||||
.primary
|
.colorScheme
|
||||||
.withOpacity(.15),
|
.primary
|
||||||
),
|
.withOpacity(.15),
|
||||||
child: Icon(
|
),
|
||||||
FeatherIcons.flag,
|
child: Icon(
|
||||||
size: 17.0,
|
FeatherIcons.flag,
|
||||||
weight: 2.5,
|
size: 17.0,
|
||||||
color: Theme.of(context).colorScheme.primary,
|
weight: 2.5,
|
||||||
),
|
color: Theme.of(context).colorScheme.primary,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 12.0),
|
|
||||||
],
|
|
||||||
icon: SubjectIcon.resolveVariant(
|
|
||||||
subject: widget.subject, context: context),
|
|
||||||
scrollController: _scrollController,
|
|
||||||
title: widget.subject.renamedTo ?? widget.subject.name.capital(),
|
|
||||||
italic: settingsProvider.renamedSubjectsItalics &&
|
|
||||||
widget.subject.isRenamed,
|
|
||||||
child: SubjectGradesContainer(
|
|
||||||
child: CupertinoScrollbar(
|
|
||||||
child: ListView.builder(
|
|
||||||
physics: const BouncingScrollPhysics(),
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 24.0),
|
|
||||||
shrinkWrap: true,
|
|
||||||
itemBuilder: (context, index) => gradeTiles[index],
|
|
||||||
itemCount: gradeTiles.length,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
)),
|
const SizedBox(width: 12.0),
|
||||||
|
],
|
||||||
|
icon: SubjectIcon.resolveVariant(
|
||||||
|
subject: widget.subject, context: context),
|
||||||
|
scrollController: _scrollController,
|
||||||
|
title: widget.subject.renamedTo ?? widget.subject.name.capital(),
|
||||||
|
italic: settingsProvider.renamedSubjectsItalics &&
|
||||||
|
widget.subject.isRenamed,
|
||||||
|
// child: TabBarView(
|
||||||
|
// physics: const BouncingScrollPhysics(),
|
||||||
|
// controller: _tabController,
|
||||||
|
// children: List.generate(
|
||||||
|
// 3, (index) => filterViewBuilder(context, index))),
|
||||||
|
// ),
|
||||||
|
child: SubjectGradesContainer(
|
||||||
|
child: CupertinoScrollbar(
|
||||||
|
child: ListView.builder(
|
||||||
|
physics: const BouncingScrollPhysics(),
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 24.0),
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemBuilder: (context, index) => gradeTiles[index],
|
||||||
|
itemCount: gradeTiles.length,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget filterViewBuilder(context, int activeData) {
|
||||||
|
return Container();
|
||||||
|
}
|
||||||
|
|
||||||
void gradeCalc(BuildContext context) {
|
void gradeCalc(BuildContext context) {
|
||||||
// Scroll to the top of the page
|
// Scroll to the top of the page
|
||||||
_scrollController.animateTo(100,
|
_scrollController.animateTo(100,
|
||||||
|
@ -22,6 +22,11 @@ extension Localization on String {
|
|||||||
"data": "Data",
|
"data": "Data",
|
||||||
"you_have_hw": "You have %s homework(s) to do",
|
"you_have_hw": "You have %s homework(s) to do",
|
||||||
"grades_cnt": "Grade count: %s",
|
"grades_cnt": "Grade count: %s",
|
||||||
|
// v5
|
||||||
|
"upcoming_lessons": "Upcoming Lessons",
|
||||||
|
"exams": "Exams",
|
||||||
|
"timetable": "Timetable",
|
||||||
|
"grades": "Grades",
|
||||||
},
|
},
|
||||||
"hu_hu": {
|
"hu_hu": {
|
||||||
"Grades": "Tantárgyak",
|
"Grades": "Tantárgyak",
|
||||||
@ -41,6 +46,11 @@ extension Localization on String {
|
|||||||
"data": "Adatok",
|
"data": "Adatok",
|
||||||
"you_have_hw": "%s házi feladat vár rád",
|
"you_have_hw": "%s házi feladat vár rád",
|
||||||
"grades_cnt": "Jegyek száma: %s",
|
"grades_cnt": "Jegyek száma: %s",
|
||||||
|
// v5
|
||||||
|
"upcoming_lessons": "Közelgő órák",
|
||||||
|
"exams": "Számonkérések",
|
||||||
|
"timetable": "Órarend",
|
||||||
|
"grades": "Jegyek",
|
||||||
},
|
},
|
||||||
"de_de": {
|
"de_de": {
|
||||||
"Grades": "Fächer",
|
"Grades": "Fächer",
|
||||||
@ -60,6 +70,11 @@ extension Localization on String {
|
|||||||
"data": "Daten",
|
"data": "Daten",
|
||||||
"you_have_hw": "Du hast %s Hausaufgaben",
|
"you_have_hw": "Du hast %s Hausaufgaben",
|
||||||
"grades_cnt": "Anzahl der Noten: %s",
|
"grades_cnt": "Anzahl der Noten: %s",
|
||||||
|
// v5
|
||||||
|
"upcoming_lessons": "Bevorstehende Lektionen",
|
||||||
|
"exams": "Prüfungen",
|
||||||
|
"timetable": "Stundenplan",
|
||||||
|
"grades": "Noten",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -374,6 +374,7 @@ class GeneralSettingsScreenState extends State<GeneralSettingsScreen> {
|
|||||||
isTransparent: true,
|
isTransparent: true,
|
||||||
children: [
|
children: [
|
||||||
CustomSegmentedControl(
|
CustomSegmentedControl(
|
||||||
|
key: const ValueKey('vibration_key'),
|
||||||
onChanged: (v) {
|
onChanged: (v) {
|
||||||
settingsProvider.update(
|
settingsProvider.update(
|
||||||
vibrate: v == 1
|
vibrate: v == 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user