From 51a6492477aee62d7e3b6bf841cf7855405233fc Mon Sep 17 00:00:00 2001 From: Kima Date: Sat, 9 Dec 2023 15:42:02 +0100 Subject: [PATCH] CONVERT KEY TO SUPER PARAMETER KYS --- filcnaplo/lib/main.dart | 2 +- filcnaplo/pubspec.yaml | 16 ++-- .../lib/screens/settings/settings_screen.dart | 6 +- filcnaplo_kreta_api/lib/client/api.dart | 21 +---- .../lib/controllers/timetable_controller.dart | 10 +- .../lib/providers/exam_provider.dart | 10 +- filcnaplo_kreta_api/pubspec.yaml | 7 +- .../rounded_bottom_sheet.dart | 2 +- filcnaplo_mobile_ui/lib/common/detail.dart | 2 +- .../lib/common/dialog_button.dart | 2 +- filcnaplo_mobile_ui/lib/common/dot.dart | 2 +- filcnaplo_mobile_ui/lib/common/empty.dart | 4 +- .../lib/common/filter_bar.dart | 5 +- .../lib/common/hero_scrollview.dart | 13 ++- .../lib/common/material_action_button.dart | 18 ++-- .../lib/common/new_content_indicator.dart | 2 +- .../lib/common/panel/panel.dart | 11 +-- .../lib/common/panel/panel_action_button.dart | 4 +- .../lib/common/panel/panel_button.dart | 4 +- .../common/personality_card/empty_card.dart | 4 +- .../personality_card/personality_card.dart | 4 +- .../common/profile_image/profile_button.dart | 2 +- .../common/profile_image/profile_image.dart | 14 +-- .../lib/common/progress_bar.dart | 3 +- .../lib/common/round_border_icon.dart | 5 +- .../lib/common/soon_alert/soon_alert.dart | 2 +- .../lib/common/trend_display.dart | 2 +- filcnaplo_mobile_ui/lib/common/viewable.dart | 24 ++--- .../widgets/absence/absence_display.dart | 2 +- .../widgets/absence/absence_subject_tile.dart | 11 +-- .../common/widgets/absence/absence_tile.dart | 3 +- .../common/widgets/absence/absence_view.dart | 7 +- .../widgets/absence/absence_viewable.dart | 2 +- .../absence_group_container.dart | 2 +- .../absence_group/absence_group_tile.dart | 3 +- .../lib/common/widgets/ad/ad_tile.dart | 2 +- .../lib/common/widgets/ad/ad_viewable.dart | 2 +- .../lib/common/widgets/card_handle.dart | 2 +- .../cretification/certification_card.dart | 2 +- .../cretification/certification_tile.dart | 2 +- .../cretification/certification_view.dart | 8 +- .../lib/common/widgets/custom_switch.dart | 4 +- .../lib/common/widgets/event/event_tile.dart | 2 +- .../lib/common/widgets/event/event_view.dart | 2 +- .../common/widgets/event/event_viewable.dart | 2 +- .../lib/common/widgets/exam/exam_tile.dart | 3 +- .../lib/common/widgets/exam/exam_view.dart | 2 +- .../common/widgets/exam/exam_viewable.dart | 2 +- .../widgets/grade/grade_subject_tile.dart | 5 +- .../lib/common/widgets/grade/grade_view.dart | 4 +- .../common/widgets/grade/grade_viewable.dart | 2 +- .../lib/common/widgets/grade/new_grades.dart | 2 +- .../common/widgets/grade/surprise_grade.dart | 2 +- .../homework/homework_attachment_tile.dart | 4 +- .../widgets/homework/homework_tile.dart | 3 +- .../widgets/homework/homework_view.dart | 2 +- .../widgets/homework/homework_viewable.dart | 2 +- .../widgets/lesson/changed_lesson_tile.dart | 3 +- .../lesson/changed_lesson_viewable.dart | 2 +- .../common/widgets/lesson/lesson_view.dart | 2 +- .../widgets/lesson/lesson_viewable.dart | 2 +- .../widgets/message/attachment_tile.dart | 4 +- .../common/widgets/message/image_view.dart | 2 +- .../common/widgets/message/message_view.dart | 6 +- .../widgets/message/message_view_tile.dart | 4 +- .../widgets/message/message_viewable.dart | 2 +- .../lib/common/widgets/miss_tile.dart | 2 +- .../widgets/missed_exam/missed_exam_tile.dart | 2 +- .../lib/pages/grades/grade_subject_view.dart | 30 +++--- .../lib/pages/grades/graph.dart | 94 ++++++++++++++----- filcnaplo_mobile_ui/pubspec.yaml | 7 +- 71 files changed, 235 insertions(+), 219 deletions(-) diff --git a/filcnaplo/lib/main.dart b/filcnaplo/lib/main.dart index 9ceab63..f7996e1 100644 --- a/filcnaplo/lib/main.dart +++ b/filcnaplo/lib/main.dart @@ -63,7 +63,7 @@ class Startup { await flutterLocalNotificationsPlugin .resolvePlatformSpecificImplementation< AndroidFlutterLocalNotificationsPlugin>()! - .requestPermission(); + .requestNotificationsPermission(); } else if (Platform.isIOS) { await flutterLocalNotificationsPlugin .resolvePlatformSpecificImplementation< diff --git a/filcnaplo/pubspec.yaml b/filcnaplo/pubspec.yaml index 35a2953..37b2025 100644 --- a/filcnaplo/pubspec.yaml +++ b/filcnaplo/pubspec.yaml @@ -25,26 +25,26 @@ dependencies: flutter_localizations: sdk: flutter - i18n_extension: ^9.0.0 + i18n_extension: ^10.0.1 sqflite: ^2.2.0+2 intl: ^0.18.0 provider: ^5.0.0 http: ^0.13.3 - uuid: ^3.0.4 + uuid: ^4.2.1 html: ^0.15.0 open_file: git: url: https://github.com/crazecoder/open_file ref: master path_provider: ^2.0.2 - permission_handler: ^10.2.0 + permission_handler: ^11.0.1 share_plus: ^7.0.2 - connectivity_plus: ^4.0.1 + connectivity_plus: ^5.0.2 flutter_displaymode: ^0.6.0 quick_actions: ^1.0.1 animated_list_plus: ^0.5.0 dynamic_color: ^1.2.2 - material_color_utilities: ^0.2.0 + material_color_utilities: ^0.5.0 crypto: ^3.0.2 elegant_notification: ^1.6.1 flutter_feather_icons: ^2.0.0+1 @@ -55,7 +55,7 @@ dependencies: animated_background: ^2.0.0 dropdown_button2: ^1.8.9 home_widget: ^0.1.6 - flutter_expandable_fab: ^1.8.1 + flutter_expandable_fab: ^2.0.0 uni_links: ^0.5.1 url_launcher: ^6.1.6 workmanager: ^0.5.1 @@ -63,7 +63,7 @@ dependencies: image_picker: ^0.8.6 animations: ^2.0.1 background_fetch: ^1.1.5 - flutter_local_notifications: ^14.1.0 + flutter_local_notifications: ^16.2.0 package_info_plus: ^4.0.2 screenshot: ^2.1.0 flutter_staggered_grid_view: ^0.7.0 @@ -73,7 +73,7 @@ dependencies: url: https://github.com/kimaah/image_crop.git dev_dependencies: - flutter_lints: ^2.0.1 + flutter_lints: ^3.0.1 flutter_launcher_icons: "^0.13.1" flutter_native_splash: "^2.3.0" sqflite_common_ffi: ^2.0.0+3 diff --git a/filcnaplo_desktop_ui/lib/screens/settings/settings_screen.dart b/filcnaplo_desktop_ui/lib/screens/settings/settings_screen.dart index 97914fa..adf9de3 100644 --- a/filcnaplo_desktop_ui/lib/screens/settings/settings_screen.dart +++ b/filcnaplo_desktop_ui/lib/screens/settings/settings_screen.dart @@ -399,9 +399,9 @@ class _SettingsScreenState extends State if (v) { showDialog( context: context, - builder: (context) => - WillPopScope( - onWillPop: () async => false, + builder: (context) => PopScope( + onPopInvoked: (didPop) => + false, child: AlertDialog( shape: RoundedRectangleBorder( diff --git a/filcnaplo_kreta_api/lib/client/api.dart b/filcnaplo_kreta_api/lib/client/api.dart index 708da1d..6dfb28a 100644 --- a/filcnaplo_kreta_api/lib/client/api.dart +++ b/filcnaplo_kreta_api/lib/client/api.dart @@ -21,23 +21,14 @@ class KretaAPI { static String groups(String iss) => BaseKreta.kreta(iss) + KretaApiEndpoints.groups; static String groupAverages(String iss, String uid) => - BaseKreta.kreta(iss) + - KretaApiEndpoints.groupAverages + - "?oktatasiNevelesiFeladatUid=" + - uid; + "${BaseKreta.kreta(iss)}${KretaApiEndpoints.groupAverages}?oktatasiNevelesiFeladatUid=$uid"; static String averages(String iss, String uid) => - BaseKreta.kreta(iss) + - KretaApiEndpoints.averages + - "?oktatasiNevelesiFeladatUid=" + - uid; + "${BaseKreta.kreta(iss)}${KretaApiEndpoints.averages}?oktatasiNevelesiFeladatUid=$uid"; static String timetable(String iss, {DateTime? start, DateTime? end}) => BaseKreta.kreta(iss) + KretaApiEndpoints.timetable + (start != null && end != null - ? "?datumTol=" + - start.toUtc().toIso8601String() + - "&datumIg=" + - end.toUtc().toIso8601String() + ? "?datumTol=${start.toUtc().toIso8601String()}&datumIg=${end.toUtc().toIso8601String()}" : ""); static String exams(String iss) => BaseKreta.kreta(iss) + KretaApiEndpoints.exams; @@ -46,7 +37,7 @@ class KretaAPI { KretaApiEndpoints.homework + (id != null ? "/$id" : "") + (id == null && start != null - ? "?datumTol=" + DateFormat('yyyy-MM-dd').format(start) + ? "?datumTol=${DateFormat('yyyy-MM-dd').format(start)}" : ""); static String capabilities(String iss) => BaseKreta.kreta(iss) + KretaApiEndpoints.capabilities; @@ -55,9 +46,7 @@ class KretaAPI { BaseKreta.kreta(iss) + KretaApiEndpoints.downloadHomeworkAttachments(uid, type); static String subjects(String iss, String uid) => - BaseKreta.kreta(iss) + - KretaApiEndpoints.subjects + - "?oktatasiNevelesiFeladatUid=" + uid; + "${BaseKreta.kreta(iss)}${KretaApiEndpoints.subjects}?oktatasiNevelesiFeladatUid=$uid"; // Structure: // { // "Uid": 000, diff --git a/filcnaplo_kreta_api/lib/controllers/timetable_controller.dart b/filcnaplo_kreta_api/lib/controllers/timetable_controller.dart index f552062..208f080 100644 --- a/filcnaplo_kreta_api/lib/controllers/timetable_controller.dart +++ b/filcnaplo_kreta_api/lib/controllers/timetable_controller.dart @@ -154,9 +154,9 @@ class TimetableController extends ChangeNotifier { } for (int i = 0; i < days.length; i++) { - List _day = List.castFrom(days[i]); + List day0 = List.castFrom(days[i]); - List lessonIndexes = _getIndexes(_day); + List lessonIndexes = _getIndexes(day0); int minIndex = 0, maxIndex = 0; if (lessonIndexes.isNotEmpty) { @@ -170,7 +170,7 @@ class TimetableController extends ChangeNotifier { // Fill missing indexes with empty spaces for (var i in List.generate( maxIndex - minIndex + 1, (int i) => minIndex + i)) { - List indexLessons = _getLessonsByIndex(_day, i); + List indexLessons = _getLessonsByIndex(day0, i); // Empty lesson if (indexLessons.isEmpty) { @@ -193,13 +193,13 @@ class TimetableController extends ChangeNotifier { } // Additional lessons - day.addAll(_day.where((l) => + day.addAll(day0.where((l) => int.tryParse(l.lessonIndex) == null && l.subject.id != '')); day.sort((a, b) => a.start.compareTo(b.start)); // Special Dates - for (var l in _day) { + for (var l in day0) { l.subject.id == '' ? day.insert(0, l) : null; } diff --git a/filcnaplo_kreta_api/lib/providers/exam_provider.dart b/filcnaplo_kreta_api/lib/providers/exam_provider.dart index 8f0c1e5..e74de29 100644 --- a/filcnaplo_kreta_api/lib/providers/exam_provider.dart +++ b/filcnaplo_kreta_api/lib/providers/exam_provider.dart @@ -38,16 +38,16 @@ class ExamProvider with ChangeNotifier { // for renamed subjects Future convertBySettings() async { - final _database = Provider.of(_context, listen: false); + final database = Provider.of(_context, listen: false); Map renamedSubjects = - (await _database.query.getSettings(_database)).renamedSubjectsEnabled - ? await _database.userQuery.renamedSubjects( + (await database.query.getSettings(database)).renamedSubjectsEnabled + ? await database.userQuery.renamedSubjects( userId: Provider.of(_context, listen: false).user!.id) : {}; Map renamedTeachers = - (await _database.query.getSettings(_database)).renamedTeachersEnabled - ? await _database.userQuery.renamedTeachers( + (await database.query.getSettings(database)).renamedTeachersEnabled + ? await database.userQuery.renamedTeachers( userId: Provider.of(_context, listen: false).user!.id) : {}; diff --git a/filcnaplo_kreta_api/pubspec.yaml b/filcnaplo_kreta_api/pubspec.yaml index e9375a9..6b3d5e4 100644 --- a/filcnaplo_kreta_api/pubspec.yaml +++ b/filcnaplo_kreta_api/pubspec.yaml @@ -11,7 +11,10 @@ dependencies: path: ../filcnaplo/ http: ^0.13.3 provider: ^5.0.0 - file_picker: ^5.3.2 + file_picker: ^6.1.1 + intl: ^0.18.1 + i18n_extension: ^10.0.1 + uuid: ^4.2.1 dev_dependencies: - flutter_lints: ^1.0.0 + flutter_lints: ^3.0.1 diff --git a/filcnaplo_mobile_ui/lib/common/bottom_sheet_menu/rounded_bottom_sheet.dart b/filcnaplo_mobile_ui/lib/common/bottom_sheet_menu/rounded_bottom_sheet.dart index e0d5689..a22bbe5 100755 --- a/filcnaplo_mobile_ui/lib/common/bottom_sheet_menu/rounded_bottom_sheet.dart +++ b/filcnaplo_mobile_ui/lib/common/bottom_sheet_menu/rounded_bottom_sheet.dart @@ -2,7 +2,7 @@ import 'package:filcnaplo/theme/colors/colors.dart'; import 'package:flutter/material.dart'; class RoundedBottomSheet extends StatelessWidget { - const RoundedBottomSheet({Key? key, this.child, this.borderRadius = 12.0, this.shrink = true, this.showHandle = true}) : super(key: key); + const RoundedBottomSheet({super.key, this.child, this.borderRadius = 12.0, this.shrink = true, this.showHandle = true}); final Widget? child; final double borderRadius; diff --git a/filcnaplo_mobile_ui/lib/common/detail.dart b/filcnaplo_mobile_ui/lib/common/detail.dart index cb70b7e..1ba73ad 100755 --- a/filcnaplo_mobile_ui/lib/common/detail.dart +++ b/filcnaplo_mobile_ui/lib/common/detail.dart @@ -2,7 +2,7 @@ import 'package:filcnaplo/theme/colors/colors.dart'; import 'package:flutter/material.dart'; class Detail extends StatelessWidget { - const Detail({Key? key, required this.title, required this.description, this.maxLines = 3}) : super(key: key); + const Detail({super.key, required this.title, required this.description, this.maxLines = 3}); final String title; final String description; diff --git a/filcnaplo_mobile_ui/lib/common/dialog_button.dart b/filcnaplo_mobile_ui/lib/common/dialog_button.dart index 17bf422..a16962b 100755 --- a/filcnaplo_mobile_ui/lib/common/dialog_button.dart +++ b/filcnaplo_mobile_ui/lib/common/dialog_button.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; class DialogButton extends StatelessWidget { - const DialogButton({Key? key, required this.label, this.onTap}) : super(key: key); + const DialogButton({super.key, required this.label, this.onTap}); final String label; final Function()? onTap; diff --git a/filcnaplo_mobile_ui/lib/common/dot.dart b/filcnaplo_mobile_ui/lib/common/dot.dart index 2d827a2..05f722f 100755 --- a/filcnaplo_mobile_ui/lib/common/dot.dart +++ b/filcnaplo_mobile_ui/lib/common/dot.dart @@ -4,7 +4,7 @@ class Dot extends StatelessWidget { final Color color; final double size; - const Dot({Key? key, this.color = Colors.grey, this.size = 16.0}) : super(key: key); + const Dot({super.key, this.color = Colors.grey, this.size = 16.0}); @override Widget build(BuildContext context) { diff --git a/filcnaplo_mobile_ui/lib/common/empty.dart b/filcnaplo_mobile_ui/lib/common/empty.dart index ea0a06c..48c4c1f 100755 --- a/filcnaplo_mobile_ui/lib/common/empty.dart +++ b/filcnaplo_mobile_ui/lib/common/empty.dart @@ -17,7 +17,7 @@ List faces = [ ]; class Empty extends StatelessWidget { - const Empty({Key? key, this.subtitle}) : super(key: key); + const Empty({super.key, this.subtitle}); final String? subtitle; @@ -38,7 +38,7 @@ class Empty extends StatelessWidget { children: subtitle != null ? [ TextSpan( - text: "\n" + subtitle!, + text: "\n${subtitle!}", style: TextStyle( fontSize: 18.0, height: 2.0, diff --git a/filcnaplo_mobile_ui/lib/common/filter_bar.dart b/filcnaplo_mobile_ui/lib/common/filter_bar.dart index c95e1a7..ffdee3b 100755 --- a/filcnaplo_mobile_ui/lib/common/filter_bar.dart +++ b/filcnaplo_mobile_ui/lib/common/filter_bar.dart @@ -5,7 +5,7 @@ import 'package:flutter/material.dart'; class FilterBar extends StatefulWidget implements PreferredSizeWidget { const FilterBar({ - Key? key, + super.key, required this.items, required this.controller, this.onTap, @@ -13,8 +13,7 @@ class FilterBar extends StatefulWidget implements PreferredSizeWidget { this.disableFading = false, this.scrollable = true, this.censored = false, - }) : assert(items.length == controller.length), - super(key: key); + }) : assert(items.length == controller.length); final List items; final TabController controller; diff --git a/filcnaplo_mobile_ui/lib/common/hero_scrollview.dart b/filcnaplo_mobile_ui/lib/common/hero_scrollview.dart index 91872a2..af3174d 100755 --- a/filcnaplo_mobile_ui/lib/common/hero_scrollview.dart +++ b/filcnaplo_mobile_ui/lib/common/hero_scrollview.dart @@ -4,7 +4,7 @@ import 'package:filcnaplo/utils/format.dart'; class HeroScrollView extends StatefulWidget { const HeroScrollView( - {Key? key, + {super.key, required this.child, required this.title, required this.icon, @@ -12,8 +12,7 @@ class HeroScrollView extends StatefulWidget { this.navBarItems = const [], this.onClose, this.iconSize = 64.0, - this.scrollController}) - : super(key: key); + this.scrollController}); final Widget child; final String title; @@ -25,10 +24,10 @@ class HeroScrollView extends StatefulWidget { final bool italic; @override - _HeroScrollViewState createState() => _HeroScrollViewState(); + HeroScrollViewState createState() => HeroScrollViewState(); } -class _HeroScrollViewState extends State { +class HeroScrollViewState extends State { late ScrollController _scrollController; bool showBarTitle = false; @@ -69,6 +68,7 @@ class _HeroScrollViewState extends State { surfaceTintColor: Theme.of(context).scaffoldBackgroundColor, title: AnimatedOpacity( opacity: showBarTitle ? 1.0 : 0.0, + duration: const Duration(milliseconds: 200), child: Row( children: [ Icon(widget.icon, @@ -86,8 +86,7 @@ class _HeroScrollViewState extends State { ), ), ], - ), - duration: const Duration(milliseconds: 200)), + )), leading: BackButton( color: AppColors.of(context).text, onPressed: () { diff --git a/filcnaplo_mobile_ui/lib/common/material_action_button.dart b/filcnaplo_mobile_ui/lib/common/material_action_button.dart index eaf1f96..df8ba68 100755 --- a/filcnaplo_mobile_ui/lib/common/material_action_button.dart +++ b/filcnaplo_mobile_ui/lib/common/material_action_button.dart @@ -4,11 +4,11 @@ import 'package:flutter/material.dart'; class MaterialActionButton extends StatelessWidget { const MaterialActionButton({ - Key? key, + super.key, required this.child, this.onPressed, this.backgroundColor, - }) : super(key: key); + }); final Widget child; final Function()? onPressed; @@ -19,17 +19,17 @@ class MaterialActionButton extends StatelessWidget { return RawMaterialButton( padding: const EdgeInsets.symmetric(horizontal: 16.0), shape: const StadiumBorder(), - child: DefaultTextStyle( - child: child, - style: Theme.of(context).textTheme.bodyMedium!.copyWith( - fontWeight: FontWeight.w600, - color: backgroundColor != null ? ColorUtils.foregroundColor(backgroundColor!) : null, - ), - ), fillColor: backgroundColor ?? AppColors.of(context).text.withOpacity(.15), elevation: 0, highlightElevation: 0, onPressed: onPressed, + child: DefaultTextStyle( + style: Theme.of(context).textTheme.bodyMedium!.copyWith( + fontWeight: FontWeight.w600, + color: backgroundColor != null ? ColorUtils.foregroundColor(backgroundColor!) : null, + ), + child: child, + ), ); } } diff --git a/filcnaplo_mobile_ui/lib/common/new_content_indicator.dart b/filcnaplo_mobile_ui/lib/common/new_content_indicator.dart index 3287848..2a01007 100755 --- a/filcnaplo_mobile_ui/lib/common/new_content_indicator.dart +++ b/filcnaplo_mobile_ui/lib/common/new_content_indicator.dart @@ -2,7 +2,7 @@ import 'package:filcnaplo/theme/colors/colors.dart'; import 'package:flutter/material.dart'; class NewContentIndicator extends StatelessWidget { - const NewContentIndicator({Key? key, this.size = 64.0}) : super(key: key); + const NewContentIndicator({super.key, this.size = 64.0}); final double size; diff --git a/filcnaplo_mobile_ui/lib/common/panel/panel.dart b/filcnaplo_mobile_ui/lib/common/panel/panel.dart index 0e2f351..8f612d7 100755 --- a/filcnaplo_mobile_ui/lib/common/panel/panel.dart +++ b/filcnaplo_mobile_ui/lib/common/panel/panel.dart @@ -5,8 +5,7 @@ import 'package:provider/provider.dart'; class Panel extends StatelessWidget { const Panel( - {Key? key, this.child, this.title, this.padding, this.hasShadow = true}) - : super(key: key); + {super.key, this.child, this.title, this.padding, this.hasShadow = true}); final Widget? child; final Widget? title; @@ -48,7 +47,7 @@ class Panel extends StatelessWidget { } class PanelTitle extends StatelessWidget { - const PanelTitle({Key? key, required this.title}) : super(key: key); + const PanelTitle({super.key, required this.title}); final Widget title; @@ -67,7 +66,7 @@ class PanelTitle extends StatelessWidget { } class PanelHeader extends StatelessWidget { - const PanelHeader({Key? key, required this.padding}) : super(key: key); + const PanelHeader({super.key, required this.padding}); final EdgeInsetsGeometry padding; @@ -95,7 +94,7 @@ class PanelHeader extends StatelessWidget { } class PanelBody extends StatelessWidget { - const PanelBody({Key? key, this.child, this.padding}) : super(key: key); + const PanelBody({super.key, this.child, this.padding}); final Widget? child; final EdgeInsetsGeometry? padding; @@ -123,7 +122,7 @@ class PanelBody extends StatelessWidget { } class PanelFooter extends StatelessWidget { - const PanelFooter({Key? key, required this.padding}) : super(key: key); + const PanelFooter({super.key, required this.padding}); final EdgeInsetsGeometry padding; diff --git a/filcnaplo_mobile_ui/lib/common/panel/panel_action_button.dart b/filcnaplo_mobile_ui/lib/common/panel/panel_action_button.dart index 3bf62cf..4fbac67 100755 --- a/filcnaplo_mobile_ui/lib/common/panel/panel_action_button.dart +++ b/filcnaplo_mobile_ui/lib/common/panel/panel_action_button.dart @@ -2,13 +2,13 @@ import 'package:flutter/material.dart'; class PanelActionButton extends StatelessWidget { const PanelActionButton({ - Key? key, + super.key, this.onPressed, this.padding = const EdgeInsets.symmetric(horizontal: 14.0), this.leading, this.title, this.trailing, - }) : super(key: key); + }); final void Function()? onPressed; final EdgeInsetsGeometry padding; diff --git a/filcnaplo_mobile_ui/lib/common/panel/panel_button.dart b/filcnaplo_mobile_ui/lib/common/panel/panel_button.dart index d1f3b64..c94d6fa 100755 --- a/filcnaplo_mobile_ui/lib/common/panel/panel_button.dart +++ b/filcnaplo_mobile_ui/lib/common/panel/panel_button.dart @@ -5,7 +5,7 @@ import 'package:flutter/material.dart'; class PanelButton extends StatelessWidget { const PanelButton({ - Key? key, + super.key, this.onPressed, this.padding = const EdgeInsets.symmetric(horizontal: 14.0), this.leading, @@ -13,7 +13,7 @@ class PanelButton extends StatelessWidget { this.trailing, this.background = false, this.trailingDivider = false, - }) : super(key: key); + }); final void Function()? onPressed; final EdgeInsetsGeometry padding; diff --git a/filcnaplo_mobile_ui/lib/common/personality_card/empty_card.dart b/filcnaplo_mobile_ui/lib/common/personality_card/empty_card.dart index fec8b1a..c6128d7 100644 --- a/filcnaplo_mobile_ui/lib/common/personality_card/empty_card.dart +++ b/filcnaplo_mobile_ui/lib/common/personality_card/empty_card.dart @@ -5,9 +5,9 @@ import 'package:provider/provider.dart'; class EmptyCard extends StatefulWidget { const EmptyCard({ - Key? key, + super.key, required this.text, - }) : super(key: key); + }); final String text; diff --git a/filcnaplo_mobile_ui/lib/common/personality_card/personality_card.dart b/filcnaplo_mobile_ui/lib/common/personality_card/personality_card.dart index b442c38..343ad01 100644 --- a/filcnaplo_mobile_ui/lib/common/personality_card/personality_card.dart +++ b/filcnaplo_mobile_ui/lib/common/personality_card/personality_card.dart @@ -18,9 +18,9 @@ import 'personality_card.i18n.dart'; class PersonalityCard extends StatefulWidget { const PersonalityCard({ - Key? key, + super.key, required this.user, - }) : super(key: key); + }); final UserProvider user; diff --git a/filcnaplo_mobile_ui/lib/common/profile_image/profile_button.dart b/filcnaplo_mobile_ui/lib/common/profile_image/profile_button.dart index 03714ad..52142f0 100755 --- a/filcnaplo_mobile_ui/lib/common/profile_image/profile_button.dart +++ b/filcnaplo_mobile_ui/lib/common/profile_image/profile_button.dart @@ -17,7 +17,7 @@ import 'package:provider/provider.dart'; import 'package:wtf_sliding_sheet/wtf_sliding_sheet.dart'; class ProfileButton extends StatelessWidget { - const ProfileButton({Key? key, required this.child}) : super(key: key); + const ProfileButton({super.key, required this.child}); final ProfileImage child; diff --git a/filcnaplo_mobile_ui/lib/common/profile_image/profile_image.dart b/filcnaplo_mobile_ui/lib/common/profile_image/profile_image.dart index 9c75d95..8be0567 100755 --- a/filcnaplo_mobile_ui/lib/common/profile_image/profile_image.dart +++ b/filcnaplo_mobile_ui/lib/common/profile_image/profile_image.dart @@ -8,7 +8,7 @@ import 'package:filcnaplo/utils/color.dart'; class ProfileImage extends StatefulWidget { const ProfileImage({ - Key? key, + super.key, this.onTap, this.onDoubleTap, this.onLongPress, @@ -20,7 +20,7 @@ class ProfileImage extends StatefulWidget { this.role = Role.student, this.censored = false, this.profilePictureString = "", - }) : super(key: key); + }); final void Function()? onTap; final void Function()? onDoubleTap; @@ -176,7 +176,7 @@ class _ProfileImageState extends State { children: [ if (widget.name != null && (widget.name?.trim().length ?? 0) > 0) Hero( - tag: widget.heroTag! + "background", + tag: "${widget.heroTag!}background", transitionOnUserGestures: true, child: Material( clipBehavior: Clip.hardEdge, @@ -197,27 +197,27 @@ class _ProfileImageState extends State { ), ), Hero( - tag: widget.heroTag! + "child", + tag: "${widget.heroTag!}child", transitionOnUserGestures: true, child: Material( clipBehavior: Clip.hardEdge, shape: profilePicture != null ? const CircleBorder() : null, - child: profilePicture ?? child, type: MaterialType.transparency, + child: profilePicture ?? child, ), ), // Badge if (widget.badge) Hero( - tag: widget.heroTag! + "new_content_indicator", + tag: "${widget.heroTag!}new_content_indicator", child: NewContentIndicator(size: widget.radius * 2), ), // Role indicator if (widget.role == Role.parent) Hero( - tag: widget.heroTag! + "role_indicator", + tag: "${widget.heroTag!}role_indicator", child: FittedBox( fit: BoxFit.fitHeight, child: SizedBox( diff --git a/filcnaplo_mobile_ui/lib/common/progress_bar.dart b/filcnaplo_mobile_ui/lib/common/progress_bar.dart index ffffa00..e4eb936 100755 --- a/filcnaplo_mobile_ui/lib/common/progress_bar.dart +++ b/filcnaplo_mobile_ui/lib/common/progress_bar.dart @@ -2,8 +2,7 @@ import 'package:flutter/material.dart'; class ProgressBar extends StatelessWidget { const ProgressBar( - {Key? key, required this.value, this.backgroundColor, this.height = 8.0}) - : super(key: key); + {super.key, required this.value, this.backgroundColor, this.height = 8.0}); final double value; final Color? backgroundColor; diff --git a/filcnaplo_mobile_ui/lib/common/round_border_icon.dart b/filcnaplo_mobile_ui/lib/common/round_border_icon.dart index ac1fdf4..a5bfef3 100644 --- a/filcnaplo_mobile_ui/lib/common/round_border_icon.dart +++ b/filcnaplo_mobile_ui/lib/common/round_border_icon.dart @@ -7,12 +7,11 @@ class RoundBorderIcon extends StatelessWidget { final Widget icon; const RoundBorderIcon( - {Key? key, + {super.key, this.color = Colors.black, this.width = 1.5, this.padding = 5.0, - required this.icon}) - : super(key: key); + required this.icon}); @override Widget build(BuildContext context) { diff --git a/filcnaplo_mobile_ui/lib/common/soon_alert/soon_alert.dart b/filcnaplo_mobile_ui/lib/common/soon_alert/soon_alert.dart index 4fdba24..213127a 100644 --- a/filcnaplo_mobile_ui/lib/common/soon_alert/soon_alert.dart +++ b/filcnaplo_mobile_ui/lib/common/soon_alert/soon_alert.dart @@ -3,7 +3,7 @@ import 'package:filcnaplo_mobile_ui/common/soon_alert/soon_alert.i18n.dart'; import 'package:flutter/material.dart'; class SoonAlert extends StatelessWidget { - const SoonAlert({Key? key}) : super(key: key); + const SoonAlert({super.key}); static show({required BuildContext context}) => showDialog(context: context, builder: (context) => const SoonAlert()); diff --git a/filcnaplo_mobile_ui/lib/common/trend_display.dart b/filcnaplo_mobile_ui/lib/common/trend_display.dart index 0631056..f5e1cb9 100755 --- a/filcnaplo_mobile_ui/lib/common/trend_display.dart +++ b/filcnaplo_mobile_ui/lib/common/trend_display.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:i18n_extension/i18n_widget.dart'; class TrendDisplay extends StatelessWidget { - const TrendDisplay({Key? key, required this.current, required this.previous, this.padding}) : super(key: key); + const TrendDisplay({super.key, required this.current, required this.previous, this.padding}); final T current; final T previous; diff --git a/filcnaplo_mobile_ui/lib/common/viewable.dart b/filcnaplo_mobile_ui/lib/common/viewable.dart index eb73a47..7190248 100755 --- a/filcnaplo_mobile_ui/lib/common/viewable.dart +++ b/filcnaplo_mobile_ui/lib/common/viewable.dart @@ -59,12 +59,12 @@ enum _ViewableLocation { class Viewable extends StatefulWidget { const Viewable({ - Key? key, + super.key, required this.view, required this.tile, this.actions = const [], this.previewBuilder, - }) : super(key: key); + }); final Widget tile; final Widget view; @@ -255,12 +255,11 @@ class _ViewableState extends State with TickerProviderStateMixin { class _DecoyChild extends StatefulWidget { const _DecoyChild({ - Key? key, this.beginRect, required this.controller, this.endRect, this.child, - }) : super(key: key); + }); final Rect? beginRect; final AnimationController controller; @@ -364,17 +363,13 @@ class _ViewableRoute extends PopupRoute { required _ViewableLocation contextMenuLocation, this.barrierLabel, _ViewablePreviewBuilderChildless? builder, - ui.ImageFilter? filter, + super.filter, required Rect previousChildRect, - RouteSettings? settings, + super.settings, }) : _actions = actions, _builder = builder, _contextMenuLocation = contextMenuLocation, - _previousChildRect = previousChildRect, - super( - filter: filter, - settings: settings, - ); + _previousChildRect = previousChildRect; static const Color _kModalBarrierColor = Color(0x6604040F); @@ -607,7 +602,6 @@ class _ViewableRoute extends PopupRoute { class _ContextMenuRouteStatic extends StatefulWidget { const _ContextMenuRouteStatic({ - Key? key, this.actions, required this.child, this.childGlobalKey, @@ -615,7 +609,7 @@ class _ContextMenuRouteStatic extends StatefulWidget { this.onDismiss, required this.orientation, this.sheetGlobalKey, - }) : super(key: key); + }); final List? actions; final Widget child; @@ -899,9 +893,9 @@ class _ContextMenuRouteStaticState extends State<_ContextMenuRouteStatic> with T class _ViewableSheet extends StatelessWidget { const _ViewableSheet({ - Key? key, + super.key, required this.actions, - }) : super(key: key); + }); final List actions; diff --git a/filcnaplo_mobile_ui/lib/common/widgets/absence/absence_display.dart b/filcnaplo_mobile_ui/lib/common/widgets/absence/absence_display.dart index b0fd86d..86ab0fa 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/absence/absence_display.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/absence/absence_display.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_feather_icons/flutter_feather_icons.dart'; class AbsenceDisplay extends StatelessWidget { - const AbsenceDisplay(this.excused, this.unexcused, this.pending, {Key? key}) : super(key: key); + const AbsenceDisplay(this.excused, this.unexcused, this.pending, {super.key}); final int excused; final int unexcused; diff --git a/filcnaplo_mobile_ui/lib/common/widgets/absence/absence_subject_tile.dart b/filcnaplo_mobile_ui/lib/common/widgets/absence/absence_subject_tile.dart index adf5e5f..9a3e0c3 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/absence/absence_subject_tile.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/absence/absence_subject_tile.dart @@ -9,13 +9,12 @@ import 'package:provider/provider.dart'; class AbsenceSubjectTile extends StatelessWidget { const AbsenceSubjectTile(this.subject, - {Key? key, + {super.key, this.percentage = 0.0, this.excused = 0, this.unexcused = 0, this.pending = 0, - this.onTap}) - : super(key: key); + this.onTap}); final GradeSubject subject; final void Function()? onTap; @@ -62,11 +61,11 @@ class AbsenceSubjectTile extends StatelessWidget { alignment: Alignment.centerRight, children: [ const Opacity( + opacity: 0, child: Text("100%", - style: TextStyle(fontFamily: "monospace")), - opacity: 0), + style: TextStyle(fontFamily: "monospace"))), Text( - percentage.round().toString() + "%", + "${percentage.round()}%", style: TextStyle( // fontFamily: "monospace", color: getColorByPercentage(percentage, context: context), diff --git a/filcnaplo_mobile_ui/lib/common/widgets/absence/absence_tile.dart b/filcnaplo_mobile_ui/lib/common/widgets/absence/absence_tile.dart index b01e8e7..83dabf1 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/absence/absence_tile.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/absence/absence_tile.dart @@ -10,8 +10,7 @@ import 'absence_tile.i18n.dart'; class AbsenceTile extends StatelessWidget { const AbsenceTile(this.absence, - {Key? key, this.onTap, this.elevation = 0.0, this.padding}) - : super(key: key); + {super.key, this.onTap, this.elevation = 0.0, this.padding}); final Absence absence; final void Function()? onTap; diff --git a/filcnaplo_mobile_ui/lib/common/widgets/absence/absence_view.dart b/filcnaplo_mobile_ui/lib/common/widgets/absence/absence_view.dart index 1ffac65..72945f2 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/absence/absence_view.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/absence/absence_view.dart @@ -18,8 +18,7 @@ import 'absence_view.i18n.dart'; class AbsenceView extends StatelessWidget { const AbsenceView(this.absence, - {Key? key, this.outsideContext, this.viewable = false}) - : super(key: key); + {super.key, this.outsideContext, this.viewable = false}); final Absence absence; final BuildContext? outsideContext; @@ -90,9 +89,7 @@ class AbsenceView extends StatelessWidget { if (absence.delay > 0) Detail( title: "delay".i18n, - description: absence.delay.toString() + - " " + - "minutes".i18n.plural(absence.delay), + description: "${absence.delay} ${"minutes".i18n.plural(absence.delay)}", ), if (absence.lessonIndex != null) Detail( diff --git a/filcnaplo_mobile_ui/lib/common/widgets/absence/absence_viewable.dart b/filcnaplo_mobile_ui/lib/common/widgets/absence/absence_viewable.dart index 4eda2b4..a8ec1a0 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/absence/absence_viewable.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/absence/absence_viewable.dart @@ -15,7 +15,7 @@ import 'package:filcnaplo/utils/reverse_search.dart'; import 'absence_view.i18n.dart'; class AbsenceViewable extends StatelessWidget { - const AbsenceViewable(this.absence, {Key? key, this.padding}) : super(key: key); + const AbsenceViewable(this.absence, {super.key, this.padding}); final Absence absence; final EdgeInsetsGeometry? padding; diff --git a/filcnaplo_mobile_ui/lib/common/widgets/absence_group/absence_group_container.dart b/filcnaplo_mobile_ui/lib/common/widgets/absence_group/absence_group_container.dart index 1b225e1..4f91e7b 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/absence_group/absence_group_container.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/absence_group/absence_group_container.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; class AbsenceGroupContainer extends InheritedWidget { - const AbsenceGroupContainer({Key? key, required Widget child}) : super(key: key, child: child); + const AbsenceGroupContainer({super.key, required super.child}); static AbsenceGroupContainer? of(BuildContext context) => context.dependOnInheritedWidgetOfExactType(); diff --git a/filcnaplo_mobile_ui/lib/common/widgets/absence_group/absence_group_tile.dart b/filcnaplo_mobile_ui/lib/common/widgets/absence_group/absence_group_tile.dart index 62e8b45..faec32b 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/absence_group/absence_group_tile.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/absence_group/absence_group_tile.dart @@ -11,8 +11,7 @@ import 'absence_group_tile.i18n.dart'; class AbsenceGroupTile extends StatelessWidget { const AbsenceGroupTile(this.absences, - {Key? key, this.showDate = false, this.padding}) - : super(key: key); + {super.key, this.showDate = false, this.padding}); final List absences; final bool showDate; diff --git a/filcnaplo_mobile_ui/lib/common/widgets/ad/ad_tile.dart b/filcnaplo_mobile_ui/lib/common/widgets/ad/ad_tile.dart index fb9c943..78fa38e 100644 --- a/filcnaplo_mobile_ui/lib/common/widgets/ad/ad_tile.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/ad/ad_tile.dart @@ -5,7 +5,7 @@ import 'package:filcnaplo_mobile_ui/common/panel/panel_button.dart'; import 'package:flutter_feather_icons/flutter_feather_icons.dart'; class AdTile extends StatelessWidget { - const AdTile(this.ad, {Key? key, this.onTap, this.padding}) : super(key: key); + const AdTile(this.ad, {super.key, this.onTap, this.padding}); final Ad ad; final Function()? onTap; diff --git a/filcnaplo_mobile_ui/lib/common/widgets/ad/ad_viewable.dart b/filcnaplo_mobile_ui/lib/common/widgets/ad/ad_viewable.dart index fa7ed4a..bbf0fcc 100644 --- a/filcnaplo_mobile_ui/lib/common/widgets/ad/ad_viewable.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/ad/ad_viewable.dart @@ -5,7 +5,7 @@ import 'package:url_launcher/url_launcher.dart'; import 'ad_tile.dart'; class AdViewable extends StatelessWidget { - const AdViewable(this.ad, {Key? key}) : super(key: key); + const AdViewable(this.ad, {super.key}); final Ad ad; diff --git a/filcnaplo_mobile_ui/lib/common/widgets/card_handle.dart b/filcnaplo_mobile_ui/lib/common/widgets/card_handle.dart index fb4fb5f..592200c 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/card_handle.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/card_handle.dart @@ -2,7 +2,7 @@ import 'package:filcnaplo/theme/colors/colors.dart'; import 'package:flutter/material.dart'; class CardHandle extends StatelessWidget { - const CardHandle({Key? key, this.child}) : super(key: key); + const CardHandle({super.key, this.child}); final Widget? child; diff --git a/filcnaplo_mobile_ui/lib/common/widgets/cretification/certification_card.dart b/filcnaplo_mobile_ui/lib/common/widgets/cretification/certification_card.dart index c9bedd8..016dbfb 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/cretification/certification_card.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/cretification/certification_card.dart @@ -8,7 +8,7 @@ import 'package:flutter_feather_icons/flutter_feather_icons.dart'; import 'certification_card.i18n.dart'; class CertificationCard extends StatelessWidget { - const CertificationCard(this.grades, {Key? key, required this.gradeType, this.padding}) : super(key: key); + const CertificationCard(this.grades, {super.key, required this.gradeType, this.padding}); final List grades; final GradeType gradeType; diff --git a/filcnaplo_mobile_ui/lib/common/widgets/cretification/certification_tile.dart b/filcnaplo_mobile_ui/lib/common/widgets/cretification/certification_tile.dart index 83421f5..484d21c 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/cretification/certification_tile.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/cretification/certification_tile.dart @@ -11,7 +11,7 @@ import 'package:provider/provider.dart'; import 'certification_tile.i18n.dart'; class CertificationTile extends StatelessWidget { - const CertificationTile(this.grade, {Key? key, this.onTap, this.padding}) : super(key: key); + const CertificationTile(this.grade, {super.key, this.onTap, this.padding}); final Function()? onTap; final Grade grade; diff --git a/filcnaplo_mobile_ui/lib/common/widgets/cretification/certification_view.dart b/filcnaplo_mobile_ui/lib/common/widgets/cretification/certification_view.dart index 15cb282..09ef8ff 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/cretification/certification_view.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/cretification/certification_view.dart @@ -8,7 +8,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_feather_icons/flutter_feather_icons.dart'; class CertificationView extends StatelessWidget { - const CertificationView(this.grades, {Key? key, required this.gradeType}) : super(key: key); + const CertificationView(this.grades, {super.key, required this.gradeType}); final List grades; final GradeType gradeType; @@ -26,6 +26,9 @@ class CertificationView extends StatelessWidget { icon: FeatherIcons.award, iconSize: 50, child: ListView( + shrinkWrap: true, + padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 24.0), + physics: const BouncingScrollPhysics(), children: [ SafeArea( child: Panel( @@ -35,9 +38,6 @@ class CertificationView extends StatelessWidget { ), ) ], - shrinkWrap: true, - padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 24.0), - physics: const BouncingScrollPhysics(), ))); } } diff --git a/filcnaplo_mobile_ui/lib/common/widgets/custom_switch.dart b/filcnaplo_mobile_ui/lib/common/widgets/custom_switch.dart index a6640cc..06a8124 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/custom_switch.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/custom_switch.dart @@ -5,10 +5,10 @@ class CustomSwitch extends StatelessWidget { final bool value; const CustomSwitch({ - Key? key, + super.key, required this.onChanged, required this.value, - }) : super(key: key); + }); @override Widget build(BuildContext context) { diff --git a/filcnaplo_mobile_ui/lib/common/widgets/event/event_tile.dart b/filcnaplo_mobile_ui/lib/common/widgets/event/event_tile.dart index 7076f8c..807c17e 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/event/event_tile.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/event/event_tile.dart @@ -4,7 +4,7 @@ import 'package:filcnaplo_mobile_ui/common/profile_image/profile_image.dart'; import 'package:flutter/material.dart'; class EventTile extends StatelessWidget { - const EventTile(this.event, {Key? key, this.onTap, this.padding}) : super(key: key); + const EventTile(this.event, {super.key, this.onTap, this.padding}); final Event event; final void Function()? onTap; diff --git a/filcnaplo_mobile_ui/lib/common/widgets/event/event_view.dart b/filcnaplo_mobile_ui/lib/common/widgets/event/event_view.dart index 0f75abe..015747b 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/event/event_view.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/event/event_view.dart @@ -6,7 +6,7 @@ import 'package:flutter_custom_tabs/flutter_custom_tabs.dart'; import 'package:flutter_linkify/flutter_linkify.dart'; class EventView extends StatelessWidget { - const EventView(this.event, {Key? key}) : super(key: key); + const EventView(this.event, {super.key}); final Event event; diff --git a/filcnaplo_mobile_ui/lib/common/widgets/event/event_viewable.dart b/filcnaplo_mobile_ui/lib/common/widgets/event/event_viewable.dart index f58b192..2b3655e 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/event/event_viewable.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/event/event_viewable.dart @@ -4,7 +4,7 @@ import 'package:filcnaplo_mobile_ui/common/widgets/event/event_view.dart'; import 'package:flutter/material.dart'; class EventViewable extends StatelessWidget { - const EventViewable(this.event, {Key? key}) : super(key: key); + const EventViewable(this.event, {super.key}); final Event event; diff --git a/filcnaplo_mobile_ui/lib/common/widgets/exam/exam_tile.dart b/filcnaplo_mobile_ui/lib/common/widgets/exam/exam_tile.dart index 151ad39..3f9076e 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/exam/exam_tile.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/exam/exam_tile.dart @@ -6,8 +6,7 @@ import 'package:filcnaplo/utils/format.dart'; import 'package:flutter_feather_icons/flutter_feather_icons.dart'; class ExamTile extends StatelessWidget { - const ExamTile(this.exam, {Key? key, this.onTap, this.padding}) - : super(key: key); + const ExamTile(this.exam, {super.key, this.onTap, this.padding}); final Exam exam; final void Function()? onTap; diff --git a/filcnaplo_mobile_ui/lib/common/widgets/exam/exam_view.dart b/filcnaplo_mobile_ui/lib/common/widgets/exam/exam_view.dart index 632fb2f..703b67d 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/exam/exam_view.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/exam/exam_view.dart @@ -8,7 +8,7 @@ import 'package:flutter/material.dart'; import 'exam_view.i18n.dart'; class ExamView extends StatelessWidget { - const ExamView(this.exam, {Key? key}) : super(key: key); + const ExamView(this.exam, {super.key}); final Exam exam; diff --git a/filcnaplo_mobile_ui/lib/common/widgets/exam/exam_viewable.dart b/filcnaplo_mobile_ui/lib/common/widgets/exam/exam_viewable.dart index c931bae..7eab3b6 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/exam/exam_viewable.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/exam/exam_viewable.dart @@ -6,7 +6,7 @@ import 'package:filcnaplo_mobile_ui/common/widgets/exam/exam_view.dart'; import 'package:flutter/material.dart'; class ExamViewable extends StatelessWidget { - const ExamViewable(this.exam, {Key? key}) : super(key: key); + const ExamViewable(this.exam, {super.key}); final Exam exam; diff --git a/filcnaplo_mobile_ui/lib/common/widgets/grade/grade_subject_tile.dart b/filcnaplo_mobile_ui/lib/common/widgets/grade/grade_subject_tile.dart index 00e87d0..0b9dda4 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/grade/grade_subject_tile.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/grade/grade_subject_tile.dart @@ -9,12 +9,11 @@ import 'package:provider/provider.dart'; class GradeSubjectTile extends StatelessWidget { const GradeSubjectTile(this.subject, - {Key? key, + {super.key, this.average = 0.0, this.groupAverage = 0.0, this.onTap, - this.averageBefore = 0.0}) - : super(key: key); + this.averageBefore = 0.0}); final GradeSubject subject; final void Function()? onTap; diff --git a/filcnaplo_mobile_ui/lib/common/widgets/grade/grade_view.dart b/filcnaplo_mobile_ui/lib/common/widgets/grade/grade_view.dart index 4673b3d..1267ef6 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/grade/grade_view.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/grade/grade_view.dart @@ -9,7 +9,7 @@ import 'package:provider/provider.dart'; import 'grade_view.i18n.dart'; class GradeView extends StatelessWidget { - const GradeView(this.grade, {Key? key}) : super(key: key); + const GradeView(this.grade, {super.key}); static show(Grade grade, {required BuildContext context}) => showBottomCard(context: context, child: GradeView(grade)); @@ -59,7 +59,7 @@ class GradeView extends StatelessWidget { // Grade Details Detail( title: "value".i18n, - description: "${grade.value.valueName} " + percentText(), + description: "${grade.value.valueName} ${percentText()}", ), if (grade.description != "") Detail(title: "description".i18n, description: grade.description), diff --git a/filcnaplo_mobile_ui/lib/common/widgets/grade/grade_viewable.dart b/filcnaplo_mobile_ui/lib/common/widgets/grade/grade_viewable.dart index 69547ed..0ce16e5 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/grade/grade_viewable.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/grade/grade_viewable.dart @@ -7,7 +7,7 @@ import 'package:filcnaplo_mobile_ui/pages/grades/subject_grades_container.dart'; import 'package:flutter/material.dart'; class GradeViewable extends StatelessWidget { - const GradeViewable(this.grade, {Key? key, this.padding}) : super(key: key); + const GradeViewable(this.grade, {super.key, this.padding}); final Grade grade; final EdgeInsetsGeometry? padding; diff --git a/filcnaplo_mobile_ui/lib/common/widgets/grade/new_grades.dart b/filcnaplo_mobile_ui/lib/common/widgets/grade/new_grades.dart index d666ddd..84b319e 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/grade/new_grades.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/grade/new_grades.dart @@ -10,7 +10,7 @@ import 'package:rive/rive.dart'; import 'new_grades.i18n.dart'; class NewGradesSurprise extends StatelessWidget { - const NewGradesSurprise(this.grades, {Key? key, this.censored = false}) : super(key: key); + const NewGradesSurprise(this.grades, {super.key, this.censored = false}); final List grades; final bool censored; diff --git a/filcnaplo_mobile_ui/lib/common/widgets/grade/surprise_grade.dart b/filcnaplo_mobile_ui/lib/common/widgets/grade/surprise_grade.dart index ba787d3..5342143 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/grade/surprise_grade.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/grade/surprise_grade.dart @@ -13,7 +13,7 @@ import 'package:rive/rive.dart' as rive; import 'new_grades.i18n.dart'; class SurpriseGrade extends StatefulWidget { - const SurpriseGrade(this.grade, {Key? key}) : super(key: key); + const SurpriseGrade(this.grade, {super.key}); final Grade grade; diff --git a/filcnaplo_mobile_ui/lib/common/widgets/homework/homework_attachment_tile.dart b/filcnaplo_mobile_ui/lib/common/widgets/homework/homework_attachment_tile.dart index c62cc45..98dfd4d 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/homework/homework_attachment_tile.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/homework/homework_attachment_tile.dart @@ -11,7 +11,7 @@ import 'package:flutter/material.dart'; import 'homework_attachment_tile.i18n.dart'; class HomeworkAttachmentTile extends StatelessWidget { - const HomeworkAttachmentTile(this.attachment, {Key? key}) : super(key: key); + const HomeworkAttachmentTile(this.attachment, {super.key}); final HomeworkAttachment attachment; @@ -31,13 +31,13 @@ class HomeworkAttachmentTile extends StatelessWidget { builder: (context) => ImageView(snapshot.data!), )); }, + borderRadius: BorderRadius.circular(12.0), child: Ink.image( image: FileImage(File(snapshot.data ?? "")), height: 200.0, width: double.infinity, fit: BoxFit.cover, ), - borderRadius: BorderRadius.circular(12.0), ), ), ), diff --git a/filcnaplo_mobile_ui/lib/common/widgets/homework/homework_tile.dart b/filcnaplo_mobile_ui/lib/common/widgets/homework/homework_tile.dart index 6b1ad2e..dd8050a 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/homework/homework_tile.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/homework/homework_tile.dart @@ -9,8 +9,7 @@ import 'package:provider/provider.dart'; class HomeworkTile extends StatelessWidget { const HomeworkTile(this.homework, - {Key? key, this.onTap, this.padding, this.censored = false}) - : super(key: key); + {super.key, this.onTap, this.padding, this.censored = false}); final Homework homework; final void Function()? onTap; diff --git a/filcnaplo_mobile_ui/lib/common/widgets/homework/homework_view.dart b/filcnaplo_mobile_ui/lib/common/widgets/homework/homework_view.dart index a473cff..20cc9df 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/homework/homework_view.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/homework/homework_view.dart @@ -12,7 +12,7 @@ import 'package:provider/provider.dart'; import 'homework_view.i18n.dart'; class HomeworkView extends StatelessWidget { - const HomeworkView(this.homework, {Key? key}) : super(key: key); + const HomeworkView(this.homework, {super.key}); final Homework homework; diff --git a/filcnaplo_mobile_ui/lib/common/widgets/homework/homework_viewable.dart b/filcnaplo_mobile_ui/lib/common/widgets/homework/homework_viewable.dart index 29c69fa..b00223b 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/homework/homework_viewable.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/homework/homework_viewable.dart @@ -4,7 +4,7 @@ import 'package:filcnaplo_mobile_ui/common/widgets/homework/homework_view.dart'; import 'package:flutter/material.dart'; class HomeworkViewable extends StatelessWidget { - const HomeworkViewable(this.homework, {Key? key}) : super(key: key); + const HomeworkViewable(this.homework, {super.key}); final Homework homework; diff --git a/filcnaplo_mobile_ui/lib/common/widgets/lesson/changed_lesson_tile.dart b/filcnaplo_mobile_ui/lib/common/widgets/lesson/changed_lesson_tile.dart index 4b2b485..9fa3450 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/lesson/changed_lesson_tile.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/lesson/changed_lesson_tile.dart @@ -6,8 +6,7 @@ import 'package:flutter_feather_icons/flutter_feather_icons.dart'; import 'changed_lesson_tile.i18n.dart'; class ChangedLessonTile extends StatelessWidget { - const ChangedLessonTile(this.lesson, {Key? key, this.onTap, this.padding}) - : super(key: key); + const ChangedLessonTile(this.lesson, {super.key, this.onTap, this.padding}); final Lesson lesson; final void Function()? onTap; diff --git a/filcnaplo_mobile_ui/lib/common/widgets/lesson/changed_lesson_viewable.dart b/filcnaplo_mobile_ui/lib/common/widgets/lesson/changed_lesson_viewable.dart index 65e7457..2b697c1 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/lesson/changed_lesson_viewable.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/lesson/changed_lesson_viewable.dart @@ -4,7 +4,7 @@ import 'package:filcnaplo_mobile_ui/pages/timetable/timetable_page.dart'; import 'package:flutter/material.dart'; class ChangedLessonViewable extends StatelessWidget { - const ChangedLessonViewable(this.lesson, {Key? key}) : super(key: key); + const ChangedLessonViewable(this.lesson, {super.key}); final Lesson lesson; diff --git a/filcnaplo_mobile_ui/lib/common/widgets/lesson/lesson_view.dart b/filcnaplo_mobile_ui/lib/common/widgets/lesson/lesson_view.dart index fe5bf88..32f8bec 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/lesson/lesson_view.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/lesson/lesson_view.dart @@ -9,7 +9,7 @@ import 'package:provider/provider.dart'; import 'lesson_view.i18n.dart'; class LessonView extends StatelessWidget { - const LessonView(this.lesson, {Key? key}) : super(key: key); + const LessonView(this.lesson, {super.key}); final Lesson lesson; diff --git a/filcnaplo_mobile_ui/lib/common/widgets/lesson/lesson_viewable.dart b/filcnaplo_mobile_ui/lib/common/widgets/lesson/lesson_viewable.dart index d721d70..2a26ded 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/lesson/lesson_viewable.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/lesson/lesson_viewable.dart @@ -6,7 +6,7 @@ import 'package:filcnaplo_mobile_ui/common/widgets/lesson/lesson_view.dart'; import 'package:flutter/material.dart'; class LessonViewable extends StatelessWidget { - const LessonViewable(this.lesson, {Key? key, this.swapDesc = false}) : super(key: key); + const LessonViewable(this.lesson, {super.key, this.swapDesc = false}); final Lesson lesson; final bool swapDesc; diff --git a/filcnaplo_mobile_ui/lib/common/widgets/message/attachment_tile.dart b/filcnaplo_mobile_ui/lib/common/widgets/message/attachment_tile.dart index 8ef597d..b8fb9e3 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/message/attachment_tile.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/message/attachment_tile.dart @@ -7,7 +7,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_feather_icons/flutter_feather_icons.dart'; class AttachmentTile extends StatelessWidget { - const AttachmentTile(this.attachment, {Key? key}) : super(key: key); + const AttachmentTile(this.attachment, {super.key}); final Attachment attachment; @@ -32,13 +32,13 @@ class AttachmentTile extends StatelessWidget { }, ); }, + borderRadius: BorderRadius.circular(12.0), child: Ink.image( image: FileImage(File(snapshot.data ?? "")), height: 200.0, width: double.infinity, fit: BoxFit.cover, ), - borderRadius: BorderRadius.circular(12.0), ), ), ), diff --git a/filcnaplo_mobile_ui/lib/common/widgets/message/image_view.dart b/filcnaplo_mobile_ui/lib/common/widgets/message/image_view.dart index 50f34db..2a40ceb 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/message/image_view.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/message/image_view.dart @@ -7,7 +7,7 @@ import 'package:flutter_feather_icons/flutter_feather_icons.dart'; import 'package:photo_view/photo_view.dart'; class ImageView extends StatelessWidget { - const ImageView(this.path, {Key? key}) : super(key: key); + const ImageView(this.path, {super.key}); final String path; diff --git a/filcnaplo_mobile_ui/lib/common/widgets/message/message_view.dart b/filcnaplo_mobile_ui/lib/common/widgets/message/message_view.dart index bd192ff..af1fd5f 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/message/message_view.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/message/message_view.dart @@ -5,7 +5,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class MessageView extends StatefulWidget { - const MessageView(this.messages, {Key? key}) : super(key: key); + const MessageView(this.messages, {super.key}); final List messages; @@ -13,10 +13,10 @@ class MessageView extends StatefulWidget { Navigator.of(context, rootNavigator: true).push(CupertinoPageRoute(builder: (context) => MessageView(messages))); @override - _MessageViewState createState() => _MessageViewState(); + MessageViewState createState() => MessageViewState(); } -class _MessageViewState extends State { +class MessageViewState extends State { @override Widget build(BuildContext context) { return Scaffold( diff --git a/filcnaplo_mobile_ui/lib/common/widgets/message/message_view_tile.dart b/filcnaplo_mobile_ui/lib/common/widgets/message/message_view_tile.dart index 42cfd29..535f772 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/message/message_view_tile.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/message/message_view_tile.dart @@ -13,7 +13,7 @@ import 'package:provider/provider.dart'; import 'message_view_tile.i18n.dart'; class MessageViewTile extends StatelessWidget { - const MessageViewTile(this.message, {Key? key}) : super(key: key); + const MessageViewTile(this.message, {super.key}); final Message message; @@ -76,7 +76,7 @@ class MessageViewTile extends StatelessWidget { maxLines: 2, ), subtitle: Text( - "to".i18n + " " + recipientLabel, + "${"to".i18n} $recipientLabel", style: const TextStyle(fontWeight: FontWeight.w500), overflow: TextOverflow.ellipsis, maxLines: 1, diff --git a/filcnaplo_mobile_ui/lib/common/widgets/message/message_viewable.dart b/filcnaplo_mobile_ui/lib/common/widgets/message/message_viewable.dart index 410288d..b40f806 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/message/message_viewable.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/message/message_viewable.dart @@ -5,7 +5,7 @@ import 'package:filcnaplo_mobile_ui/common/widgets/message/message_view.dart'; import 'package:flutter/material.dart'; class MessageViewable extends StatelessWidget { - const MessageViewable(this.message, {Key? key}) : super(key: key); + const MessageViewable(this.message, {super.key}); final Message message; diff --git a/filcnaplo_mobile_ui/lib/common/widgets/miss_tile.dart b/filcnaplo_mobile_ui/lib/common/widgets/miss_tile.dart index 6c453de..6114004 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/miss_tile.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/miss_tile.dart @@ -5,7 +5,7 @@ import 'package:flutter_feather_icons/flutter_feather_icons.dart'; import 'miss_tile.i18n.dart'; class MissTile extends StatelessWidget { - const MissTile(this.note, {Key? key}) : super(key: key); + const MissTile(this.note, {super.key}); final Note note; diff --git a/filcnaplo_mobile_ui/lib/common/widgets/missed_exam/missed_exam_tile.dart b/filcnaplo_mobile_ui/lib/common/widgets/missed_exam/missed_exam_tile.dart index a6e149f..91ab61c 100755 --- a/filcnaplo_mobile_ui/lib/common/widgets/missed_exam/missed_exam_tile.dart +++ b/filcnaplo_mobile_ui/lib/common/widgets/missed_exam/missed_exam_tile.dart @@ -6,7 +6,7 @@ import 'package:flutter_feather_icons/flutter_feather_icons.dart'; import 'missed_exam_tile.i18n.dart'; class MissedExamTile extends StatelessWidget { - const MissedExamTile(this.missedExams, {Key? key, this.onTap, this.padding}) : super(key: key); + const MissedExamTile(this.missedExams, {super.key, this.onTap, this.padding}); final List missedExams; final Function()? onTap; diff --git a/filcnaplo_mobile_ui/lib/pages/grades/grade_subject_view.dart b/filcnaplo_mobile_ui/lib/pages/grades/grade_subject_view.dart index efc4cf4..f5ddf00 100755 --- a/filcnaplo_mobile_ui/lib/pages/grades/grade_subject_view.dart +++ b/filcnaplo_mobile_ui/lib/pages/grades/grade_subject_view.dart @@ -39,8 +39,7 @@ import 'grades_page.i18n.dart'; // import 'package:filcnaplo_premium/ui/mobile/goal_planner/new_goal.dart'; class GradeSubjectView extends StatefulWidget { - const GradeSubjectView(this.subject, {Key? key, this.groupAverage = 0.0}) - : super(key: key); + const GradeSubjectView(this.subject, {super.key, this.groupAverage = 0.0}); final GradeSubject subject; final double groupAverage; @@ -110,21 +109,21 @@ class _GradeSubjectViewState extends State { ), )); - List _gradeTiles = []; + List gradeTiles = []; if (!gradeCalcMode) { subjectGrades.sort((a, b) => -a.date.compareTo(b.date)); for (var grade in subjectGrades) { if (grade.type == GradeType.midYear) { - _gradeTiles.add(GradeViewable(grade)); + gradeTiles.add(GradeViewable(grade)); } else { - _gradeTiles.add(CertificationTile(grade, padding: EdgeInsets.zero)); + gradeTiles.add(CertificationTile(grade, padding: EdgeInsets.zero)); } } } else if (subjectGrades.isNotEmpty) { subjectGrades.sort((a, b) => -a.date.compareTo(b.date)); for (var grade in subjectGrades) { - _gradeTiles.add(GradeTile(grade)); + gradeTiles.add(GradeTile(grade)); } } tiles.add( @@ -138,18 +137,18 @@ class _GradeSubjectViewState extends State { animation: primaryAnimation, secondaryAnimation: secondaryAnimation, transitionType: SharedAxisTransitionType.vertical, - child: child, fillColor: Colors.transparent, + child: child, ); }, - child: _gradeTiles.isNotEmpty + child: gradeTiles.isNotEmpty ? Panel( key: ValueKey(gradeCalcMode), title: Text( gradeCalcMode ? "Ghost Grades".i18n : "Grades".i18n, ), child: Column( - children: _gradeTiles, + children: gradeTiles, )) : const SizedBox(), ), @@ -230,24 +229,22 @@ class _GradeSubjectViewState extends State { .where((e) => e.type == GradeType.midYear) .isNotEmpty, child: ExpandableFab( - backgroundColor: Theme.of(context).colorScheme.secondary, + overlayStyle: ExpandableFabOverlayStyle( + color: Theme.of(context).colorScheme.secondary, + ), type: ExpandableFabType.up, distance: 50, - closeButtonStyle: ExpandableFabCloseButtonStyle( - backgroundColor: Theme.of(context).colorScheme.secondary, - ), children: [ FloatingActionButton.small( heroTag: "btn_ghost_grades", - child: const Icon(FeatherIcons.plus), backgroundColor: Theme.of(context).colorScheme.secondary, onPressed: () { gradeCalc(context); }, + child: const Icon(FeatherIcons.plus), ), FloatingActionButton.small( heroTag: "btn_goal_planner", - child: const Icon(FeatherIcons.flag, size: 20.0), backgroundColor: Theme.of(context).colorScheme.secondary, onPressed: () { if (!Provider.of(context, listen: false) @@ -264,6 +261,7 @@ class _GradeSubjectViewState extends State { builder: (context) => GoalPlannerScreen(subject: widget.subject))); }, + child: const Icon(FeatherIcons.flag, size: 20.0), ), ], ), @@ -348,7 +346,7 @@ class _GradeSubjectViewState extends State { _sheetController = _scaffoldKey.currentState?.showBottomSheet( (context) => RoundedBottomSheet( - child: GradeCalculator(widget.subject), borderRadius: 14.0), + borderRadius: 14.0, child: GradeCalculator(widget.subject)), backgroundColor: const Color(0x00000000), elevation: 12.0, ); diff --git a/filcnaplo_mobile_ui/lib/pages/grades/graph.dart b/filcnaplo_mobile_ui/lib/pages/grades/graph.dart index 5e0baa9..f594693 100755 --- a/filcnaplo_mobile_ui/lib/pages/grades/graph.dart +++ b/filcnaplo_mobile_ui/lib/pages/grades/graph.dart @@ -12,17 +12,18 @@ import 'package:provider/provider.dart'; import 'graph.i18n.dart'; class GradeGraph extends StatefulWidget { - const GradeGraph(this.data, {Key? key, this.dayThreshold = 7, this.classAvg}) : super(key: key); + const GradeGraph(this.data, + {super.key, this.dayThreshold = 7, this.classAvg}); final List data; final int dayThreshold; final double? classAvg; @override - _GradeGraphState createState() => _GradeGraphState(); + GradeGraphState createState() => GradeGraphState(); } -class _GradeGraphState extends State { +class GradeGraphState extends State { late SettingsProvider settings; List getSpots(List data) { @@ -34,7 +35,9 @@ class _GradeGraphState extends State { // Sort data to points by treshold for (var element in data) { - if (sortedData.last.isNotEmpty && sortedData.last.last.writeDate.difference(element.writeDate).inDays > widget.dayThreshold) { + if (sortedData.last.isNotEmpty && + sortedData.last.last.writeDate.difference(element.writeDate).inDays > + widget.dayThreshold) { sortedData.add([]); } for (var dataList in sortedData) { @@ -48,7 +51,9 @@ class _GradeGraphState extends State { if (dataList.isNotEmpty) { subjectData.add(FlSpot( - dataList[0].writeDate.month + (dataList[0].writeDate.day / 31) + ((dataList[0].writeDate.year - data.last.writeDate.year) * 12), + dataList[0].writeDate.month + + (dataList[0].writeDate.day / 31) + + ((dataList[0].writeDate.year - data.last.writeDate.year) * 12), double.parse(average.toStringAsFixed(2)), )); } @@ -74,14 +79,19 @@ class _GradeGraphState extends State { .toList(); // Filter ghost data - List ghostData = widget.data.where((e) => e.value.weight != 0).where((e) => e.type == GradeType.ghost).toList(); + List ghostData = widget.data + .where((e) => e.value.weight != 0) + .where((e) => e.type == GradeType.ghost) + .toList(); // Calculate average double average = AverageHelper.averageEvals(data); // Calculate graph color Color averageColor = average >= 1 && average <= 5 - ? ColorTween(begin: settings.gradeColors[average.floor() - 1], end: settings.gradeColors[average.ceil() - 1]) + ? ColorTween( + begin: settings.gradeColors[average.floor() - 1], + end: settings.gradeColors[average.ceil() - 1]) .transform(average - average.floor())! : Theme.of(context).colorScheme.secondary; @@ -92,17 +102,26 @@ class _GradeGraphState extends State { ghostSpots = getSpots(data + ghostData); // hax - ghostSpots = ghostSpots.where((e) => e.x >= subjectSpots.map((f) => f.x).reduce(max)).toList(); + ghostSpots = ghostSpots + .where((e) => e.x >= subjectSpots.map((f) => f.x).reduce(max)) + .toList(); ghostSpots = ghostSpots.map((e) => FlSpot(e.x + 0.1, e.y)).toList(); - ghostSpots.add(subjectSpots.firstWhere((e) => e.x >= subjectSpots.map((f) => f.x).reduce(max), orElse: () => const FlSpot(-1, -1))); - ghostSpots.removeWhere((element) => element.x == -1 && element.y == -1); // naplo/#74 + ghostSpots.add(subjectSpots.firstWhere( + (e) => e.x >= subjectSpots.map((f) => f.x).reduce(max), + orElse: () => const FlSpot(-1, -1))); + ghostSpots.removeWhere( + (element) => element.x == -1 && element.y == -1); // naplo/#74 } - Grade halfYearGrade = widget.data.lastWhere((e) => e.type == GradeType.halfYear, orElse: () => Grade.fromJson({})); + Grade halfYearGrade = widget.data.lastWhere( + (e) => e.type == GradeType.halfYear, + orElse: () => Grade.fromJson({})); if (halfYearGrade.date.year != 0 && data.isNotEmpty) { final maxX = ghostSpots.isNotEmpty ? ghostSpots.first.x : 0; - final x = halfYearGrade.writeDate.month + (halfYearGrade.writeDate.day / 31) + ((halfYearGrade.writeDate.year - data.last.writeDate.year) * 12); + final x = halfYearGrade.writeDate.month + + (halfYearGrade.writeDate.day / 31) + + ((halfYearGrade.writeDate.year - data.last.writeDate.year) * 12); if (x <= maxX) { extraLinesV.add( VerticalLine( @@ -110,7 +129,7 @@ class _GradeGraphState extends State { strokeWidth: 3.0, color: AppColors.of(context).red.withOpacity(.75), label: VerticalLineLabel( - labelResolver: (_) => " " + "mid".i18n + " ​", // <- zwsp for padding + labelResolver: (_) => " ${"mid".i18n} ​", // <- zwsp for padding show: true, alignment: Alignment.topLeft, style: TextStyle( @@ -126,7 +145,9 @@ class _GradeGraphState extends State { } // Horizontal line displaying the class average - if (widget.classAvg != null && widget.classAvg! > 0.0 && settings.graphClassAvg) { + if (widget.classAvg != null && + widget.classAvg! > 0.0 && + settings.graphClassAvg) { extraLinesH.add(HorizontalLine( y: widget.classAvg!, color: AppColors.of(context).text.withOpacity(.75), @@ -147,12 +168,15 @@ class _GradeGraphState extends State { ) : ClipRect( child: SizedBox( + height: 158, child: subjectSpots.length > 1 ? Padding( padding: const EdgeInsets.only(top: 8.0, right: 8.0), child: LineChart( LineChartData( - extraLinesData: ExtraLinesData(verticalLines: extraLinesV, horizontalLines: extraLinesH), + extraLinesData: ExtraLinesData( + verticalLines: extraLinesV, + horizontalLines: extraLinesH), lineBarsData: [ LineChartBarData( preventCurveOverShooting: true, @@ -230,7 +254,8 @@ class _GradeGraphState extends State { strokeWidth: 3.5, ), FlDotData( - getDotPainter: (a, b, c, d) => FlDotCirclePainter( + getDotPainter: (a, b, c, d) => + FlDotCirclePainter( strokeWidth: 0, color: Colors.grey.shade900, radius: 10.0, @@ -252,25 +277,45 @@ class _GradeGraphState extends State { showTitles: true, reservedSize: 24, getTextStyles: (context, value) => TextStyle( - color: AppColors.of(context).text.withOpacity(.75), + color: + AppColors.of(context).text.withOpacity(.75), fontWeight: FontWeight.bold, fontSize: 14.0, ), margin: 12.0, getTitles: (value) { - var format = DateFormat("MMM", I18n.of(context).locale.toString()); + var format = DateFormat( + "MMM", I18n.of(context).locale.toString()); - String title = format.format(DateTime(0, value.floor() % 12)).replaceAll(".", ""); - title = title.substring(0, min(title.length, 4)); + String title = format + .format(DateTime(0, value.floor() % 12)) + .replaceAll(".", ""); + title = + title.substring(0, min(title.length, 4)); return title.toUpperCase(); }, interval: () { - List tData = ghostData.isNotEmpty ? ghostData : data; - tData.sort((a, b) => a.writeDate.compareTo(b.writeDate)); - return tData.first.writeDate.add(const Duration(days: 120)).isBefore(tData.last.writeDate) ? 2.0 : 1.0; + List tData = + ghostData.isNotEmpty ? ghostData : data; + tData.sort((a, b) => + a.writeDate.compareTo(b.writeDate)); + return tData.first.writeDate + .add(const Duration(days: 120)) + .isBefore(tData.last.writeDate) + ? 2.0 + : 1.0; }(), - checkToShowTitle: (double minValue, double maxValue, SideTitles sideTitles, double appliedInterval, double value) { if (value == maxValue || value == minValue) return false; return true; }, + checkToShowTitle: (double minValue, + double maxValue, + SideTitles sideTitles, + double appliedInterval, + double value) { + if (value == maxValue || value == minValue) { + return false; + } + return true; + }, ), leftTitles: SideTitles( showTitles: true, @@ -289,7 +334,6 @@ class _GradeGraphState extends State { ), ) : null, - height: 158, ), ); } diff --git a/filcnaplo_mobile_ui/pubspec.yaml b/filcnaplo_mobile_ui/pubspec.yaml index fdfc57d..bcdf156 100644 --- a/filcnaplo_mobile_ui/pubspec.yaml +++ b/filcnaplo_mobile_ui/pubspec.yaml @@ -46,10 +46,13 @@ dependencies: rounded_expansion_tile: git: url: https://github.com/kimaah/rounded_expansion_tile.git - go_router: ^10.1.2 + go_router: ^12.1.3 + flutter_expandable_fab: ^2.0.0 + intl: ^0.18.1 + i18n_extension: ^10.0.1 dev_dependencies: - flutter_lints: ^1.0.0 + flutter_lints: ^3.0.1 flutter: uses-material-design: true \ No newline at end of file