Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #4 from HarryDeKat/development
Browse files Browse the repository at this point in the history
Hotfix: "Continue" button missing after login
  • Loading branch information
HarryDeKat authored Jun 20, 2023
2 parents 93ea554 + 6d51cdc commit 6c1a887
Show file tree
Hide file tree
Showing 6 changed files with 122 additions and 36 deletions.
7 changes: 7 additions & 0 deletions lib/hive/extentions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ extension GradeCalculations on List<Grade> {
100;
}

///This value give a rough estimate on how well you will be able to retain a sufficient mark.
///
///It calculates the minimun grade you will need to get in order to retain a sufficient average with the average weight.
double get sufficientSafety {
return getNewGrade(config.sufficientFrom, map((e) => e.weight).average);
}

Map<int, double> getGradeFrequency() {
Map<int, double> gradefrequency = {};
for (var i in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) {
Expand Down
5 changes: 4 additions & 1 deletion lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -181,5 +181,8 @@
"showChangeInSubjectAverage": "Show change in subject average",
"bugReport": "Suggestions and bugs",
"bugReportExpl": "Make a suggestion or report a bug",
"monthlyAverage": "Monthly average"
"monthlyAverage": "Monthly average",
"sufficientSafety1": "With an average weight of ",
"sufficientSafety2": " you have to score a ",
"sufficientSafety3": " in order to get sufficient average"
}
5 changes: 4 additions & 1 deletion lib/l10n/app_nl.arb
Original file line number Diff line number Diff line change
Expand Up @@ -181,5 +181,8 @@
"showChangeInSubjectAverage": "Toon verandering in het vak gemiddelde",
"bugReport": "Suggesties en fouten",
"bugReportExpl": "Maak een suggestie of rapporteer een fout",
"monthlyAverage": "Maandelijks gemiddelde"
"monthlyAverage": "Maandelijks gemiddelde",
"sufficientSafety1": "Bij een gemiddeld gewicht van ",
"sufficientSafety2": " moet je een ",
"sufficientSafety3": " halen om gemiddeld een voldoende te staan"
}
66 changes: 34 additions & 32 deletions lib/screens/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class _SettingsView extends State<SettingsView> {
onChanged: hasMaterialYou
? (bool value) {
config.useMaterialYou = value;
config.save;
config.save();
setState(() {});
Silvio.of(context).update();
}
Expand Down Expand Up @@ -620,43 +620,45 @@ class _PersonConfigCarouselState extends State<PersonConfigCarousel> {
)))),
],
),
(widget.profiles.length > 1)
(widget.profiles.length > 1 ||
widget.widgetsNextToIndicator.isNotEmpty)
? Center(
child: SizedBox(
height: 50,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: widget.profiles.map((entry) {
return InkWell(
onTap: () => controller.animateToPage(
duration: const Duration(milliseconds: 500),
curve: Curves.bounceInOut,
widget.profiles.indexWhere((widget) =>
widget.hashCode == entry.hashCode)),
child: Container(
width: 8,
height: 8,
margin: const EdgeInsets.symmetric(
vertical: 6.0, horizontal: 4.0),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context)
.colorScheme
.primary
.withOpacity(current ==
widget.profiles.indexWhere(
(widget) =>
widget.hashCode ==
entry.hashCode)
? 0.9
: 0.4)),
),
);
}).toList(),
),
if (widget.profiles.length > 1)
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: widget.profiles.map((entry) {
return InkWell(
onTap: () => controller.animateToPage(
duration: const Duration(milliseconds: 500),
curve: Curves.bounceInOut,
widget.profiles.indexWhere((widget) =>
widget.hashCode == entry.hashCode)),
child: Container(
width: 8,
height: 8,
margin: const EdgeInsets.symmetric(
vertical: 6.0, horizontal: 4.0),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context)
.colorScheme
.primary
.withOpacity(current ==
widget.profiles.indexWhere(
(widget) =>
widget.hashCode ==
entry.hashCode)
? 0.9
: 0.4)),
),
);
}).toList(),
),
...widget.widgetsNextToIndicator
],
),
Expand Down
65 changes: 64 additions & 1 deletion lib/screens/subjects.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:carousel_slider/carousel_slider.dart';
Expand Down Expand Up @@ -44,7 +45,69 @@ class _SubjectsListView extends State<SubjectsListView> {
gradeString:
e.grades.average.isNaN ? "-" : e.grades.average.toString(),
),
trailing: const Icon(Icons.navigate_next),
trailing: Wrap(
spacing: 8,
children: [
if (e.grades.sufficientSafety > 1 &&
e.grades.numericalGrades.isNotEmpty)
Tooltip(
triggerMode: TooltipTriggerMode.tap,
showDuration: const Duration(minutes: 60),
decoration: BoxDecoration(
border: Border.fromBorderSide(BorderSide(
color: Theme.of(context).colorScheme.outline,
width: 1)),
color: Theme.of(context).colorScheme.background,
borderRadius:
const BorderRadius.all(Radius.circular(4)),
),
richMessage: TextSpan(
style: TextStyle(
color:
Theme.of(context).colorScheme.onBackground),
children: [
TextSpan(
text: AppLocalizations.of(context)!
.sufficientSafety1),
TextSpan(
text: e.grades
.map((g) => g.weight)
.average
.displayNumber(decimalDigits: 2),
style:
const TextStyle(fontWeight: FontWeight.bold),
),
TextSpan(
text: AppLocalizations.of(context)!
.sufficientSafety2),
TextSpan(
text: e.grades.sufficientSafety
.displayNumber(decimalDigits: 2),
style: const TextStyle(
fontWeight: FontWeight.bold)),
TextSpan(
text: AppLocalizations.of(context)!
.sufficientSafety3)
]),
child: CircleAvatar(
backgroundColor: Colors.transparent,
foregroundColor:
Theme.of(context).colorScheme.onBackground,
child: Icon(
e.grades.sufficientSafety < config.sufficientFrom
? Icons.info_outline
: Icons.warning_amber_outlined,
color: e.grades.sufficientSafety > e.grades.average
? Theme.of(context).colorScheme.error
: null,
),
)),
CircleAvatar(
backgroundColor: Colors.transparent,
foregroundColor: Theme.of(context).colorScheme.onBackground,
child: const Icon(Icons.navigate_next)),
],
),
onTap: () {
if (acP.schoolYear.grades.subjects
.where((sub) => sub.id == e.id)
Expand Down
10 changes: 9 additions & 1 deletion lib/screens/year.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'package:intl/intl.dart';
import 'package:silvio/widgets/announcements.dart';
import 'package:silvio/widgets/cards/list_test.dart';
import 'package:provider/provider.dart';
Expand Down Expand Up @@ -100,7 +101,14 @@ class _SchoolYearStatisticsView extends State<SchoolYearStatisticsView> {
grades: grades,
),
))),
if (grades.numericalGrades.isNotEmpty)
if (grades.numericalGrades.isNotEmpty &&
grades
.map((g) => DateTime.parse(
DateFormat('yyyy-MM-01').format(g.addedDate)))
.toList()
.unique()
.length >
1)
StaggeredGridTile.fit(
crossAxisCellCount: 2,
child: SilvioCard(
Expand Down

0 comments on commit 6c1a887

Please sign in to comment.