timetable fixes

This commit is contained in:
Kima 2024-01-02 22:07:54 +01:00
parent 5f49633867
commit ec5880290a
2 changed files with 149 additions and 69 deletions

View File

@ -125,9 +125,9 @@ class LessonTile extends StatelessWidget {
// }
return Padding(
padding: const EdgeInsets.only(bottom: 2.0),
padding: const EdgeInsets.only(bottom: 4.0, top: 7.0),
child: Material(
color: fill ? accent.withOpacity(.25) : Colors.transparent,
color: Colors.transparent,
borderRadius: BorderRadius.circular(12.0),
child: Visibility(
visible: lesson.subject.id != '' || lesson.isEmpty,
@ -141,7 +141,7 @@ class LessonTile extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
ListTile(
minVerticalPadding: 12.0,
minVerticalPadding: cleanDesc == '' ? 12.0 : 0.0,
dense: true,
onTap: onTap,
// onLongPress: kDebugMode ? () => log(jsonEncode(lesson.json)) : null,
@ -159,7 +159,9 @@ class LessonTile extends StatelessWidget {
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 16.5,
color: AppColors.of(context)
color: fill
? accent
: AppColors.of(context)
.text
.withOpacity(!lesson.isEmpty ? 1.0 : 0.5),
fontStyle: lesson.subject.isRenamed &&
@ -170,42 +172,47 @@ class LessonTile extends StatelessWidget {
subtitle: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
padding: const EdgeInsets.symmetric(
horizontal: 6.0, vertical: 3.5),
decoration: BoxDecoration(
color: Theme.of(context)
.colorScheme
.secondary
.withOpacity(.15),
borderRadius: BorderRadius.circular(10.0),
),
child: Text(
lesson.room,
style: TextStyle(
height: 1.1,
fontSize: 12.5,
fontWeight: FontWeight.w600,
color: Theme.of(context)
.colorScheme
.secondary
.withOpacity(.9),
),
),
)
],
),
const SizedBox(
height: 10.0,
),
// Row(
// children: [
// Container(
// padding: const EdgeInsets.symmetric(
// horizontal: 6.0, vertical: 3.5),
// decoration: BoxDecoration(
// color: Theme.of(context)
// .colorScheme
// .secondary
// .withOpacity(.15),
// borderRadius: BorderRadius.circular(10.0),
// ),
// child: Text(
// lesson.room,
// style: TextStyle(
// height: 1.1,
// fontSize: 12.5,
// fontWeight: FontWeight.w600,
// color: Theme.of(context)
// .colorScheme
// .secondary
// .withOpacity(.9),
// ),
// ),
// )
// ],
// ),
// if (cleanDesc != '')
// const SizedBox(
// height: 10.0,
// ),
if (cleanDesc != '')
Text(
cleanDesc,
maxLines: 1,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.start,
style: const TextStyle(fontSize: 14.0),
style: TextStyle(
fontSize: 14.0,
color: fill ? accent.withOpacity(0.5) : null,
),
),
],
),
@ -229,6 +236,7 @@ class LessonTile extends StatelessWidget {
child: Stack(
children: [
RoundBorderIcon(
color: fill ? accent : Colors.black,
width: 1.0,
icon: SizedBox(
width: 25,
@ -239,9 +247,10 @@ class LessonTile extends StatelessWidget {
child: Text(
lesson.lessonIndex + lessonIndexTrailing,
textAlign: TextAlign.center,
style: const TextStyle(
style: TextStyle(
fontSize: 17.5,
fontWeight: FontWeight.w700,
color: fill ? accent : null,
),
),
),
@ -313,17 +322,49 @@ class LessonTile extends StatelessWidget {
// ),
// ),
// ),
Container(
padding: const EdgeInsets.symmetric(
horizontal: 6.0, vertical: 3.5),
decoration: BoxDecoration(
color: fill
? accent.withOpacity(.15)
: Theme.of(context)
.colorScheme
.secondary
.withOpacity(.15),
borderRadius: BorderRadius.circular(10.0),
),
child: Text(
lesson.room,
style: TextStyle(
height: 1.1,
fontSize: 12.5,
fontWeight: FontWeight.w600,
color: fill
? accent.withOpacity(0.9)
: Theme.of(context)
.colorScheme
.secondary
.withOpacity(.9),
),
),
),
const SizedBox(
width: 10,
),
Stack(
alignment: Alignment.center,
children: [
// Fix alignment hack
// xix alignment hack :p
const Opacity(opacity: 0, child: Text("EE:EE")),
Text(
"${DateFormat("H:mm").format(lesson.start)}\n${DateFormat("H:mm").format(lesson.end)}",
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.w500,
color: AppColors.of(context)
color: fill
? accent.withOpacity(.9)
: AppColors.of(context)
.text
.withOpacity(.9),
),

View File

@ -1,6 +1,7 @@
import 'dart:math';
import 'package:animations/animations.dart';
import 'package:filcnaplo/api/providers/update_provider.dart';
import 'package:filcnaplo/utils/format.dart';
import 'package:filcnaplo_kreta_api/client/client.dart';
import 'package:filcnaplo_kreta_api/models/week.dart';
import 'package:filcnaplo_kreta_api/providers/timetable_provider.dart';
@ -540,14 +541,16 @@ class TimetablePageState extends State<TimetablePage>
Padding(
padding: EdgeInsets.only(
top:
index == 0 ? 0.0 : 12.0,
index == 0 ? 5.0 : 12.0,
left: 24,
right: 24),
right: 24,
bottom: index + 1 == len
? 20.0
: 0),
child: Container(
padding: const EdgeInsets
.symmetric(
vertical: 4.0,
horizontal: 10.0),
horizontal: 6.0),
decoration: BoxDecoration(
color: Theme.of(context)
.colorScheme
@ -618,30 +621,41 @@ class TimetablePageState extends State<TimetablePage>
controller: _tabController,
// Label
labelPadding: EdgeInsets.zero,
labelColor: Theme.of(context).colorScheme.secondary,
unselectedLabelColor:
labelColor:
AppColors.of(context).text.withOpacity(0.9),
// Indicator
indicatorSize: TabBarIndicatorSize.tab,
indicatorPadding: EdgeInsets.zero,
indicator: BoxDecoration(
color: Theme.of(context)
unselectedLabelColor: Theme.of(context)
.colorScheme
.secondary
.withOpacity(0.25),
borderRadius: BorderRadius.circular(45.0),
.withOpacity(0.25)
.withAlpha(100),
// Indicator
indicatorSize: TabBarIndicatorSize.tab,
indicatorPadding:
const EdgeInsets.symmetric(horizontal: 10.0),
indicator: BoxDecoration(
color: Colors.transparent,
border: Border.all(
color: AppColors.of(context)
.text
.withOpacity(0.90)),
// color: Theme.of(context)
// .colorScheme
// .secondary
// .withOpacity(0.25),
borderRadius: BorderRadius.circular(16.0),
),
overlayColor: MaterialStateProperty.all(
const Color(0x00000000)),
// Tabs
padding: const EdgeInsets.symmetric(
vertical: 6.0, horizontal: 8.0),
vertical: 6.0, horizontal: 38.0),
tabs: List.generate(_tabController.length, (index) {
String label = DateFormat(
"E", I18n.of(context).locale.languageCode)
.format(_controller.days![index].first.date);
String label = DateFormat("EEEE",
I18n.of(context).locale.languageCode)
.format(_controller.days![index].first.date)
.capital();
return Tab(
height: 46.0,
height: 56.0,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
@ -649,18 +663,43 @@ class TimetablePageState extends State<TimetablePage>
_controller.days![index].first.date,
DateTime.now()))
Padding(
padding: const EdgeInsets.only(top: 4.0),
padding: const EdgeInsets.only(top: 0.0),
child: Dot(
size: 4.0,
color: Theme.of(context)
.colorScheme
.secondary),
.secondary
.withOpacity(0.25)
.withAlpha(100)),
),
Text(
label.substring(0, min(2, label.length)),
style: const TextStyle(
fontSize: 26.0,
fontWeight: FontWeight.w600),
fontSize: 22.0,
fontWeight: FontWeight.w600,
height: 1.1,
),
),
SizedBox(
height: _sameDate(
_controller.days![index].first.date,
DateTime.now())
? 0.0
: 3.0,
),
Text(
_controller.days![index].first.date.day
.toString(),
style: TextStyle(
height: 1.0,
fontWeight: FontWeight.w600,
fontSize: 17.0,
color: Theme.of(context)
.colorScheme
.secondary
.withOpacity(0.25)
.withAlpha(100),
),
),
],
),