finished new morning live card

This commit is contained in:
Kima 2024-04-22 17:44:15 +02:00
parent 90debfa60c
commit 3f537976e9
3 changed files with 133 additions and 43 deletions

View File

@ -195,8 +195,8 @@ class HomePageState extends State<HomePage> with TickerProviderStateMixin {
// ]; // ];
// String? selectedValue; // String? selectedValue;
// DateTime now = DateTime.now(); DateTime now = DateTime.now();
DateTime now = DateTime(2024, 4, 22, 5, 55); // DateTime now = DateTime(2024, 4, 22, 5, 55);
LiveCardState currentState = LiveCardState.empty; LiveCardState currentState = LiveCardState.empty;
if (now.isBefore(DateTime(now.year, DateTime.august, 31)) && if (now.isBefore(DateTime(now.year, DateTime.august, 31)) &&

View File

@ -3,6 +3,10 @@ import 'package:refilc/api/providers/user_provider.dart';
import 'package:refilc/helpers/subject.dart'; import 'package:refilc/helpers/subject.dart';
import 'package:refilc/icons/filc_icons.dart'; import 'package:refilc/icons/filc_icons.dart';
import 'package:refilc/models/settings.dart'; import 'package:refilc/models/settings.dart';
import 'package:refilc_kreta_api/models/category.dart';
import 'package:refilc_kreta_api/models/lesson.dart';
import 'package:refilc_kreta_api/models/subject.dart';
import 'package:refilc_kreta_api/models/teacher.dart';
import 'package:refilc_mobile_ui/common/splitted_panel/splitted_panel.dart'; import 'package:refilc_mobile_ui/common/splitted_panel/splitted_panel.dart';
import 'package:refilc_mobile_ui/pages/home/live_card/heads_up_countdown.dart'; import 'package:refilc_mobile_ui/pages/home/live_card/heads_up_countdown.dart';
import 'package:refilc_mobile_ui/pages/home/live_card/segmented_countdown.dart'; import 'package:refilc_mobile_ui/pages/home/live_card/segmented_countdown.dart';
@ -56,7 +60,28 @@ class LiveCardStateA extends State<LiveCard> {
Duration bellDelay = liveCard.delay; Duration bellDelay = liveCard.delay;
// test // test
liveCard.currentState = LiveCardState.morning; // liveCard.currentState = LiveCardState.morning;
// liveCard.nextLesson = Lesson(
// date: DateTime.now().add(Duration(
// minutes: 30,
// )),
// subject: GradeSubject(
// category: Category(id: 'asd'), id: 'asd', name: 'Matematika'),
// lessonIndex: 'lessonIndex',
// teacher: Teacher(id: 'id', name: 'name'),
// start: DateTime.now().add(Duration(
// minutes: 30,
// )),
// end: DateTime.now().add(Duration(
// minutes: 30 + 45,
// )),
// homeworkId: 'homeworkId',
// id: 'id',
// description: 'description',
// room: 'ABC69',
// groupName: 'groupName',
// name: 'name',
// );
final dt = DateTime(2024, 3, 22, 17, 12, 1, 1, 1); final dt = DateTime(2024, 3, 22, 17, 12, 1, 1, 1);
@ -161,19 +186,29 @@ class LiveCardStateA extends State<LiveCard> {
// ), // ),
// ) // )
// : null, // : null,
children: liveCard.nextLesson == null children: liveCard.nextLesson != null
? [ ? [
SplittedPanel( SplittedPanel(
hasShadow: false, hasShadow: false,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
cardPadding: const EdgeInsets.all(18.0), cardPadding: EdgeInsets.zero,
spacing: 8.0, spacing: 8.0,
children: [
SplittedPanel(
hasShadow: false,
isTransparent: true,
padding: EdgeInsets.zero,
cardPadding: const EdgeInsets.symmetric(
horizontal: 18.0,
vertical: 16.0,
),
spacing: 0.0,
children: [ children: [
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
'Hamarosan kezdődik az első órád!'.i18n, 'first_lesson_soon'.i18n,
style: const TextStyle( style: const TextStyle(
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 16.0, fontSize: 16.0,
@ -185,6 +220,18 @@ class LiveCardStateA extends State<LiveCard> {
SegmentedCountdown(date: dt) SegmentedCountdown(date: dt)
], ],
), ),
],
),
SplittedPanel(
hasShadow: false,
isTransparent: true,
padding: EdgeInsets.zero,
cardPadding: const EdgeInsets.symmetric(
horizontal: 18.0,
vertical: 14.0,
),
spacing: 0.0,
children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
@ -193,13 +240,18 @@ class LiveCardStateA extends State<LiveCard> {
Icon( Icon(
SubjectIcon.resolveVariant( SubjectIcon.resolveVariant(
context: context, context: context,
subjectName: 'matekgeci', subject: liveCard.nextLesson!.subject,
), ),
), ),
const SizedBox(width: 12.0), const SizedBox(width: 12.0),
Text( Text(
'matekfasz', (liveCard.nextLesson!.subject.isRenamed
style: TextStyle( ? liveCard
.nextLesson!.subject.renamedTo
: liveCard
.nextLesson!.subject.name) ??
'',
style: const TextStyle(
fontSize: 16.0, fontSize: 16.0,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
@ -208,10 +260,40 @@ class LiveCardStateA extends State<LiveCard> {
), ),
Row( Row(
children: [ children: [
Text( Container(
'8:00-8:45', width: liveCard.nextLesson!.room.length > 20
? 111
: null,
padding: const EdgeInsets.symmetric(
horizontal: 6.0, vertical: 3.5),
decoration: BoxDecoration(
color: Theme.of(context)
.colorScheme
.secondary
.withOpacity(.15),
borderRadius: BorderRadius.circular(10.0),
),
child: Text(
liveCard.nextLesson!.room,
overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
fontSize: 12.0, height: 1.1,
fontSize: 12.5,
fontWeight: FontWeight.w600,
color: Theme.of(context)
.colorScheme
.secondary
.withOpacity(.9),
),
),
),
const SizedBox(
width: 10,
),
Text(
'${DateFormat('H:mm').format(liveCard.nextLesson!.start)}-${DateFormat('H:mm').format(liveCard.nextLesson!.end)}',
style: const TextStyle(
fontSize: 12.5,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
), ),
), ),
@ -221,6 +303,8 @@ class LiveCardStateA extends State<LiveCard> {
), ),
], ],
), ),
],
),
] ]
: null, : null,
); );

View File

@ -21,6 +21,8 @@ extension Localization on String {
"h": "hour(s)", "h": "hour(s)",
"m": "minute(s)", "m": "minute(s)",
"s": "sec(s)", "s": "sec(s)",
// v5
"first_lesson_soon": "Your first lesson starts soon!",
}, },
"hu_hu": { "hu_hu": {
"next": "Következő", "next": "Következő",
@ -40,6 +42,8 @@ extension Localization on String {
"h": "óra", "h": "óra",
"m": "perc", "m": "perc",
"s": "másodperc", "s": "másodperc",
// v5
"first_lesson_soon": "Hamarosan kezdődik az első órád!",
}, },
"de_de": { "de_de": {
"next": "Nächste", "next": "Nächste",
@ -56,9 +60,11 @@ extension Localization on String {
"first_lesson_3": ", um ", "first_lesson_3": ", um ",
"first_lesson_4": " Uhr.", "first_lesson_4": " Uhr.",
// segmented countdown // segmented countdown
"h": "óra", "h": "Stunden",
"m": "perc", "m": "Minute",
"s": "másodperc", "s": "Sekunde",
// v5
"first_lesson_soon": "Ihre erste Unterrichtsstunde beginnt bald!",
}, },
}; };