forked from firka/student-legacy
finished new absences page
This commit is contained in:
parent
f0b9dfa1e6
commit
c0589cba5c
@ -32,7 +32,7 @@ class AbsenceDisplay extends StatelessWidget {
|
|||||||
if (excused > 0 && pending > 0) const SizedBox(width: 6.0),
|
if (excused > 0 && pending > 0) const SizedBox(width: 6.0),
|
||||||
if (pending > 0)
|
if (pending > 0)
|
||||||
Icon(
|
Icon(
|
||||||
FeatherIcons.slash,
|
Icons.hourglass_bottom,
|
||||||
size: 14.0,
|
size: 14.0,
|
||||||
color: AppColors.of(context).orange,
|
color: AppColors.of(context).orange,
|
||||||
),
|
),
|
||||||
|
@ -3,18 +3,21 @@ import 'package:refilc/models/settings.dart';
|
|||||||
import 'package:refilc/theme/colors/colors.dart';
|
import 'package:refilc/theme/colors/colors.dart';
|
||||||
import 'package:refilc/utils/format.dart';
|
import 'package:refilc/utils/format.dart';
|
||||||
import 'package:refilc_kreta_api/models/subject.dart';
|
import 'package:refilc_kreta_api/models/subject.dart';
|
||||||
|
import 'package:refilc_mobile_ui/common/round_border_icon.dart';
|
||||||
import 'package:refilc_mobile_ui/common/widgets/absence/absence_display.dart';
|
import 'package:refilc_mobile_ui/common/widgets/absence/absence_display.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class AbsenceSubjectTile extends StatelessWidget {
|
class AbsenceSubjectTile extends StatelessWidget {
|
||||||
const AbsenceSubjectTile(this.subject,
|
const AbsenceSubjectTile(
|
||||||
{super.key,
|
this.subject, {
|
||||||
|
super.key,
|
||||||
this.percentage = 0.0,
|
this.percentage = 0.0,
|
||||||
this.excused = 0,
|
this.excused = 0,
|
||||||
this.unexcused = 0,
|
this.unexcused = 0,
|
||||||
this.pending = 0,
|
this.pending = 0,
|
||||||
this.onTap});
|
this.onTap,
|
||||||
|
});
|
||||||
|
|
||||||
final GradeSubject subject;
|
final GradeSubject subject;
|
||||||
final void Function()? onTap;
|
final void Function()? onTap;
|
||||||
@ -28,17 +31,25 @@ class AbsenceSubjectTile extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SettingsProvider settingsProvider = Provider.of<SettingsProvider>(context);
|
SettingsProvider settingsProvider = Provider.of<SettingsProvider>(context);
|
||||||
return Material(
|
return Material(
|
||||||
type: MaterialType.transparency,
|
type: MaterialType.card,
|
||||||
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16.0)),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(4.0),
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
// minLeadingWidth: 32.0,
|
// minLeadingWidth: 32.0,
|
||||||
dense: true,
|
dense: true,
|
||||||
contentPadding: const EdgeInsets.only(left: 8.0, right: 6.0),
|
contentPadding: const EdgeInsets.only(left: 12.0, right: 12.0),
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.0)),
|
shape:
|
||||||
|
RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)),
|
||||||
visualDensity: VisualDensity.compact,
|
visualDensity: VisualDensity.compact,
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
leading: Icon(
|
leading: RoundBorderIcon(
|
||||||
|
padding: 8.0,
|
||||||
|
icon: Icon(
|
||||||
SubjectIcon.resolveVariant(subject: subject, context: context),
|
SubjectIcon.resolveVariant(subject: subject, context: context),
|
||||||
size: 32.0),
|
size: 20.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
title: Text(
|
title: Text(
|
||||||
subject.renamedTo ?? subject.name.capital(),
|
subject.renamedTo ?? subject.name.capital(),
|
||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
@ -68,9 +79,11 @@ class AbsenceSubjectTile extends StatelessWidget {
|
|||||||
"${percentage.round()}%",
|
"${percentage.round()}%",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
// fontFamily: "monospace",
|
// fontFamily: "monospace",
|
||||||
color: getColorByPercentage(percentage, context: context),
|
color:
|
||||||
fontWeight: FontWeight.w700,
|
getColorByPercentage(percentage, context: context)
|
||||||
fontSize: 24.0,
|
.withOpacity(0.8),
|
||||||
|
fontSize: 16.0,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -78,6 +91,7 @@ class AbsenceSubjectTile extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ class AbsenceTile extends StatelessWidget {
|
|||||||
case Justification.excused:
|
case Justification.excused:
|
||||||
return FeatherIcons.check;
|
return FeatherIcons.check;
|
||||||
case Justification.pending:
|
case Justification.pending:
|
||||||
return FeatherIcons.slash;
|
return Icons.hourglass_bottom;
|
||||||
case Justification.unexcused:
|
case Justification.unexcused:
|
||||||
return FeatherIcons.x;
|
return FeatherIcons.x;
|
||||||
}
|
}
|
||||||
|
@ -276,6 +276,9 @@ class AbsencesPageState extends State<AbsencesPage>
|
|||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 24.0),
|
padding: const EdgeInsets.only(bottom: 24.0),
|
||||||
child: Panel(
|
child: Panel(
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
|
isTransparent: true,
|
||||||
|
hasShadow: false,
|
||||||
title: Row(
|
title: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
@ -318,11 +321,14 @@ class AbsencesPageState extends State<AbsencesPage>
|
|||||||
return FadeThroughTransition(
|
return FadeThroughTransition(
|
||||||
animation: primaryAnimation,
|
animation: primaryAnimation,
|
||||||
secondaryAnimation: secondaryAnimation,
|
secondaryAnimation: secondaryAnimation,
|
||||||
fillColor: Theme.of(context).colorScheme.background,
|
fillColor: Colors.transparent,
|
||||||
child: child,
|
child: child,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Column(
|
child: SplittedPanel(
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
|
isSeparated: true,
|
||||||
|
isTransparent: true,
|
||||||
children: absWidgets,
|
children: absWidgets,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user