From ccf7443f261fcc0181c2cbcfaf4b2c76e46f4729 Mon Sep 17 00:00:00 2001 From: balint1414 Date: Thu, 2 Oct 2025 22:36:37 +0200 Subject: [PATCH] =?UTF-8?q?Sz=C3=A1monk=C3=A9r=C3=A9s=20megjelen=C3=ADt?= =?UTF-8?q?=C3=A9se=20az=20adott=20=C3=B3ra=20felugr=C3=B3=20ablak=C3=A1n?= =?UTF-8?q?=C3=A1l?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib/helpers/ui/common_bottom_sheets.dart | 94 ++++++++++++++++--- firka/lib/ui/phone/widgets/lesson.dart | 2 +- 2 files changed, 83 insertions(+), 13 deletions(-) diff --git a/firka/lib/helpers/ui/common_bottom_sheets.dart b/firka/lib/helpers/ui/common_bottom_sheets.dart index afa15a9..196a78f 100644 --- a/firka/lib/helpers/ui/common_bottom_sheets.dart +++ b/firka/lib/helpers/ui/common_bottom_sheets.dart @@ -3,8 +3,10 @@ import 'package:firka/helpers/api/model/grade.dart'; import 'package:firka/helpers/debug_helper.dart'; import 'package:firka/helpers/extensions.dart'; import 'package:firka/helpers/settings.dart'; +import 'package:firka/ui/widget/firka_icon.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:majesticons_flutter/majesticons_flutter.dart'; import '../../main.dart'; import '../../ui/model/style.dart'; @@ -13,6 +15,7 @@ import '../../ui/widget/class_icon.dart'; import '../api/model/timetable.dart'; import 'firka_card.dart'; import 'grade.dart'; +import '../../helpers/api/model/test.dart'; Future showLessonBottomSheet( BuildContext context, @@ -21,11 +24,17 @@ Future showLessonBottomSheet( int? lessonNo, Color accent, Color secondary, - Color bgColor) async { + Color bgColor, + Test? test, + ) async { final statsForNerdsEnabled = data.settings .group("settings") .subGroup("developer") .boolean("stats_for_nerds"); + final showTests = data.settings + .group("settings") + .subGroup("timetable_toast") + .boolean("tests_and_homework"); showModalBottomSheet( context: context, elevation: 100, @@ -37,7 +46,6 @@ Future showLessonBottomSheet( Widget statsForNerds = SizedBox(); final y2k = DateTime(2000, 1); - if (statsForNerdsEnabled) { final stats = "${data.l10n.stats_date}: ${lesson.start.isAfter(y2k) ? lesson.start.format(data.l10n, FormatMode.yyyymmddhhmmss) : "N/A"}\n" @@ -47,7 +55,7 @@ Future showLessonBottomSheet( style: appStyle.fonts.B_16R.apply(color: appStyle.colors.textPrimary)); } - + return Stack( children: [ Positioned.fill( @@ -162,20 +170,82 @@ Future showLessonBottomSheet( ), SizedBox(height: 4), SizedBox( - width: MediaQuery.of(context).size.width * 0.7, - child: Text( - lesson.theme ?? 'N/A', - style: appStyle.fonts.B_16R - .apply(color: appStyle.colors.textPrimary), - maxLines: 3, - overflow: TextOverflow.ellipsis, - ), + width: MediaQuery.of(context).size.width * 0.7, + child: Text( + lesson.theme ?? 'N/A', + style: appStyle.fonts.B_16R + .apply(color: appStyle.colors.textPrimary), + maxLines: 3, + overflow: TextOverflow.ellipsis, + ), ), SizedBox(height: 4), statsForNerds ], ) - ]) + ]), + if (test != null && showTests) + FirkaCard( + left: [ + Container( + decoration: ShapeDecoration( + color: appStyle.colors.a15p, + shape: CircleBorder(), + ), + child: Padding( + padding: const EdgeInsets.all(8), + child: FirkaIconWidget( + FirkaIconType.majesticons, + Majesticon.editPen4Solid, + size: 26.0, + color: appStyle.colors.accent, + ), + ), + ), + SizedBox(width: 12), + Container( + alignment: Alignment.centerLeft, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + width: MediaQuery.of(context).size.width * 0.6, + child: Text( + test.theme, + style: appStyle.fonts.B_16SB.apply(color: appStyle.colors.textPrimary), + maxLines: 2, + overflow: TextOverflow.ellipsis, + ) + ), + SizedBox(height: 4), + SizedBox( + width: MediaQuery.of(context).size.width * 0.6, + child: Text( + test.method.description ?? 'N/A', + style: appStyle.fonts.B_16R.apply(color: appStyle.colors.textSecondary), + maxLines: 2, + overflow: TextOverflow.ellipsis, + ), + ) + ], + ), + ), + Container( + decoration: ShapeDecoration( + color: appStyle.colors.a15p, + shape: CircleBorder(), + ), + child: Padding( + padding: const EdgeInsets.all(8), + child: FirkaIconWidget( + FirkaIconType.majesticons, + Majesticon.tooltipsSolid, + size: 26.0, + color: appStyle.colors.accent, + ), + ), + ), + ]) ], ), ), diff --git a/firka/lib/ui/phone/widgets/lesson.dart b/firka/lib/ui/phone/widgets/lesson.dart index df8839f..c232edd 100644 --- a/firka/lib/ui/phone/widgets/lesson.dart +++ b/firka/lib/ui/phone/widgets/lesson.dart @@ -77,7 +77,7 @@ class LessonWidget extends StatelessWidget { elements.add(GestureDetector( onTap: () { showLessonBottomSheet( - context, data, lesson, lessonNo, accent, secondary, bgColor); + context, data, lesson, lessonNo, accent, secondary, bgColor, test); }, child: FirkaCard( color: isDismissed