added rounded expansion tile (fixed absence bug)
This commit is contained in:
@@ -9,7 +9,9 @@ import 'package:provider/provider.dart';
|
||||
import 'absence_tile.i18n.dart';
|
||||
|
||||
class AbsenceTile extends StatelessWidget {
|
||||
const AbsenceTile(this.absence, {Key? key, this.onTap, this.elevation = 0.0, this.padding}) : super(key: key);
|
||||
const AbsenceTile(this.absence,
|
||||
{Key? key, this.onTap, this.elevation = 0.0, this.padding})
|
||||
: super(key: key);
|
||||
|
||||
final Absence absence;
|
||||
final void Function()? onTap;
|
||||
@@ -37,39 +39,61 @@ class AbsenceTile extends StatelessWidget {
|
||||
child: Material(
|
||||
type: MaterialType.transparency,
|
||||
child: Padding(
|
||||
padding: padding ?? (group ? EdgeInsets.zero : const EdgeInsets.symmetric(horizontal: 8.0)),
|
||||
padding: padding ??
|
||||
(group
|
||||
? EdgeInsets.zero
|
||||
: const EdgeInsets.symmetric(
|
||||
horizontal: 8.0,
|
||||
)),
|
||||
child: ListTile(
|
||||
onTap: onTap,
|
||||
visualDensity: VisualDensity.compact,
|
||||
dense: group,
|
||||
contentPadding: const EdgeInsets.only(left: 8.0, right: 12.0),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(!group ? 14.0 : 12.0)),
|
||||
contentPadding: const EdgeInsets.only(
|
||||
left: 14.0, right: 12.0, top: 2.0, bottom: 2.0),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(!group ? 14.0 : 12.0)),
|
||||
leading: Container(
|
||||
width: 44.0,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: !group ? color.withOpacity(.25) : null,
|
||||
),
|
||||
child: Center(child: Icon(justificationIcon(absence.state), color: color)),
|
||||
child: Center(
|
||||
child: Icon(justificationIcon(absence.state), color: color)),
|
||||
),
|
||||
title: !group
|
||||
? Text.rich(TextSpan(
|
||||
text: "${absence.delay == 0 ? "" : absence.delay}",
|
||||
style: const TextStyle(fontWeight: FontWeight.w700, fontSize: 15.5),
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w700, fontSize: 15.5),
|
||||
children: [
|
||||
TextSpan(
|
||||
text: absence.delay == 0
|
||||
? justificationName(absence.state).fill(["absence".i18n]).capital()
|
||||
: 'minute'.plural(absence.delay) + justificationName(absence.state).fill(["delay".i18n]),
|
||||
? justificationName(absence.state)
|
||||
.fill(["absence".i18n]).capital()
|
||||
: 'minute'.plural(absence.delay) +
|
||||
justificationName(absence.state)
|
||||
.fill(["delay".i18n]),
|
||||
style: const TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
],
|
||||
))
|
||||
: Text(
|
||||
(absence.lessonIndex != null ? "${absence.lessonIndex}. " : "") + (absence.subject.renamedTo ?? absence.subject.name.capital()),
|
||||
(absence.lessonIndex != null
|
||||
? "${absence.lessonIndex}. "
|
||||
: "") +
|
||||
(absence.subject.renamedTo ??
|
||||
absence.subject.name.capital()),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(fontWeight: FontWeight.w500, fontSize: 14.0, fontStyle: absence.subject.isRenamed && settingsProvider.renamedSubjectsItalics ? FontStyle.italic : null),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 14.0,
|
||||
fontStyle: absence.subject.isRenamed &&
|
||||
settingsProvider.renamedSubjectsItalics
|
||||
? FontStyle.italic
|
||||
: null),
|
||||
),
|
||||
subtitle: !group
|
||||
? Text(
|
||||
@@ -77,7 +101,12 @@ class AbsenceTile extends StatelessWidget {
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
// DateFormat("MM. dd. (EEEEE)", I18n.of(context).locale.toString()).format(absence.date),
|
||||
style: TextStyle(fontWeight: FontWeight.w500, fontStyle: absence.subject.isRenamed && settingsProvider.renamedSubjectsItalics ? FontStyle.italic : null),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w500,
|
||||
fontStyle: absence.subject.isRenamed &&
|
||||
settingsProvider.renamedSubjectsItalics
|
||||
? FontStyle.italic
|
||||
: null),
|
||||
)
|
||||
: null,
|
||||
),
|
||||
@@ -97,7 +126,8 @@ class AbsenceTile extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
static Color justificationColor(Justification state, {required BuildContext context}) {
|
||||
static Color justificationColor(Justification state,
|
||||
{required BuildContext context}) {
|
||||
switch (state) {
|
||||
case Justification.excused:
|
||||
return AppColors.of(context).green;
|
||||
|
||||
@@ -5,6 +5,8 @@ import 'package:filcnaplo_mobile_ui/common/widgets/absence_group/absence_group_c
|
||||
import 'package:filcnaplo_mobile_ui/common/widgets/absence/absence_tile.dart';
|
||||
import 'package:filcnaplo/utils/format.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
|
||||
import 'package:rounded_expansion_tile/rounded_expansion_tile.dart';
|
||||
import 'absence_group_tile.i18n.dart';
|
||||
|
||||
class AbsenceGroupTile extends StatelessWidget {
|
||||
@@ -30,13 +32,17 @@ class AbsenceGroupTile extends StatelessWidget {
|
||||
child: Material(
|
||||
type: MaterialType.transparency,
|
||||
child: Padding(
|
||||
padding: padding ?? const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
padding: padding ??
|
||||
const EdgeInsets.symmetric(horizontal: 0.0, vertical: 0.0),
|
||||
child: AbsenceGroupContainer(
|
||||
child: ExpansionTile(
|
||||
child: RoundedExpansionTile(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10)),
|
||||
tilePadding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
backgroundColor: Colors.transparent,
|
||||
childrenPadding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
tileColor: Colors.transparent,
|
||||
duration: const Duration(milliseconds: 250),
|
||||
trailingDuration: 0.5,
|
||||
trailing: const Icon(FeatherIcons.chevronDown),
|
||||
leading: Container(
|
||||
width: 44.0,
|
||||
height: 44.0,
|
||||
|
||||
Reference in New Issue
Block a user