Merge branch 'dev' of https://github.com/refilc/naplo into dev
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ProgressBar extends StatelessWidget {
|
||||
const ProgressBar({Key? key, required this.value, this.backgroundColor}) : super(key: key);
|
||||
const ProgressBar(
|
||||
{Key? key, required this.value, this.backgroundColor, this.height = 8.0})
|
||||
: super(key: key);
|
||||
|
||||
final double value;
|
||||
final Color? backgroundColor;
|
||||
final double height;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -13,11 +16,13 @@ class ProgressBar extends StatelessWidget {
|
||||
// Background
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).brightness == Brightness.light ? Colors.black.withOpacity(0.1) : Colors.white.withOpacity(0.1),
|
||||
color: Theme.of(context).brightness == Brightness.light
|
||||
? Colors.black.withOpacity(0.1)
|
||||
: Colors.white.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(45.0),
|
||||
),
|
||||
width: double.infinity,
|
||||
height: 8.0,
|
||||
height: height,
|
||||
),
|
||||
|
||||
// Slider
|
||||
@@ -26,8 +31,9 @@ class ProgressBar extends StatelessWidget {
|
||||
width: double.infinity,
|
||||
child: CustomPaint(
|
||||
painter: ProgressPainter(
|
||||
backgroundColor: backgroundColor ?? Theme.of(context).colorScheme.secondary,
|
||||
height: 8.0,
|
||||
backgroundColor:
|
||||
backgroundColor ?? Theme.of(context).colorScheme.secondary,
|
||||
height: height,
|
||||
value: value.clamp(0, 1),
|
||||
),
|
||||
),
|
||||
@@ -38,7 +44,10 @@ class ProgressBar extends StatelessWidget {
|
||||
}
|
||||
|
||||
class ProgressPainter extends CustomPainter {
|
||||
ProgressPainter({required this.height, required this.value, required this.backgroundColor});
|
||||
ProgressPainter(
|
||||
{required this.height,
|
||||
required this.value,
|
||||
required this.backgroundColor});
|
||||
|
||||
final double height;
|
||||
final double value;
|
||||
@@ -64,6 +73,8 @@ class ProgressPainter extends CustomPainter {
|
||||
|
||||
@override
|
||||
bool shouldRepaint(ProgressPainter oldDelegate) {
|
||||
return value != oldDelegate.value || height != oldDelegate.height || backgroundColor != oldDelegate.backgroundColor;
|
||||
return value != oldDelegate.value ||
|
||||
height != oldDelegate.height ||
|
||||
backgroundColor != oldDelegate.backgroundColor;
|
||||
}
|
||||
}
|
||||
|
||||
30
filcnaplo_mobile_ui/lib/common/round_border_icon.dart
Normal file
30
filcnaplo_mobile_ui/lib/common/round_border_icon.dart
Normal file
@@ -0,0 +1,30 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class RoundBorderIcon extends StatelessWidget {
|
||||
final Color color;
|
||||
final double width;
|
||||
final double padding;
|
||||
final Widget icon;
|
||||
|
||||
const RoundBorderIcon(
|
||||
{Key? key,
|
||||
this.color = Colors.black,
|
||||
this.width = 1.5,
|
||||
this.padding = 5.0,
|
||||
required this.icon})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: color, width: width),
|
||||
borderRadius: BorderRadius.circular(50.0),
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(padding),
|
||||
child: icon,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:animations/animations.dart';
|
||||
import 'package:filcnaplo/api/providers/database_provider.dart';
|
||||
import 'package:filcnaplo/api/providers/user_provider.dart';
|
||||
import 'package:filcnaplo/models/settings.dart';
|
||||
import 'package:filcnaplo/utils/format.dart';
|
||||
import 'package:filcnaplo_kreta_api/providers/grade_provider.dart';
|
||||
@@ -21,9 +23,10 @@ import 'package:filcnaplo_mobile_ui/pages/grades/calculator/grade_calculator_pro
|
||||
import 'package:filcnaplo_mobile_ui/pages/grades/grades_count.dart';
|
||||
import 'package:filcnaplo_mobile_ui/pages/grades/graph.dart';
|
||||
import 'package:filcnaplo_mobile_ui/pages/grades/subject_grades_container.dart';
|
||||
import 'package:filcnaplo_premium/ui/mobile/goal_planner/test.dart';
|
||||
import 'package:filcnaplo_premium/ui/mobile/goal_planner/goal_planner_screen.dart';
|
||||
import 'package:filcnaplo_premium/models/premium_scopes.dart';
|
||||
import 'package:filcnaplo_premium/providers/premium_provider.dart';
|
||||
import 'package:filcnaplo_premium/ui/mobile/goal_planner/goal_state_screen.dart';
|
||||
import 'package:filcnaplo_premium/ui/mobile/premium/upsell.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -62,12 +65,16 @@ class _GradeSubjectViewState extends State<GradeSubjectView> {
|
||||
late GradeProvider gradeProvider;
|
||||
late GradeCalculatorProvider calculatorProvider;
|
||||
late SettingsProvider settingsProvider;
|
||||
late DatabaseProvider dbProvider;
|
||||
late UserProvider user;
|
||||
|
||||
late double average;
|
||||
late Widget gradeGraph;
|
||||
|
||||
bool gradeCalcMode = false;
|
||||
|
||||
String plan = '';
|
||||
|
||||
List<Grade> getSubjectGrades(Subject subject) => !gradeCalcMode
|
||||
? gradeProvider.grades.where((e) => e.subject == subject).toList()
|
||||
: calculatorProvider.grades.where((e) => e.subject == subject).toList();
|
||||
@@ -151,6 +158,20 @@ class _GradeSubjectViewState extends State<GradeSubjectView> {
|
||||
gradeTiles = List.castFrom(tiles);
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
user = Provider.of<UserProvider>(context, listen: false);
|
||||
dbProvider = Provider.of<DatabaseProvider>(context, listen: false);
|
||||
}
|
||||
|
||||
void fetchGoalPlans() async {
|
||||
plan = (await dbProvider.userQuery
|
||||
.subjectGoalPlans(userId: user.id!))[widget.subject.id] ??
|
||||
'';
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
gradeProvider = Provider.of<GradeProvider>(context);
|
||||
@@ -196,6 +217,8 @@ class _GradeSubjectViewState extends State<GradeSubjectView> {
|
||||
buildTiles(ghostGrades);
|
||||
}
|
||||
|
||||
fetchGoalPlans();
|
||||
|
||||
return Scaffold(
|
||||
key: _scaffoldKey,
|
||||
floatingActionButtonLocation: ExpandableFab.location,
|
||||
@@ -213,6 +236,7 @@ class _GradeSubjectViewState extends State<GradeSubjectView> {
|
||||
),
|
||||
children: [
|
||||
FloatingActionButton.small(
|
||||
heroTag: "btn_ghost_grades",
|
||||
child: const Icon(FeatherIcons.plus),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondary,
|
||||
onPressed: () {
|
||||
@@ -220,6 +244,7 @@ class _GradeSubjectViewState extends State<GradeSubjectView> {
|
||||
},
|
||||
),
|
||||
FloatingActionButton.small(
|
||||
heroTag: "btn_goal_planner",
|
||||
child: const Icon(FeatherIcons.flag, size: 20.0),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondary,
|
||||
onPressed: () {
|
||||
@@ -235,7 +260,7 @@ class _GradeSubjectViewState extends State<GradeSubjectView> {
|
||||
|
||||
Navigator.of(context).push(CupertinoPageRoute(
|
||||
builder: (context) =>
|
||||
GoalPlannerTest(subject: widget.subject)));
|
||||
GoalPlannerScreen(subject: widget.subject)));
|
||||
},
|
||||
),
|
||||
],
|
||||
@@ -261,6 +286,34 @@ class _GradeSubjectViewState extends State<GradeSubjectView> {
|
||||
const SizedBox(width: 6.0),
|
||||
if (average != 0)
|
||||
Center(child: AverageDisplay(average: average)),
|
||||
const SizedBox(width: 6.0),
|
||||
if (plan != '')
|
||||
Center(
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(CupertinoPageRoute(
|
||||
builder: (context) =>
|
||||
GoalStateScreen(subject: widget.subject)));
|
||||
},
|
||||
child: Container(
|
||||
width: 54.0,
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(45.0),
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary
|
||||
.withOpacity(.15),
|
||||
),
|
||||
child: Icon(
|
||||
FeatherIcons.flag,
|
||||
size: 17.0,
|
||||
weight: 2.5,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12.0),
|
||||
],
|
||||
icon: SubjectIcon.resolveVariant(
|
||||
|
||||
108
filcnaplo_mobile_ui/pubspec.yaml
Executable file → Normal file
108
filcnaplo_mobile_ui/pubspec.yaml
Executable file → Normal file
@@ -1,54 +1,54 @@
|
||||
name: filcnaplo_mobile_ui
|
||||
publish_to: "none"
|
||||
|
||||
environment:
|
||||
sdk: ">=2.17.0 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
cupertino_icons: ^1.0.2
|
||||
|
||||
# Filcnaplo main dep
|
||||
filcnaplo:
|
||||
path: ../filcnaplo/
|
||||
filcnaplo_kreta_api:
|
||||
path: ../filcnaplo_kreta_api/
|
||||
filcnaplo_premium:
|
||||
path: ../filcnaplo_premium/
|
||||
|
||||
flutter_feather_icons: ^2.0.0+1
|
||||
provider: ^5.0.0
|
||||
fl_chart: ^0.45.1
|
||||
url_launcher: ^6.0.9
|
||||
flutter_material_color_picker: ^1.1.0+2
|
||||
photo_view: ^0.14.0
|
||||
flutter_linkify: ^5.0.2
|
||||
flutter_custom_tabs: ^1.0.3
|
||||
flutter_markdown: ^0.6.5
|
||||
animations: ^2.0.1
|
||||
animated_list_plus: ^0.5.0
|
||||
confetti: ^0.6.0
|
||||
live_activities: ^1.0.0
|
||||
animated_flip_counter: ^0.2.5
|
||||
lottie: ^1.4.3
|
||||
rive: ^0.9.1
|
||||
animated_background: ^2.0.0
|
||||
home_widget: ^0.1.6
|
||||
dropdown_button2: ^1.8.9
|
||||
flutter_svg: ^1.1.6
|
||||
background_fetch: ^1.1.5
|
||||
wtf_sliding_sheet: ^1.0.0
|
||||
package_info_plus: ^4.0.2
|
||||
dotted_border: ^2.0.0+3
|
||||
screenshot: ^2.1.0
|
||||
image_gallery_saver: ^2.0.2
|
||||
rounded_expansion_tile:
|
||||
git:
|
||||
url: https://github.com/kimaah/rounded_expansion_tile.git
|
||||
|
||||
dev_dependencies:
|
||||
flutter_lints: ^1.0.0
|
||||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
name: filcnaplo_mobile_ui
|
||||
publish_to: "none"
|
||||
|
||||
environment:
|
||||
sdk: ">=2.17.0 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
cupertino_icons: ^1.0.2
|
||||
|
||||
# Filcnaplo main dep
|
||||
filcnaplo:
|
||||
path: ../filcnaplo/
|
||||
filcnaplo_kreta_api:
|
||||
path: ../filcnaplo_kreta_api/
|
||||
filcnaplo_premium:
|
||||
path: ../filcnaplo_premium/
|
||||
|
||||
flutter_feather_icons: ^2.0.0+1
|
||||
provider: ^5.0.0
|
||||
fl_chart: ^0.45.1
|
||||
url_launcher: ^6.0.9
|
||||
flutter_material_color_picker: ^1.1.0+2
|
||||
photo_view: ^0.14.0
|
||||
flutter_linkify: ^5.0.2
|
||||
flutter_custom_tabs: ^1.0.3
|
||||
flutter_markdown: ^0.6.5
|
||||
animations: ^2.0.1
|
||||
animated_list_plus: ^0.5.0
|
||||
confetti: ^0.6.0
|
||||
live_activities: ^1.0.0
|
||||
animated_flip_counter: ^0.2.5
|
||||
lottie: ^1.4.3
|
||||
rive: ^0.9.1
|
||||
animated_background: ^2.0.0
|
||||
home_widget: ^0.1.6
|
||||
dropdown_button2: ^1.8.9
|
||||
flutter_svg: ^1.1.6
|
||||
background_fetch: ^1.1.5
|
||||
wtf_sliding_sheet: ^1.0.0
|
||||
package_info_plus: ^4.0.2
|
||||
dotted_border: ^2.0.0+3
|
||||
screenshot: ^2.1.0
|
||||
image_gallery_saver: ^2.0.2
|
||||
rounded_expansion_tile:
|
||||
git:
|
||||
url: https://github.com/kimaah/rounded_expansion_tile.git
|
||||
|
||||
dev_dependencies:
|
||||
flutter_lints: ^1.0.0
|
||||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
Reference in New Issue
Block a user