forked from firka/firka
Compare commits
9 Commits
2b9ac14d6e
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| 5a42884d20 | |||
| 3fb0fd55de | |||
| 4c06daf02f | |||
| 3d07b2b2ce | |||
| 9a45c5c456 | |||
|
|
858d558cc3 | ||
|
|
76f345cd6b | ||
|
|
e211d64ffb | ||
|
|
c67ce7472a |
4
.gitmodules
vendored
4
.gitmodules
vendored
@@ -1,6 +1,6 @@
|
||||
[submodule "firka/lib/l10n"]
|
||||
path = firka/lib/l10n
|
||||
url = https://github.com/QwIT-Development/firka-localization
|
||||
url = https://git.firka.app/firka/firka-localization
|
||||
[submodule "firka_wear/lib/l10n"]
|
||||
path = firka_wear/lib/l10n
|
||||
url = https://github.com/qwit-development/firka-localization
|
||||
url = https://git.firka.app/firka/firka-localization
|
||||
|
||||
@@ -294,4 +294,26 @@ extension StringExtension on String {
|
||||
if (length == 1) this[0].toUpperCase();
|
||||
return this[0].toUpperCase() + substring(1, length);
|
||||
}
|
||||
|
||||
String shortenName([int start = 0]) {
|
||||
if (length <= 16 || start >= length) {
|
||||
return this;
|
||||
}
|
||||
|
||||
int index = indexOf(" ", start);
|
||||
if (index == -1) {
|
||||
return this;
|
||||
}
|
||||
|
||||
String string = substring(start, index);
|
||||
if (string.endsWith(".")) {
|
||||
return this;
|
||||
}
|
||||
|
||||
return replaceRange(
|
||||
start,
|
||||
index,
|
||||
"${string[0]}.",
|
||||
).shortenName(index - string.length + 2 + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,6 +137,27 @@ Future<void> showLessonBottomSheet(
|
||||
size: 26,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 6),
|
||||
if (lesson.roomName != null)
|
||||
Card(
|
||||
shadowColor: Colors.transparent,
|
||||
color: appStyle.colors.a15p,
|
||||
margin: EdgeInsets.all(0),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 6),
|
||||
child: Text(
|
||||
lesson.roomName!,
|
||||
style: appStyle.fonts.B_14R.apply(
|
||||
color: appStyle.colors.secondary,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
@@ -165,7 +186,6 @@ Future<void> showLessonBottomSheet(
|
||||
lesson.substituteTeacher!,
|
||||
style: appStyle.fonts.B_14R.apply(color: appStyle.colors.textSecondary),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Text(
|
||||
'${lesson.start.format(data.l10n, FormatMode.hmm)} - ${lesson.end.format(data.l10n, FormatMode.hmm)}',
|
||||
style: appStyle.fonts.B_14R.apply(color: appStyle.colors.textSecondary),
|
||||
|
||||
@@ -259,6 +259,7 @@ class _HomeMainScreen extends FirkaState<HomeMainScreen> {
|
||||
WelcomeWidget(widget.data.l10n, now, student!, lessons!),
|
||||
SizedBox(height: 48),
|
||||
LessonSlider(lessonTestMap, testsTomorrow),
|
||||
SizedBox(height: 24),
|
||||
...noticeBoardWidgets
|
||||
.groupList((e) => e.$2)
|
||||
.entries
|
||||
|
||||
@@ -54,12 +54,15 @@ class BottomNavIconWidget extends StatelessWidget {
|
||||
size: 24,
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
text,
|
||||
style: appStyle.fonts.B_14R.apply(
|
||||
color: active
|
||||
? appStyle.colors.textPrimary
|
||||
: appStyle.colors.textSecondary,
|
||||
FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
child: Text(
|
||||
text,
|
||||
style: appStyle.fonts.B_14R.apply(
|
||||
color: active
|
||||
? appStyle.colors.textPrimary
|
||||
: appStyle.colors.textSecondary,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:firka/app/app_state.dart';
|
||||
import 'package:firka/core/extensions.dart';
|
||||
import 'package:firka/core/settings.dart';
|
||||
import 'package:firka_common/firka_common.dart';
|
||||
import 'package:firka_common/ui/components/filled_circle.dart';
|
||||
@@ -138,9 +139,9 @@ class _GradeChartState extends State<GradeChart> {
|
||||
final date = spots[_touchedIndex!].date;
|
||||
content = tooltipFormat.format(date);
|
||||
} else if (value == firstX) {
|
||||
content = 'Szeptember';
|
||||
content = DateFormat("MMMM", initData.l10n.localeName).format(DateTime(DateTime.now().year, DateTime.september)).firstUpper();
|
||||
} else if (value == lastX && !shouldHideNow) {
|
||||
content = 'Most';
|
||||
content = initData.l10n.now;
|
||||
}
|
||||
|
||||
final text = Text(
|
||||
|
||||
@@ -166,7 +166,7 @@ class LessonWidget extends StatelessWidget {
|
||||
),
|
||||
showSubstitutions
|
||||
? Text(
|
||||
lesson.substituteTeacher!,
|
||||
lesson.substituteTeacher!.shortenName(),
|
||||
style: appStyle.fonts.B_14R.apply(
|
||||
color: appStyle.colors.textSecondary,
|
||||
),
|
||||
|
||||
@@ -204,7 +204,7 @@ class LessonBigWidget extends StatelessWidget {
|
||||
),
|
||||
if (isSubstituted)
|
||||
Text(
|
||||
lesson.substituteTeacher!,
|
||||
lesson.substituteTeacher!.shortenName(),
|
||||
style: appStyle.fonts.B_14R.apply(
|
||||
color: appStyle.colors.textSecondary,
|
||||
),
|
||||
|
||||
@@ -7,7 +7,6 @@ import 'package:firka/app/app_state.dart';
|
||||
import 'package:firka/ui/theme/style.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:majesticons_flutter/majesticons_flutter.dart';
|
||||
|
||||
import 'lesson.dart';
|
||||
|
||||
@@ -33,10 +32,8 @@ class TimeTableDayWidget extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Widget ttBody;
|
||||
|
||||
if (lessons.isEmpty) {
|
||||
ttBody = Column(
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
@@ -62,7 +59,29 @@ class TimeTableDayWidget extends StatelessWidget {
|
||||
...events.map(
|
||||
(event) => Center(
|
||||
child: Text(
|
||||
event.name.replaceAll(" (Nem órarendi nap)", ""),
|
||||
event.name
|
||||
.replaceAll(" (Nem órarendi nap)", "")
|
||||
.replaceAll(" (Hétfő)", "")
|
||||
.replaceAll(" (Kedd)", "")
|
||||
.replaceAll(" (Szerda)", "")
|
||||
.replaceAll(" (Csütörtök)", "")
|
||||
.replaceAll(" (Péntek)", "")
|
||||
.replaceAll(" (Szombat)", "")
|
||||
.replaceAll(" (Vasárnap)", "")
|
||||
.replaceAll("Tanítás nélküli munkanap", data.l10n.tt_non_instructional_day)
|
||||
.replaceAll("Munkaszüneti nap", data.l10n.tt_public_holiday)
|
||||
.replaceAll("Tavaszi szünet", data.l10n.tt_spring_break)
|
||||
.replaceAll("Téli szünet", data.l10n.tt_winter_break)
|
||||
.replaceAll("Őszi szünet", data.l10n.tt_autumn_break)
|
||||
.replaceAll("Tanítási nap", data.l10n.tt_instructional_day)
|
||||
.replaceAll("Első félév vége", data.l10n.tt_first_semester_end)
|
||||
.replaceAll("Ünnepnap", data.l10n.tt_holiday)
|
||||
.replaceAll("Pihenőnap", data.l10n.tt_rest_day)
|
||||
.replaceAll("Első tanítási nap", data.l10n.tt_first_instructional_day)
|
||||
.replaceAll("Utolsó tanítási nap", data.l10n.tt_last_instructional_day)
|
||||
.replaceAll("Utolsó tanítási nap a végzős évfolyamokon", data.l10n.tt_last_instructional_day_graduates)
|
||||
.replaceAll("Egész napos kirándulás", data.l10n.tt_full_day_trip)
|
||||
.replaceAll("negyedév vége", data.l10n.tt_quarter_end),
|
||||
style: appStyle.fonts.B_16R.apply(
|
||||
color: appStyle.colors.textSecondary,
|
||||
),
|
||||
@@ -71,95 +90,93 @@ class TimeTableDayWidget extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
);
|
||||
} else {
|
||||
List<Widget> ttLessons = List.empty(growable: true);
|
||||
for (var i = 0; i < events.length; i++) {
|
||||
var event = events[i];
|
||||
ttLessons.add(
|
||||
FirkaCard.single(
|
||||
margin: EdgeInsets.zero,
|
||||
padding: EdgeInsets.all(16),
|
||||
child: Text(
|
||||
event.name,
|
||||
style: appStyle.fonts.B_16R.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
}
|
||||
|
||||
List<Widget> ttLessons = List.empty(growable: true);
|
||||
for (final event in events) {
|
||||
ttLessons.add(
|
||||
FirkaCard.single(
|
||||
margin: EdgeInsets.zero,
|
||||
padding: EdgeInsets.all(16),
|
||||
child: Text(
|
||||
event.name,
|
||||
style: appStyle.fonts.B_16R.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (events.isNotEmpty) {
|
||||
ttLessons.add(SizedBox());
|
||||
}
|
||||
|
||||
var showBreak = data.settings
|
||||
.group("settings")
|
||||
.subGroup("timetable_toast")
|
||||
.boolean("breaks");
|
||||
|
||||
for (var i = 0; i < lessons.length; i++) {
|
||||
var lesson = lessons[i];
|
||||
var nextLesson = lessons.length > i + 1 ? lessons[i + 1] : null;
|
||||
ttLessons.add(
|
||||
LessonWidget(
|
||||
data,
|
||||
lesson,
|
||||
tests.firstWhereOrNull(
|
||||
(test) => test.lessonNumber == lesson.lessonNumber,
|
||||
),
|
||||
active: timeNow().isBetween(
|
||||
i > 0 ? lessons[i - 1].end : lesson.start,
|
||||
lesson.end,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
if (!showBreak || nextLesson == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var breakMins = nextLesson.start.difference(lesson.end).inMinutes;
|
||||
ttLessons.add(
|
||||
FirkaCard(
|
||||
color: appStyle.colors.cardTranslucent,
|
||||
margin: EdgeInsets.all(0),
|
||||
padding: EdgeInsets.symmetric(vertical: 11, horizontal: 16),
|
||||
shadow: false,
|
||||
left: [
|
||||
Text(
|
||||
initData.l10n.breakTxt,
|
||||
style: appStyle.fonts.B_14SB.copyWith(
|
||||
color: appStyle.colors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
right: [
|
||||
Text(
|
||||
"$breakMins ${breakMins > 1 ? initData.l10n.starting_min_plural : initData.l10n.starting_min}",
|
||||
style: appStyle.fonts.B_14R.copyWith(
|
||||
color: appStyle.colors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
ttBody = Padding(
|
||||
padding: const EdgeInsets.only(top: 70 + 16 + 20, left: 20, right: 20),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 16,
|
||||
children: [...ttLessons, SizedBox(height: 55)],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return ttBody;
|
||||
if (events.isNotEmpty) {
|
||||
ttLessons.add(SizedBox());
|
||||
}
|
||||
|
||||
var showBreak = data.settings
|
||||
.group("settings")
|
||||
.subGroup("timetable_toast")
|
||||
.boolean("breaks");
|
||||
|
||||
for (var i = 0; i < lessons.length; i++) {
|
||||
var lesson = lessons[i];
|
||||
var nextLesson = lessons.length > i + 1 ? lessons[i + 1] : null;
|
||||
ttLessons.add(
|
||||
LessonWidget(
|
||||
data,
|
||||
lesson,
|
||||
tests.firstWhereOrNull(
|
||||
(test) => test.lessonNumber == lesson.lessonNumber,
|
||||
),
|
||||
active: timeNow().isBetween(
|
||||
i > 0 ? lessons[i - 1].end : lesson.start,
|
||||
lesson.end,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
if (!showBreak || nextLesson == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var breakMins = nextLesson.start.difference(lesson.end).inMinutes;
|
||||
ttLessons.add(
|
||||
FirkaCard(
|
||||
color: appStyle.colors.cardTranslucent,
|
||||
margin: EdgeInsets.all(0),
|
||||
padding: EdgeInsets.symmetric(vertical: 11, horizontal: 16),
|
||||
shadow: false,
|
||||
left: [
|
||||
Text(
|
||||
initData.l10n.breakTxt,
|
||||
style: appStyle.fonts.B_14SB.copyWith(
|
||||
color: appStyle.colors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
right: [
|
||||
Text(
|
||||
"$breakMins ${breakMins > 1 ? initData.l10n.starting_min_plural : initData.l10n.starting_min}",
|
||||
style: appStyle.fonts.B_14R.copyWith(
|
||||
color: appStyle.colors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 70 + 16 + 20, left: 20, right: 20),
|
||||
child: ListView.separated(
|
||||
separatorBuilder: (context, index) => SizedBox(height: 16),
|
||||
itemBuilder: (context, index) {
|
||||
if (ttLessons.length == index) {
|
||||
return SizedBox(height: 55);
|
||||
}
|
||||
return ttLessons[index];
|
||||
},
|
||||
itemCount: ttLessons.length + 1,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user