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

View File

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