From d6179dcd8a73ff0ff601b6c523d6cb82eec43ff6 Mon Sep 17 00:00:00 2001 From: zypherift Date: Sun, 10 Aug 2025 21:33:31 +0200 Subject: [PATCH] update rounding --- firka/lib/helpers/ui/firka_card.dart | 32 ++++++++++++++++++- firka/lib/l10n | 2 +- firka/lib/ui/phone/pages/home/home_main.dart | 5 ++- .../widgets/home_main_starting_soon.dart | 1 + firka/lib/ui/phone/widgets/lesson_small.dart | 4 ++- 5 files changed, 40 insertions(+), 4 deletions(-) diff --git a/firka/lib/helpers/ui/firka_card.dart b/firka/lib/helpers/ui/firka_card.dart index e27c867..506de96 100644 --- a/firka/lib/helpers/ui/firka_card.dart +++ b/firka/lib/helpers/ui/firka_card.dart @@ -2,22 +2,41 @@ import 'package:flutter/material.dart'; import '../../ui/model/style.dart'; +enum Attach { none, bottom, top } + class FirkaCard extends StatelessWidget { final List left; final List? right; final Widget? extra; + final Attach? attached; - const FirkaCard({required this.left, this.right, this.extra, super.key}); + const FirkaCard( + {required this.left, this.right, this.extra, this.attached, super.key}); @override Widget build(BuildContext context) { var right = this.right ?? []; + var _attached = attached != null ? attached! : Attach.none; + final defaultRounding = 16.0; + final attachedRounding = 8.0; + if (extra != null) { return SizedBox( width: MediaQuery.of(context).size.width, child: Card( color: appStyle.colors.card, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topLeft: Radius.circular( + _attached == Attach.top ? attachedRounding : defaultRounding), + topRight: Radius.circular( + _attached == Attach.top ? attachedRounding : defaultRounding), + bottomLeft: Radius.circular( + _attached == Attach.bottom ? attachedRounding : defaultRounding), + bottomRight: Radius.circular( + _attached == Attach.bottom ? attachedRounding : defaultRounding)), + ), child: Padding( padding: const EdgeInsets.all(16.0), child: Column( @@ -40,6 +59,17 @@ class FirkaCard extends StatelessWidget { width: MediaQuery.of(context).size.width, child: Card( color: appStyle.colors.card, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topLeft: Radius.circular( + _attached == Attach.top ? attachedRounding : defaultRounding), + topRight: Radius.circular( + _attached == Attach.top ? attachedRounding : defaultRounding), + bottomLeft: Radius.circular( + _attached == Attach.bottom ? attachedRounding : defaultRounding), + bottomRight: Radius.circular( + _attached == Attach.bottom ? attachedRounding : defaultRounding)), + ), child: Padding( padding: const EdgeInsets.all(16.0), child: Row( diff --git a/firka/lib/l10n b/firka/lib/l10n index d99d54e..19ff812 160000 --- a/firka/lib/l10n +++ b/firka/lib/l10n @@ -1 +1 @@ -Subproject commit d99d54e92b721b9ec43ef85365816c4178bf5a0d +Subproject commit 19ff81234a8428d9c87a8a83e4eb9987639806fd diff --git a/firka/lib/ui/phone/pages/home/home_main.dart b/firka/lib/ui/phone/pages/home/home_main.dart index 4290965..446f7c2 100644 --- a/firka/lib/ui/phone/pages/home/home_main.dart +++ b/firka/lib/ui/phone/pages/home/home_main.dart @@ -77,6 +77,7 @@ class _HomeMainScreen extends State { Widget build(BuildContext context) { Widget welcomeWidget = SizedBox(); Widget nextClass = SizedBox(); + bool lessonActive = false; if (lessons != null && lessons!.isNotEmpty) { if (now.isBefore(lessons!.first.start)) { @@ -93,6 +94,7 @@ class _HomeMainScreen extends State { if (currentLesson != null) { lessonIndex = lessons!.getLessonNo(currentLesson); + lessonActive = true; } welcomeWidget = LessonBigWidget( @@ -101,7 +103,7 @@ class _HomeMainScreen extends State { } if (lessons != null && lessons!.isNotEmpty) { var nextLesson = lessons!.getNextLesson(now); - if (nextLesson != null) nextClass = LessonSmallWidget(nextLesson); + if (nextLesson != null) nextClass = LessonSmallWidget(nextLesson, lessonActive); } if (student != null && lessons != null) { @@ -118,6 +120,7 @@ class _HomeMainScreen extends State { WelcomeWidget(now, student!, lessons!), SizedBox(height: 48), welcomeWidget, + lessonActive ? SizedBox(height: 5) : SizedBox(height: 0), nextClass ], ), diff --git a/firka/lib/ui/phone/widgets/home_main_starting_soon.dart b/firka/lib/ui/phone/widgets/home_main_starting_soon.dart index 585d3d1..21ab627 100644 --- a/firka/lib/ui/phone/widgets/home_main_starting_soon.dart +++ b/firka/lib/ui/phone/widgets/home_main_starting_soon.dart @@ -33,6 +33,7 @@ class StartingSoonWidget extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.center, children: [ FirkaCard( + attached: Attach.bottom, left: [ Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/firka/lib/ui/phone/widgets/lesson_small.dart b/firka/lib/ui/phone/widgets/lesson_small.dart index 2e16ec2..e4bad7a 100644 --- a/firka/lib/ui/phone/widgets/lesson_small.dart +++ b/firka/lib/ui/phone/widgets/lesson_small.dart @@ -8,8 +8,9 @@ import '../../widget/class_icon.dart'; class LessonSmallWidget extends StatelessWidget { final Lesson lesson; + final bool lessonActive; - const LessonSmallWidget(this.lesson, {super.key}); + const LessonSmallWidget(this.lesson, this.lessonActive, {super.key}); @override Widget build(BuildContext context) { @@ -17,6 +18,7 @@ class LessonSmallWidget extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.center, children: [ FirkaCard( + attached: lessonActive ? Attach.none : Attach.top, left: [ ClassIconWidget( color: wearStyle.colors.accent,