update rounding

This commit is contained in:
zypherift
2025-08-10 21:33:31 +02:00
committed by Armand
parent c5715a86ca
commit d6179dcd8a
5 changed files with 40 additions and 4 deletions

View File

@@ -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<Widget> left;
final List<Widget>? 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(

View File

@@ -77,6 +77,7 @@ class _HomeMainScreen extends State<HomeMainScreen> {
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<HomeMainScreen> {
if (currentLesson != null) {
lessonIndex = lessons!.getLessonNo(currentLesson);
lessonActive = true;
}
welcomeWidget = LessonBigWidget(
@@ -101,7 +103,7 @@ class _HomeMainScreen extends State<HomeMainScreen> {
}
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<HomeMainScreen> {
WelcomeWidget(now, student!, lessons!),
SizedBox(height: 48),
welcomeWidget,
lessonActive ? SizedBox(height: 5) : SizedBox(height: 0),
nextClass
],
),

View File

@@ -33,6 +33,7 @@ class StartingSoonWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
FirkaCard(
attached: Attach.bottom,
left: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,

View File

@@ -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,