From b850551a6df0ef5e10bfa0ea08ecd6050a0a6331 Mon Sep 17 00:00:00 2001 From: Armand <4831c0@proton.me> Date: Sun, 24 Aug 2025 14:47:41 +0200 Subject: [PATCH] tt/mo: add lesson count --- firka/lib/helpers/extensions.dart | 14 +++- .../phone/pages/home/home_timetable_mo.dart | 68 +++++++++++++++++-- 2 files changed, 76 insertions(+), 6 deletions(-) diff --git a/firka/lib/helpers/extensions.dart b/firka/lib/helpers/extensions.dart index 790f23f..2db8785 100644 --- a/firka/lib/helpers/extensions.dart +++ b/firka/lib/helpers/extensions.dart @@ -33,7 +33,17 @@ extension DurationExtension on Duration { } } -enum FormatMode { yearly, grades, welcome, hmm, da, dd, yyyymmddwedd, yyyymmmm } +enum FormatMode { + yearly, + grades, + welcome, + hmm, + d, + da, + dd, + yyyymmddwedd, + yyyymmmm +} enum Cycle { morning, day, afternoon, night } @@ -75,6 +85,8 @@ extension DateExtension on DateTime { return DateFormat('H:mm').format(this); case FormatMode.welcome: return DateFormat('EEE, MMM d').format(this); + case FormatMode.d: + return DateFormat('d').format(this); case FormatMode.da: return DateFormat('MMMMEEEEd').format(this).substring(0, 2); case FormatMode.dd: diff --git a/firka/lib/ui/phone/pages/home/home_timetable_mo.dart b/firka/lib/ui/phone/pages/home/home_timetable_mo.dart index ec7b5e2..71bd19c 100644 --- a/firka/lib/ui/phone/pages/home/home_timetable_mo.dart +++ b/firka/lib/ui/phone/pages/home/home_timetable_mo.dart @@ -1,4 +1,3 @@ -import 'package:carousel_slider/carousel_slider.dart'; import 'package:firka/helpers/api/model/timetable.dart'; import 'package:firka/helpers/debug_helper.dart'; import 'package:firka/helpers/extensions.dart'; @@ -121,8 +120,11 @@ class _HomeTimetableMonthlyScreen extends State { if (lessonsToday.isNotEmpty) { body = Center( child: Text(lessonsToday.length.toString(), - style: appStyle.fonts.H_16px - .apply(color: appStyle.colors.secondary)), + style: appStyle.fonts.H_16px.apply( + color: + timeNow().day == d.day && timeNow().month == d.month + ? appStyle.colors.accent + : appStyle.colors.secondary)), ); } ttDays.add(Column( @@ -132,14 +134,16 @@ class _HomeTimetableMonthlyScreen extends State { height: 40, clipBehavior: Clip.antiAlias, decoration: ShapeDecoration( - color: appStyle.colors.card, + color: timeNow().day == d.day && timeNow().month == d.month + ? appStyle.colors.buttonSecondaryFill + : appStyle.colors.card, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(6)), ), child: body, ), SizedBox(height: 4), - Text(d.format(widget.data.l10n, FormatMode.dd), + Text(d.format(widget.data.l10n, FormatMode.d), style: appStyle.fonts.B_14R.apply( color: (d.weekday == DateTime.saturday || d.weekday == DateTime.sunday) && @@ -290,6 +294,60 @@ class _HomeTimetableMonthlyScreen extends State { ), )), )), + TransparentPointer( + child: Column( + children: [ + SizedBox( + height: MediaQuery.of(context).size.height / 1.3, + ), + SizedBox( + width: MediaQuery.of(context).size.width, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SizedBox(), + Row( + children: [ + Container( + clipBehavior: Clip.antiAlias, + decoration: ShapeDecoration( + color: appStyle.colors.buttonSecondaryFill, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16)), + ), + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, vertical: 4), + child: Row( + children: [ + FirkaIconWidget(FirkaIconType.majesticons, + Majesticon.clockSolid, + color: appStyle.colors.accent, size: 16), + SizedBox(width: 6), + Text( + lessons! + .where((lesson) => + lesson.start + .isAfter(currentMonthStart) && + lesson.end + .isBefore(currentMonthEnd)) + .length + .toString(), + style: appStyle.fonts.H_16px.apply( + color: appStyle.colors.textPrimary)) + ], + ), + ), + ), + ], + ), + SizedBox() + ], + ), + ) + ], + ), + ), ]); } else { return SizedBox(