Merge branch 'refilc:dev' into dev
This commit is contained in:
commit
5f27432518
@ -246,7 +246,7 @@ class LessonTile extends StatelessWidget {
|
|||||||
? accent.withOpacity(.15)
|
? accent.withOpacity(.15)
|
||||||
: Theme.of(context)
|
: Theme.of(context)
|
||||||
.colorScheme
|
.colorScheme
|
||||||
.secondary
|
.tertiary
|
||||||
.withOpacity(.15),
|
.withOpacity(.15),
|
||||||
borderRadius: BorderRadius.circular(10.0),
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
),
|
),
|
||||||
@ -398,7 +398,7 @@ class LessonTile extends StatelessWidget {
|
|||||||
? accent.withOpacity(.15)
|
? accent.withOpacity(.15)
|
||||||
: Theme.of(context)
|
: Theme.of(context)
|
||||||
.colorScheme
|
.colorScheme
|
||||||
.secondary
|
.tertiary
|
||||||
.withOpacity(.15),
|
.withOpacity(.15),
|
||||||
borderRadius: BorderRadius.circular(10.0),
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
),
|
),
|
||||||
|
@ -1,9 +1,15 @@
|
|||||||
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
|
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
|
||||||
|
import 'package:flutter_svg/svg.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:refilc/api/providers/database_provider.dart';
|
import 'package:refilc/api/providers/database_provider.dart';
|
||||||
import 'package:refilc/api/providers/user_provider.dart';
|
import 'package:refilc/api/providers/user_provider.dart';
|
||||||
|
import 'package:refilc/helpers/subject.dart';
|
||||||
|
import 'package:refilc/theme/colors/colors.dart';
|
||||||
|
import 'package:refilc/theme/colors/utils.dart';
|
||||||
import 'package:refilc_kreta_api/models/lesson.dart';
|
import 'package:refilc_kreta_api/models/lesson.dart';
|
||||||
|
import 'package:refilc_mobile_ui/common/bottom_sheet_menu/rounded_bottom_sheet.dart';
|
||||||
import 'package:refilc_mobile_ui/common/panel/panel_button.dart';
|
import 'package:refilc_mobile_ui/common/panel/panel_button.dart';
|
||||||
|
import 'package:refilc_mobile_ui/common/round_border_icon.dart';
|
||||||
import 'package:refilc_mobile_ui/common/viewable.dart';
|
import 'package:refilc_mobile_ui/common/viewable.dart';
|
||||||
import 'package:refilc_mobile_ui/common/widgets/card_handle.dart';
|
import 'package:refilc_mobile_ui/common/widgets/card_handle.dart';
|
||||||
import 'package:refilc/ui/widgets/lesson/lesson_tile.dart';
|
import 'package:refilc/ui/widgets/lesson/lesson_tile.dart';
|
||||||
@ -49,98 +55,48 @@ class LessonViewableState extends State<LessonViewable> {
|
|||||||
|
|
||||||
if (lsn.subject.id == '' || tile.lesson.isEmpty) return tile;
|
if (lsn.subject.id == '' || tile.lesson.isEmpty) return tile;
|
||||||
|
|
||||||
return Viewable(
|
return LessonTile(
|
||||||
tile: tile,
|
lsn,
|
||||||
view: CardHandle(child: LessonView(lsn)),
|
swapDesc: widget.swapDesc,
|
||||||
actions: [
|
onTap: () => TimetableLessonPopup.show(context: context, lesson: lsn),
|
||||||
PanelButton(
|
);
|
||||||
background: true,
|
|
||||||
title: Text(
|
|
||||||
"edit_lesson".i18n,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
maxLines: 2,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.of(context, rootNavigator: true).pop();
|
|
||||||
|
|
||||||
if (!Provider.of<PlusProvider>(context, listen: false)
|
// return Viewable(
|
||||||
.hasScope(PremiumScopes.timetableNotes)) {
|
// tile: tile,
|
||||||
PlusLockedFeaturePopup.show(
|
// view: CardHandle(child: LessonView(lsn)),
|
||||||
context: context, feature: PremiumFeature.timetableNotes);
|
// actions: [
|
||||||
|
// PanelButton(
|
||||||
return;
|
// background: true,
|
||||||
}
|
// title: Text(
|
||||||
|
// "edit_lesson".i18n,
|
||||||
showDialog(
|
// textAlign: TextAlign.center,
|
||||||
context: context,
|
// maxLines: 2,
|
||||||
builder: (context) => StatefulBuilder(builder: (context, setS) {
|
// overflow: TextOverflow.ellipsis,
|
||||||
return AlertDialog(
|
|
||||||
shape: const RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(14.0))),
|
|
||||||
title: Text("edit_lesson".i18n),
|
|
||||||
content: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
// description
|
|
||||||
TextField(
|
|
||||||
controller: _descTxt,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderSide: const BorderSide(
|
|
||||||
color: Colors.grey, width: 1.5),
|
|
||||||
borderRadius: BorderRadius.circular(12.0),
|
|
||||||
),
|
|
||||||
focusedBorder: OutlineInputBorder(
|
|
||||||
borderSide: const BorderSide(
|
|
||||||
color: Colors.grey, width: 1.5),
|
|
||||||
borderRadius: BorderRadius.circular(12.0),
|
|
||||||
),
|
|
||||||
contentPadding:
|
|
||||||
const EdgeInsets.symmetric(horizontal: 12.0),
|
|
||||||
hintText: 'l_desc'.i18n,
|
|
||||||
suffixIcon: IconButton(
|
|
||||||
icon: const Icon(
|
|
||||||
FeatherIcons.x,
|
|
||||||
color: Colors.grey,
|
|
||||||
size: 18.0,
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
setState(() {
|
|
||||||
_descTxt.text = '';
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
// const SizedBox(
|
|
||||||
// height: 14.0,
|
|
||||||
// ),
|
// ),
|
||||||
// // class
|
// onPressed: () {
|
||||||
|
// Navigator.of(context, rootNavigator: true).pop();
|
||||||
|
|
||||||
|
// if (!Provider.of<PlusProvider>(context, listen: false)
|
||||||
|
// .hasScope(PremiumScopes.timetableNotes)) {
|
||||||
|
// PlusLockedFeaturePopup.show(
|
||||||
|
// context: context, feature: PremiumFeature.timetableNotes);
|
||||||
|
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// showDialog(
|
||||||
|
// context: context,
|
||||||
|
// builder: (context) => StatefulBuilder(builder: (context, setS) {
|
||||||
|
// return AlertDialog(
|
||||||
|
// shape: const RoundedRectangleBorder(
|
||||||
|
// borderRadius: BorderRadius.all(Radius.circular(14.0))),
|
||||||
|
// title: Text("edit_lesson".i18n),
|
||||||
|
// content: Column(
|
||||||
|
// mainAxisSize: MainAxisSize.min,
|
||||||
|
// children: [
|
||||||
|
// // description
|
||||||
// TextField(
|
// TextField(
|
||||||
// controller: _descTxt,
|
// controller: _descTxt,
|
||||||
// onEditingComplete: () async {
|
|
||||||
// // SharedTheme? theme = await shareProvider.getThemeById(
|
|
||||||
// // context,
|
|
||||||
// // id: _paintId.text.replaceAll(' ', ''),
|
|
||||||
// // );
|
|
||||||
|
|
||||||
// // if (theme != null) {
|
|
||||||
// // // set theme variable
|
|
||||||
// // newThemeByID = theme;
|
|
||||||
|
|
||||||
// // _paintId.clear();
|
|
||||||
// // } else {
|
|
||||||
// // ScaffoldMessenger.of(context).showSnackBar(
|
|
||||||
// // CustomSnackBar(
|
|
||||||
// // content: Text("theme_not_found".i18n,
|
|
||||||
// // style: const TextStyle(color: Colors.white)),
|
|
||||||
// // backgroundColor: AppColors.of(context).red,
|
|
||||||
// // context: context,
|
|
||||||
// // ),
|
|
||||||
// // );
|
|
||||||
// // }
|
|
||||||
// },
|
|
||||||
// decoration: InputDecoration(
|
// decoration: InputDecoration(
|
||||||
// border: OutlineInputBorder(
|
// border: OutlineInputBorder(
|
||||||
// borderSide: const BorderSide(
|
// borderSide: const BorderSide(
|
||||||
@ -169,38 +125,94 @@ class LessonViewableState extends State<LessonViewable> {
|
|||||||
// ),
|
// ),
|
||||||
// ),
|
// ),
|
||||||
// ),
|
// ),
|
||||||
],
|
// // const SizedBox(
|
||||||
),
|
// // height: 14.0,
|
||||||
actions: [
|
// // ),
|
||||||
TextButton(
|
// // // class
|
||||||
child: Text(
|
// // TextField(
|
||||||
"cancel".i18n,
|
// // controller: _descTxt,
|
||||||
style: const TextStyle(fontWeight: FontWeight.w500),
|
// // onEditingComplete: () async {
|
||||||
),
|
// // // SharedTheme? theme = await shareProvider.getThemeById(
|
||||||
onPressed: () {
|
// // // context,
|
||||||
Navigator.of(context).maybePop();
|
// // // id: _paintId.text.replaceAll(' ', ''),
|
||||||
},
|
// // // );
|
||||||
),
|
|
||||||
TextButton(
|
|
||||||
child: Text(
|
|
||||||
"done".i18n,
|
|
||||||
style: const TextStyle(fontWeight: FontWeight.w500),
|
|
||||||
),
|
|
||||||
onPressed: () async {
|
|
||||||
saveLesson();
|
|
||||||
|
|
||||||
Navigator.of(context).pop();
|
// // // if (theme != null) {
|
||||||
setState(() {});
|
// // // // set theme variable
|
||||||
},
|
// // // newThemeByID = theme;
|
||||||
),
|
|
||||||
],
|
// // // _paintId.clear();
|
||||||
);
|
// // // } else {
|
||||||
}),
|
// // // ScaffoldMessenger.of(context).showSnackBar(
|
||||||
);
|
// // // CustomSnackBar(
|
||||||
},
|
// // // content: Text("theme_not_found".i18n,
|
||||||
),
|
// // // style: const TextStyle(color: Colors.white)),
|
||||||
],
|
// // // backgroundColor: AppColors.of(context).red,
|
||||||
);
|
// // // context: context,
|
||||||
|
// // // ),
|
||||||
|
// // // );
|
||||||
|
// // // }
|
||||||
|
// // },
|
||||||
|
// // decoration: InputDecoration(
|
||||||
|
// // border: OutlineInputBorder(
|
||||||
|
// // borderSide: const BorderSide(
|
||||||
|
// // color: Colors.grey, width: 1.5),
|
||||||
|
// // borderRadius: BorderRadius.circular(12.0),
|
||||||
|
// // ),
|
||||||
|
// // focusedBorder: OutlineInputBorder(
|
||||||
|
// // borderSide: const BorderSide(
|
||||||
|
// // color: Colors.grey, width: 1.5),
|
||||||
|
// // borderRadius: BorderRadius.circular(12.0),
|
||||||
|
// // ),
|
||||||
|
// // contentPadding:
|
||||||
|
// // const EdgeInsets.symmetric(horizontal: 12.0),
|
||||||
|
// // hintText: 'l_desc'.i18n,
|
||||||
|
// // suffixIcon: IconButton(
|
||||||
|
// // icon: const Icon(
|
||||||
|
// // FeatherIcons.x,
|
||||||
|
// // color: Colors.grey,
|
||||||
|
// // size: 18.0,
|
||||||
|
// // ),
|
||||||
|
// // onPressed: () {
|
||||||
|
// // setState(() {
|
||||||
|
// // _descTxt.text = '';
|
||||||
|
// // });
|
||||||
|
// // },
|
||||||
|
// // ),
|
||||||
|
// // ),
|
||||||
|
// // ),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// actions: [
|
||||||
|
// TextButton(
|
||||||
|
// child: Text(
|
||||||
|
// "cancel".i18n,
|
||||||
|
// style: const TextStyle(fontWeight: FontWeight.w500),
|
||||||
|
// ),
|
||||||
|
// onPressed: () {
|
||||||
|
// Navigator.of(context).maybePop();
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// TextButton(
|
||||||
|
// child: Text(
|
||||||
|
// "done".i18n,
|
||||||
|
// style: const TextStyle(fontWeight: FontWeight.w500),
|
||||||
|
// ),
|
||||||
|
// onPressed: () async {
|
||||||
|
// saveLesson();
|
||||||
|
|
||||||
|
// Navigator.of(context).pop();
|
||||||
|
// setState(() {});
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// );
|
||||||
|
// }),
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// );
|
||||||
}
|
}
|
||||||
|
|
||||||
void saveLesson() async {
|
void saveLesson() async {
|
||||||
@ -218,3 +230,197 @@ class LessonViewableState extends State<LessonViewable> {
|
|||||||
.storeCustomLessonDescriptions(lessonDesc, userId: user.id!);
|
.storeCustomLessonDescriptions(lessonDesc, userId: user.id!);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class TimetableLessonPopup extends StatelessWidget {
|
||||||
|
const TimetableLessonPopup({super.key, required this.lesson});
|
||||||
|
|
||||||
|
final Lesson lesson;
|
||||||
|
|
||||||
|
static void show({
|
||||||
|
required BuildContext context,
|
||||||
|
required Lesson lesson,
|
||||||
|
}) =>
|
||||||
|
showRoundedModalBottomSheet(
|
||||||
|
context,
|
||||||
|
child: TimetableLessonPopup(
|
||||||
|
lesson: lesson,
|
||||||
|
),
|
||||||
|
showHandle: false,
|
||||||
|
);
|
||||||
|
|
||||||
|
// IconData _getIcon() => _featureLevels[feature] == PremiumFeatureLevel.cap
|
||||||
|
// ? FilcIcons.kupak
|
||||||
|
// : _featureLevels[feature] == PremiumFeatureLevel.ink
|
||||||
|
// ? FilcIcons.tinta
|
||||||
|
// : FilcIcons.tinta;
|
||||||
|
// Color _getColor(BuildContext context) =>
|
||||||
|
// _featureLevels[feature] == PremiumFeatureLevel.gold
|
||||||
|
// ? const Color(0xFFC89B08)
|
||||||
|
// : Theme.of(context).brightness == Brightness.light
|
||||||
|
// ? const Color(0xff691A9B)
|
||||||
|
// : const Color(0xffA66FC8);
|
||||||
|
// String? _getAsset() => _featureAssets[feature];
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context).scaffoldBackgroundColor,
|
||||||
|
borderRadius: const BorderRadius.vertical(
|
||||||
|
top: Radius.circular(12.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Stack(
|
||||||
|
children: [
|
||||||
|
SvgPicture.asset(
|
||||||
|
"assets/svg/mesh_bg.svg",
|
||||||
|
// ignore: deprecated_member_use
|
||||||
|
color: ColorsUtils().fade(
|
||||||
|
context, Theme.of(context).scaffoldBackgroundColor,
|
||||||
|
darkenAmount: 0.1, lightenAmount: 0.1),
|
||||||
|
width: MediaQuery.of(context).size.width,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: MediaQuery.of(context).size.width,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(18.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: 40,
|
||||||
|
height: 4,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: ColorsUtils().fade(
|
||||||
|
context, Theme.of(context).scaffoldBackgroundColor,
|
||||||
|
darkenAmount: 0.2, lightenAmount: 0.2),
|
||||||
|
borderRadius: BorderRadius.circular(
|
||||||
|
2.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 38.0,
|
||||||
|
),
|
||||||
|
RoundBorderIcon(
|
||||||
|
icon: Icon(
|
||||||
|
SubjectIcon.resolveVariant(
|
||||||
|
context: context, subject: lesson.subject),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 55.0,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: double.infinity,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context).colorScheme.background,
|
||||||
|
borderRadius: const BorderRadius.vertical(
|
||||||
|
top: Radius.circular(12.0),
|
||||||
|
bottom: Radius.circular(6.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
padding: const EdgeInsets.all(14.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'6:09 - 4:20',
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.of(context).text.withOpacity(0.85),
|
||||||
|
fontSize: 14.0,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12.0,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
lesson.name,
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.of(context).text,
|
||||||
|
fontSize: 20.0,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 8.0,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
lesson.teacher.name,
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.of(context).text.withOpacity(0.9),
|
||||||
|
fontSize: 14.0,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 6.0,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: double.infinity,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context).colorScheme.background,
|
||||||
|
borderRadius: const BorderRadius.vertical(
|
||||||
|
top: Radius.circular(6.0),
|
||||||
|
bottom: Radius.circular(12.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
padding: const EdgeInsets.all(14.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
lesson.description,
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.of(context).text.withOpacity(0.9),
|
||||||
|
fontSize: 14.0,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 24.0,
|
||||||
|
),
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context, rootNavigator: true)
|
||||||
|
.pushReplacementNamed('/');
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
width: double.infinity,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context).colorScheme.background,
|
||||||
|
borderRadius: BorderRadius.circular(12.0),
|
||||||
|
),
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'view_subject'.i18n,
|
||||||
|
style: TextStyle(
|
||||||
|
color:
|
||||||
|
AppColors.of(context).text.withOpacity(0.9),
|
||||||
|
fontSize: 18.0,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -362,6 +362,7 @@ class AbsencesPageState extends State<AbsencesPage>
|
|||||||
|
|
||||||
List<Absence> unexcused = [];
|
List<Absence> unexcused = [];
|
||||||
List<Absence> excused = [];
|
List<Absence> excused = [];
|
||||||
|
List<Absence> pending = [];
|
||||||
|
|
||||||
List<double> absencePositions = [];
|
List<double> absencePositions = [];
|
||||||
List<Color> finalChartColors = [];
|
List<Color> finalChartColors = [];
|
||||||
@ -375,13 +376,14 @@ class AbsencesPageState extends State<AbsencesPage>
|
|||||||
.where((e) =>
|
.where((e) =>
|
||||||
e.delay == 0 && e.state == Justification.excused)
|
e.delay == 0 && e.state == Justification.excused)
|
||||||
.toList();
|
.toList();
|
||||||
|
pending = absenceProvider.absences
|
||||||
|
.where((e) =>
|
||||||
|
e.delay == 0 && e.state == Justification.pending)
|
||||||
|
.toList();
|
||||||
|
|
||||||
value1 = excused.length;
|
value1 = excused.length;
|
||||||
value2 = unexcused.length;
|
value2 = unexcused.length;
|
||||||
value3 = absenceProvider.absences
|
value3 = pending.length;
|
||||||
.where((e) =>
|
|
||||||
e.delay == 0 && e.state == Justification.pending)
|
|
||||||
.length;
|
|
||||||
title1 = "stat_1".i18n;
|
title1 = "stat_1".i18n;
|
||||||
title2 = "stat_2".i18n;
|
title2 = "stat_2".i18n;
|
||||||
suffix = " ${"hr".i18n}";
|
suffix = " ${"hr".i18n}";
|
||||||
@ -394,15 +396,15 @@ class AbsencesPageState extends State<AbsencesPage>
|
|||||||
.where((e) =>
|
.where((e) =>
|
||||||
e.delay != 0 && e.state == Justification.excused)
|
e.delay != 0 && e.state == Justification.excused)
|
||||||
.toList();
|
.toList();
|
||||||
|
pending = absenceProvider.absences
|
||||||
|
.where((e) =>
|
||||||
|
e.delay != 0 && e.state == Justification.pending)
|
||||||
|
.toList();
|
||||||
|
|
||||||
value1 = excused.map((e) => e.delay).fold(0, (a, b) => a + b);
|
value1 = excused.map((e) => e.delay).fold(0, (a, b) => a + b);
|
||||||
value2 =
|
value2 =
|
||||||
unexcused.map((e) => e.delay).fold(0, (a, b) => a + b);
|
unexcused.map((e) => e.delay).fold(0, (a, b) => a + b);
|
||||||
value3 = absenceProvider.absences
|
value3 = pending.map((e) => e.delay).fold(0, (a, b) => a + b);
|
||||||
.where((e) =>
|
|
||||||
e.delay != 0 && e.state == Justification.pending)
|
|
||||||
.map((e) => e.delay)
|
|
||||||
.fold(0, (a, b) => a + b);
|
|
||||||
title1 = "stat_3".i18n;
|
title1 = "stat_3".i18n;
|
||||||
title2 = "stat_4".i18n;
|
title2 = "stat_4".i18n;
|
||||||
suffix = " ${"min".i18n}";
|
suffix = " ${"min".i18n}";
|
||||||
@ -417,7 +419,7 @@ class AbsencesPageState extends State<AbsencesPage>
|
|||||||
int barTotal =
|
int barTotal =
|
||||||
DateTime.now().difference(DateTime(yr, 09, 01)).inDays;
|
DateTime.now().difference(DateTime(yr, 09, 01)).inDays;
|
||||||
|
|
||||||
[...unexcused, ...excused].forEachIndexed((i, a) {
|
[...unexcused, ...excused, ...pending].forEachIndexed((i, a) {
|
||||||
int abs = DateTime.now().difference(a.date).inDays;
|
int abs = DateTime.now().difference(a.date).inDays;
|
||||||
|
|
||||||
double startPos = (barTotal - abs) / barTotal;
|
double startPos = (barTotal - abs) / barTotal;
|
||||||
@ -435,11 +437,14 @@ class AbsencesPageState extends State<AbsencesPage>
|
|||||||
end: endPos,
|
end: endPos,
|
||||||
color: a.state == Justification.excused
|
color: a.state == Justification.excused
|
||||||
? Colors.green
|
? Colors.green
|
||||||
: Colors.red,
|
: a.state == Justification.unexcused
|
||||||
|
? Colors.red
|
||||||
|
: Colors.orange,
|
||||||
));
|
));
|
||||||
if ([...unexcused, ...excused].length > i + 1) {
|
if ([...unexcused, ...excused, ...pending].length > i + 1) {
|
||||||
int nextAbs = DateTime.now()
|
int nextAbs = DateTime.now()
|
||||||
.difference([...unexcused, ...excused][i + 1].date)
|
.difference(
|
||||||
|
[...unexcused, ...excused, ...pending][i + 1].date)
|
||||||
.inDays;
|
.inDays;
|
||||||
|
|
||||||
double nextStartPos = (barTotal - nextAbs) / barTotal;
|
double nextStartPos = (barTotal - nextAbs) / barTotal;
|
||||||
@ -454,7 +459,8 @@ class AbsencesPageState extends State<AbsencesPage>
|
|||||||
|
|
||||||
// print(value2.toString() + '-total');
|
// print(value2.toString() + '-total');
|
||||||
// print(absenceChartData.length.toString() + '-chartdata');
|
// print(absenceChartData.length.toString() + '-chartdata');
|
||||||
if ((i + 1 == [...unexcused, ...excused].length) &&
|
if ((i + 1 ==
|
||||||
|
[...unexcused, ...excused, ...pending].length) &&
|
||||||
endPos < 0.999) {
|
endPos < 0.999) {
|
||||||
absenceChartData.add(AbsenceChartData(
|
absenceChartData.add(AbsenceChartData(
|
||||||
start: endPos,
|
start: endPos,
|
||||||
|
@ -525,7 +525,7 @@ class LiveCardStateA extends State<LiveCard> {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Theme.of(context)
|
color: Theme.of(context)
|
||||||
.colorScheme
|
.colorScheme
|
||||||
.secondary
|
.tertiary
|
||||||
.withOpacity(.15),
|
.withOpacity(.15),
|
||||||
borderRadius:
|
borderRadius:
|
||||||
BorderRadius.circular(10.0),
|
BorderRadius.circular(10.0),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user