forked from firka/student-legacy
made goal planner even better
This commit is contained in:
parent
09e416ab74
commit
3e470981a8
@ -1,3 +1,4 @@
|
|||||||
|
import 'package:filcnaplo/theme/colors/colors.dart';
|
||||||
import 'package:filcnaplo_premium/ui/mobile/goal_planner/goal_planner.dart';
|
import 'package:filcnaplo_premium/ui/mobile/goal_planner/goal_planner.dart';
|
||||||
import 'package:filcnaplo_premium/ui/mobile/goal_planner/goal_planner_screen.i18n.dart';
|
import 'package:filcnaplo_premium/ui/mobile/goal_planner/goal_planner_screen.i18n.dart';
|
||||||
import 'package:filcnaplo_premium/ui/mobile/goal_planner/grade_display.dart';
|
import 'package:filcnaplo_premium/ui/mobile/goal_planner/grade_display.dart';
|
||||||
@ -57,7 +58,7 @@ class RouteOption extends StatelessWidget {
|
|||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 22.0,
|
fontSize: 22.0,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
color: Colors.black.withOpacity(.7),
|
color: AppColors.of(context).text.withOpacity(.7),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4.0),
|
const SizedBox(width: 4.0),
|
||||||
@ -74,7 +75,8 @@ class RouteOption extends StatelessWidget {
|
|||||||
height: 36.0,
|
height: 36.0,
|
||||||
width: 32.0,
|
width: 32.0,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Icon(Icons.add, color: Colors.black.withOpacity(.5))),
|
child: Icon(Icons.add,
|
||||||
|
color: AppColors.of(context).text.withOpacity(.5))),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
|
import 'package:filcnaplo/helpers/average_helper.dart';
|
||||||
import 'package:filcnaplo/helpers/subject.dart';
|
import 'package:filcnaplo/helpers/subject.dart';
|
||||||
import 'package:filcnaplo/models/settings.dart';
|
import 'package:filcnaplo/models/settings.dart';
|
||||||
import 'package:filcnaplo_kreta_api/models/grade.dart';
|
import 'package:filcnaplo_kreta_api/models/grade.dart';
|
||||||
|
import 'package:filcnaplo_kreta_api/models/group_average.dart';
|
||||||
import 'package:filcnaplo_kreta_api/models/subject.dart';
|
import 'package:filcnaplo_kreta_api/models/subject.dart';
|
||||||
import 'package:filcnaplo_kreta_api/providers/grade_provider.dart';
|
import 'package:filcnaplo_kreta_api/providers/grade_provider.dart';
|
||||||
|
import 'package:filcnaplo_mobile_ui/common/average_display.dart';
|
||||||
|
import 'package:filcnaplo_mobile_ui/common/round_border_icon.dart';
|
||||||
import 'package:filcnaplo_mobile_ui/pages/grades/calculator/grade_calculator_provider.dart';
|
import 'package:filcnaplo_mobile_ui/pages/grades/calculator/grade_calculator_provider.dart';
|
||||||
import 'package:filcnaplo_premium/ui/mobile/goal_planner/goal_input.dart';
|
import 'package:filcnaplo_premium/ui/mobile/goal_planner/goal_input.dart';
|
||||||
import 'package:filcnaplo_premium/ui/mobile/goal_planner/goal_planner.dart';
|
import 'package:filcnaplo_premium/ui/mobile/goal_planner/goal_planner.dart';
|
||||||
@ -10,7 +14,6 @@ import 'package:filcnaplo_premium/ui/mobile/goal_planner/goal_planner_screen.i18
|
|||||||
import 'package:filcnaplo_premium/ui/mobile/goal_planner/route_option.dart';
|
import 'package:filcnaplo_premium/ui/mobile/goal_planner/route_option.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:filcnaplo_mobile_ui/common/beta_chip.dart';
|
|
||||||
|
|
||||||
enum PlanResult {
|
enum PlanResult {
|
||||||
available, // There are possible solutions
|
available, // There are possible solutions
|
||||||
@ -117,31 +120,78 @@ class _GoalPlannerTestState extends State<GoalPlannerTest> {
|
|||||||
|
|
||||||
final result = getResult();
|
final result = getResult();
|
||||||
|
|
||||||
|
List<Grade> subjectGrades = getSubjectGrades(widget.subject);
|
||||||
|
|
||||||
|
double avg = AverageHelper.averageEvals(subjectGrades);
|
||||||
|
|
||||||
|
var nullavg = GroupAverage(average: 0.0, subject: widget.subject, uid: "0");
|
||||||
|
double groupAverage = gradeProvider.groupAverages
|
||||||
|
.firstWhere((e) => e.subject == widget.subject, orElse: () => nullavg)
|
||||||
|
.average;
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: ListView(
|
child: ListView(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
left: 22.0, right: 22.0, top: 5.0, bottom: 220.0),
|
left: 22.0, right: 22.0, top: 5.0, bottom: 220.0),
|
||||||
children: [
|
children: [
|
||||||
|
// Row(
|
||||||
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
// children: [
|
||||||
|
// const BackButton(),
|
||||||
|
// Padding(
|
||||||
|
// padding: const EdgeInsets.only(right: 15.0),
|
||||||
|
// child: Row(
|
||||||
|
// children: [
|
||||||
|
// Text(
|
||||||
|
// 'goal_planner_title'.i18n,
|
||||||
|
// style: const TextStyle(
|
||||||
|
// fontWeight: FontWeight.w500, fontSize: 18.0),
|
||||||
|
// ),
|
||||||
|
// const SizedBox(
|
||||||
|
// width: 5,
|
||||||
|
// ),
|
||||||
|
// const BetaChip(),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
const BackButton(),
|
Row(
|
||||||
Padding(
|
children: [
|
||||||
padding: const EdgeInsets.only(right: 15.0),
|
const BackButton(),
|
||||||
child: Row(
|
RoundBorderIcon(
|
||||||
children: [
|
icon: Icon(
|
||||||
Text(
|
SubjectIcon.resolveVariant(
|
||||||
'goal_planner_title'.i18n,
|
context: context,
|
||||||
style: const TextStyle(
|
subject: widget.subject,
|
||||||
fontWeight: FontWeight.w500, fontSize: 18.0),
|
),
|
||||||
|
size: 10,
|
||||||
),
|
),
|
||||||
const SizedBox(
|
),
|
||||||
width: 5,
|
Text(
|
||||||
|
(widget.subject.isRenamed
|
||||||
|
? widget.subject.renamedTo
|
||||||
|
: widget.subject.name) ??
|
||||||
|
'goal_planner_title'.i18n,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 17.0,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
),
|
),
|
||||||
const BetaChip(),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
if (groupAverage != 0)
|
||||||
|
AverageDisplay(average: groupAverage, border: true),
|
||||||
|
const SizedBox(width: 6.0),
|
||||||
|
AverageDisplay(average: avg)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -151,7 +201,7 @@ class _GoalPlannerTestState extends State<GoalPlannerTest> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Column(
|
Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
"set_a_goal".i18n,
|
"set_a_goal".i18n,
|
||||||
@ -171,40 +221,40 @@ class _GoalPlannerTestState extends State<GoalPlannerTest> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Column(
|
// Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
// mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
// children: [
|
||||||
Text(
|
// Text(
|
||||||
"select_subject".i18n,
|
// "select_subject".i18n,
|
||||||
style: const TextStyle(
|
// style: const TextStyle(
|
||||||
fontWeight: FontWeight.bold,
|
// fontWeight: FontWeight.bold,
|
||||||
fontSize: 20.0,
|
// fontSize: 20.0,
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
const SizedBox(height: 4.0),
|
// const SizedBox(height: 4.0),
|
||||||
Column(
|
// Column(
|
||||||
children: [
|
// children: [
|
||||||
Icon(
|
// Icon(
|
||||||
SubjectIcon.resolveVariant(
|
// SubjectIcon.resolveVariant(
|
||||||
context: context,
|
// context: context,
|
||||||
subject: widget.subject,
|
// subject: widget.subject,
|
||||||
),
|
// ),
|
||||||
size: 48.0,
|
// size: 48.0,
|
||||||
),
|
// ),
|
||||||
Text(
|
// Text(
|
||||||
(widget.subject.isRenamed
|
// (widget.subject.isRenamed
|
||||||
? widget.subject.renamedTo
|
// ? widget.subject.renamedTo
|
||||||
: widget.subject.name) ??
|
// : widget.subject.name) ??
|
||||||
'',
|
// '',
|
||||||
style: const TextStyle(
|
// style: const TextStyle(
|
||||||
fontSize: 17.0,
|
// fontSize: 17.0,
|
||||||
fontWeight: FontWeight.w500,
|
// fontWeight: FontWeight.w500,
|
||||||
),
|
// ),
|
||||||
)
|
// )
|
||||||
],
|
// ],
|
||||||
)
|
// )
|
||||||
],
|
// ],
|
||||||
)
|
// )
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 24.0),
|
const SizedBox(height: 24.0),
|
||||||
@ -254,7 +304,7 @@ class _GoalPlannerTestState extends State<GoalPlannerTest> {
|
|||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.only(top: 24.0),
|
padding: const EdgeInsets.only(top: 24.0),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Theme.of(context).colorScheme.background,
|
||||||
borderRadius:
|
borderRadius:
|
||||||
const BorderRadius.vertical(top: Radius.circular(24.0)),
|
const BorderRadius.vertical(top: Radius.circular(24.0)),
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user