forked from firka/student-legacy
I think I fixed this
This commit is contained in:
parent
d6833a952d
commit
526c66f358
@ -27,7 +27,6 @@ class _PremiumFSTimetableState extends State<PremiumFSTimetable> {
|
|||||||
|
|
||||||
SystemChrome.setPreferredOrientations([
|
SystemChrome.setPreferredOrientations([
|
||||||
DeviceOrientation.landscapeLeft,
|
DeviceOrientation.landscapeLeft,
|
||||||
DeviceOrientation.landscapeRight,
|
|
||||||
]);
|
]);
|
||||||
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive);
|
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive);
|
||||||
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
|
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
|
||||||
@ -51,10 +50,6 @@ class _PremiumFSTimetableState extends State<PremiumFSTimetable> {
|
|||||||
(a, b) => math.max(
|
(a, b) => math.max(
|
||||||
a, b.where((l) => l.subject.id != "" || l.isEmpty).length));
|
a, b.where((l) => l.subject.id != "" || l.isEmpty).length));
|
||||||
|
|
||||||
final int minIndex = int.tryParse(everyLesson.first.lessonIndex) ?? 0;
|
|
||||||
final int maxIndex =
|
|
||||||
int.tryParse(everyLesson.last.lessonIndex) ?? maxLessonCount;
|
|
||||||
|
|
||||||
const prefixw = 40;
|
const prefixw = 40;
|
||||||
const padding = prefixw + 6 * 2;
|
const padding = prefixw + 6 * 2;
|
||||||
final colw = (MediaQuery.of(context).size.width - padding) / days.length;
|
final colw = (MediaQuery.of(context).size.width - padding) / days.length;
|
||||||
@ -68,26 +63,19 @@ class _PremiumFSTimetableState extends State<PremiumFSTimetable> {
|
|||||||
body: ListView.builder(
|
body: ListView.builder(
|
||||||
physics: const BouncingScrollPhysics(),
|
physics: const BouncingScrollPhysics(),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 6.0, vertical: 24.0),
|
padding: const EdgeInsets.symmetric(horizontal: 6.0, vertical: 24.0),
|
||||||
itemCount: maxIndex + 1,
|
itemCount: maxLessonCount + 1,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
List<Widget> columns = [];
|
List<Widget> columns = [];
|
||||||
|
|
||||||
for (int dayIndex = -1; dayIndex < days.length; dayIndex++) {
|
for (int dayIndex = -1; dayIndex < days.length; dayIndex++) {
|
||||||
final dayOffset = dayIndex == -1
|
|
||||||
? 0
|
|
||||||
: (int.tryParse(days[dayIndex].first.lessonIndex) ?? 0) -
|
|
||||||
minIndex;
|
|
||||||
final lessonIndex = index - 1;
|
|
||||||
|
|
||||||
if (dayIndex == -1) {
|
if (dayIndex == -1) {
|
||||||
if (lessonIndex >= 0) {
|
if (index >= 1) {
|
||||||
columns.add(SizedBox(
|
columns.add(SizedBox(
|
||||||
width: prefixw.toDouble(),
|
width: prefixw.toDouble(),
|
||||||
height: 40.0,
|
height: 40.0,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
"${minIndex + lessonIndex}.",
|
(index).toString()+".",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
color: Theme.of(context).colorScheme.secondary),
|
color: Theme.of(context).colorScheme.secondary),
|
||||||
@ -105,104 +93,112 @@ class _PremiumFSTimetableState extends State<PremiumFSTimetable> {
|
|||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
if (lessons.isEmpty) continue;
|
if (lessons.isEmpty) continue;
|
||||||
if (lessonIndex >= lessons.length) continue;
|
|
||||||
|
|
||||||
if (dayIndex >= days.length ||
|
final dayOffset = int.tryParse(lessons.first.lessonIndex) ?? 0;
|
||||||
(lessonIndex + dayOffset) >= lessons.length) {
|
|
||||||
columns.add(SizedBox(width: colw));
|
if (index == 0 && dayIndex >= 0) {
|
||||||
|
columns.add(
|
||||||
|
SizedBox(
|
||||||
|
width: colw,
|
||||||
|
height: 40.0,
|
||||||
|
child: Text(
|
||||||
|
DateFormat("EEEE", I18n.of(context).locale.languageCode)
|
||||||
|
.format(lessons.first.date)
|
||||||
|
.capital(),
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 24.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lessonIndex == -1 && dayIndex >= 0) {
|
final lessonIndex = index - dayOffset;
|
||||||
columns.add(SizedBox(
|
|
||||||
width: colw,
|
if (lessonIndex < 0 || lessonIndex >= lessons.length) {
|
||||||
height: 40.0,
|
columns.add(SizedBox(width: colw));
|
||||||
child: Text(
|
|
||||||
DateFormat("EEEE", I18n.of(context).locale.languageCode)
|
|
||||||
.format(lessons.first.date)
|
|
||||||
.capital(),
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 24.0, fontWeight: FontWeight.bold),
|
|
||||||
),
|
|
||||||
));
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lessons[lessonIndex].isEmpty) {
|
if (lessons[lessonIndex].isEmpty) {
|
||||||
columns.add(SizedBox(
|
columns.add(
|
||||||
width: colw,
|
SizedBox(
|
||||||
child: Row(
|
width: colw,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
child: Row(
|
||||||
children: [
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
Icon(FeatherIcons.slash,
|
|
||||||
size: 18.0,
|
|
||||||
color: AppColors.of(context).text.withOpacity(.3)),
|
|
||||||
const SizedBox(width: 8.0),
|
|
||||||
Text(
|
|
||||||
"Lyukas óra",
|
|
||||||
style: TextStyle(
|
|
||||||
color: AppColors.of(context).text.withOpacity(.3)),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dayOffset > 0 && lessonIndex < dayOffset) {
|
|
||||||
columns.add(SizedBox(width: colw));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
columns.add(SizedBox(
|
|
||||||
width: colw,
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
children: [
|
children: [
|
||||||
Icon(
|
Icon(
|
||||||
SubjectIcon.resolveVariant(
|
FeatherIcons.slash,
|
||||||
context: context,
|
|
||||||
subject: lessons[lessonIndex - dayOffset].subject),
|
|
||||||
size: 18.0,
|
size: 18.0,
|
||||||
color: AppColors.of(context).text.withOpacity(.7),
|
color: AppColors.of(context).text.withOpacity(.3),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 8.0),
|
const SizedBox(width: 8.0),
|
||||||
Expanded(
|
Text(
|
||||||
child: Text(
|
"Lyukas óra",
|
||||||
lessons[lessonIndex - dayOffset].subject.renamedTo ??
|
style: TextStyle(
|
||||||
lessons[lessonIndex - dayOffset]
|
color: AppColors.of(context).text.withOpacity(.3),
|
||||||
.subject
|
),
|
||||||
.name
|
),
|
||||||
.capital(),
|
],
|
||||||
maxLines: 1,
|
),
|
||||||
style: TextStyle(
|
),
|
||||||
fontStyle: lessons[lessonIndex - dayOffset]
|
);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
columns.add(
|
||||||
|
SizedBox(
|
||||||
|
width: colw,
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
SubjectIcon.resolveVariant(
|
||||||
|
context: context,
|
||||||
|
subject: lessons[lessonIndex].subject,
|
||||||
|
),
|
||||||
|
size: 18.0,
|
||||||
|
color: AppColors.of(context).text.withOpacity(.7),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8.0),
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
lessons[lessonIndex].subject.renamedTo ??
|
||||||
|
lessons[lessonIndex].subject.name.capital(),
|
||||||
|
maxLines: 1,
|
||||||
|
style: TextStyle(
|
||||||
|
fontStyle: lessons[lessonIndex]
|
||||||
.subject
|
.subject
|
||||||
.isRenamed
|
.isRenamed
|
||||||
? FontStyle.italic
|
? FontStyle.italic
|
||||||
: null),
|
: null,
|
||||||
overflow: TextOverflow.clip,
|
),
|
||||||
softWrap: false,
|
overflow: TextOverflow.clip,
|
||||||
|
softWrap: false,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 15),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 26.0),
|
||||||
|
child: Text(
|
||||||
|
lessons[lessonIndex].room,
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.of(context).text.withOpacity(.5),
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 15),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(left: 26.0),
|
|
||||||
child: Text(
|
|
||||||
lessons[lessonIndex - dayOffset].room,
|
|
||||||
style: TextStyle(
|
|
||||||
color: AppColors.of(context).text.withOpacity(.5),
|
|
||||||
overflow: TextOverflow.ellipsis),
|
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Row(
|
return Row(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user