fixed lot of ui things

This commit is contained in:
Kima
2023-07-31 23:20:30 +02:00
parent d79045e47f
commit 5523a2a919
22 changed files with 1812 additions and 750 deletions

View File

@@ -8,7 +8,9 @@ import 'package:flutter/material.dart';
import 'absence_group_tile.i18n.dart';
class AbsenceGroupTile extends StatelessWidget {
const AbsenceGroupTile(this.absences, {Key? key, this.showDate = false, this.padding}) : super(key: key);
const AbsenceGroupTile(this.absences,
{Key? key, this.showDate = false, this.padding})
: super(key: key);
final List<AbsenceViewable> absences;
final bool showDate;
@@ -16,10 +18,12 @@ class AbsenceGroupTile extends StatelessWidget {
@override
Widget build(BuildContext context) {
Justification state = getState(absences.map((e) => e.absence.state).toList());
Justification state =
getState(absences.map((e) => e.absence.state).toList());
Color color = AbsenceTile.justificationColor(state, context: context);
absences.sort((a, b) => a.absence.lessonIndex?.compareTo(b.absence.lessonIndex ?? 0) ?? -1);
absences.sort((a, b) =>
a.absence.lessonIndex?.compareTo(b.absence.lessonIndex ?? 0) ?? -1);
return ClipRRect(
borderRadius: BorderRadius.circular(14.0),
@@ -29,6 +33,8 @@ class AbsenceGroupTile extends StatelessWidget {
padding: padding ?? const EdgeInsets.symmetric(horizontal: 8.0),
child: AbsenceGroupContainer(
child: ExpansionTile(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10)),
tilePadding: const EdgeInsets.symmetric(horizontal: 8.0),
backgroundColor: Colors.transparent,
leading: Container(
@@ -38,22 +44,33 @@ class AbsenceGroupTile extends StatelessWidget {
shape: BoxShape.circle,
color: color.withOpacity(.25),
),
child: Center(child: Icon(AbsenceTile.justificationIcon(state), color: color)),
child: Center(
child: Icon(AbsenceTile.justificationIcon(state),
color: color)),
),
title: Text.rich(TextSpan(
text: "${absences.where((a) => a.absence.state == state).length} ",
style: TextStyle(fontWeight: FontWeight.w700, color: AppColors.of(context).text),
text:
"${absences.where((a) => a.absence.state == state).length} ",
style: TextStyle(
fontWeight: FontWeight.w700,
color: AppColors.of(context).text),
children: [
TextSpan(
text: AbsenceTile.justificationName(state).fill(["absence".i18n]),
style: TextStyle(fontWeight: FontWeight.w600, color: AppColors.of(context).text),
text: AbsenceTile.justificationName(state)
.fill(["absence".i18n]),
style: TextStyle(
fontWeight: FontWeight.w600,
color: AppColors.of(context).text),
),
],
)),
subtitle: showDate
? Text(
absences.first.absence.date.format(context, weekday: true),
style: TextStyle(fontWeight: FontWeight.w500, color: AppColors.of(context).text.withOpacity(0.8)),
absences.first.absence.date
.format(context, weekday: true),
style: TextStyle(
fontWeight: FontWeight.w500,
color: AppColors.of(context).text.withOpacity(0.8)),
)
: null,
children: absences,