remade timetable ui kinda

This commit is contained in:
Kima 2024-01-01 21:43:38 +01:00
parent 2ed822e1da
commit 1042f6de02
2 changed files with 164 additions and 38 deletions

View File

@ -9,7 +9,6 @@ import 'package:filcnaplo/theme/colors/colors.dart';
import 'package:filcnaplo_kreta_api/models/lesson.dart'; import 'package:filcnaplo_kreta_api/models/lesson.dart';
import 'package:filcnaplo_mobile_ui/common/dot.dart'; import 'package:filcnaplo_mobile_ui/common/dot.dart';
import 'package:filcnaplo_mobile_ui/common/empty.dart'; import 'package:filcnaplo_mobile_ui/common/empty.dart';
import 'package:filcnaplo_mobile_ui/common/panel/panel.dart';
import 'package:filcnaplo_mobile_ui/common/profile_image/profile_button.dart'; import 'package:filcnaplo_mobile_ui/common/profile_image/profile_button.dart';
import 'package:filcnaplo_mobile_ui/common/profile_image/profile_image.dart'; import 'package:filcnaplo_mobile_ui/common/profile_image/profile_image.dart';
import 'package:filcnaplo_mobile_ui/common/system_chrome.dart'; import 'package:filcnaplo_mobile_ui/common/system_chrome.dart';
@ -354,7 +353,7 @@ class TimetablePageState extends State<TimetablePage>
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Text( child: Text(
"${_controller.currentWeekId + 1}. ${"week".i18n} (${DateFormat("${_controller.currentWeek.start.year != DateTime.now().year ? "yy. " : ""}MMM d.", I18n.of(context).locale.languageCode).format(_controller.currentWeek.start)} - ${DateFormat("${_controller.currentWeek.start.year != DateTime.now().year ? "yy. " : ""}MMM d.", I18n.of(context).locale.languageCode).format(_controller.currentWeek.end)})", "${DateFormat("${_controller.currentWeek.start.year != DateTime.now().year ? "yyyy. " : ""}MMM d", I18n.of(context).locale.languageCode).format(_controller.currentWeek.start)}${DateFormat("${_controller.currentWeek.start.year != DateTime.now().year ? " - yyyy. MMM " : (_controller.currentWeek.start.month == _controller.currentWeek.end.month ? '-' : ' - MMM ')}d", I18n.of(context).locale.languageCode).format(_controller.currentWeek.end)} ${_controller.currentWeekId + 1}. ${"week".i18n}",
style: const TextStyle( style: const TextStyle(
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
fontSize: 14.0, fontSize: 14.0,
@ -419,43 +418,52 @@ class TimetablePageState extends State<TimetablePage>
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
physics: const BouncingScrollPhysics(), physics: const BouncingScrollPhysics(),
itemCount: itemCount:
_controller.days![tab].length + 2, _controller.days![tab].length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
if (_controller.days == null) { if (_controller.days == null) {
return Container(); return Container();
} }
// Header // Header
if (index == 0) { // if (index == 0) {
return const Padding( // return const Padding(
padding: EdgeInsets.only( // padding: EdgeInsets.only(
top: 8.0, // top: 8.0,
left: 24.0, // left: 24.0,
right: 24.0), // right: 24.0),
child: PanelHeader( // child: PanelHeader(
padding: EdgeInsets.only( // padding: EdgeInsets.only(
top: 12.0)), // top: 12.0)),
); // );
} // }
// Footer // Footer
if (index == // if (index ==
_controller.days![tab].length + // _controller.days![tab].length +
1) { // 1) {
return const Padding( // return const Padding(
padding: EdgeInsets.only( // padding: EdgeInsets.only(
bottom: 8.0, // bottom: 8.0,
left: 24.0, // left: 24.0,
right: 24.0), // right: 24.0),
child: PanelFooter( // child: PanelFooter(
padding: EdgeInsets.only( // padding: EdgeInsets.only(
top: 12.0)), // top: 12.0)),
); // );
} // }
// Body // Body
int len =
_controller.days![tab].length;
final Lesson lesson = final Lesson lesson =
_controller.days![tab][index - 1]; _controller.days![tab][index];
final Lesson? before =
len + index > len
? _controller.days![tab]
[index - 1]
: null;
final bool swapDescDay = _controller final bool swapDescDay = _controller
.days![tab] .days![tab]
.map( .map(
@ -464,19 +472,134 @@ class TimetablePageState extends State<TimetablePage>
_controller.days![tab].length * _controller.days![tab].length *
.5; .5;
return Padding( return Column(
padding: const EdgeInsets.symmetric( children: [
horizontal: 24.0), if (before != null)
child: PanelBody( Padding(
padding: padding: EdgeInsets.only(
const EdgeInsets.symmetric( top: index == 0
? 0.0
: 12.0,
left: 24,
right: 24),
child: Container(
padding:
const EdgeInsets.all(
10.0),
decoration: BoxDecoration(
border: Border.all(
color: Theme.of(context)
.colorScheme
.primary
.withOpacity(0.25),
),
borderRadius:
BorderRadius.circular(
16.0),
),
child: Row(children: [
Container(
padding:
const EdgeInsets
.symmetric(
horizontal:
10.0,
vertical: 3.0),
decoration:
BoxDecoration(
borderRadius:
BorderRadius
.circular(
50.0),
color: AppColors.of(
context)
.text
.withOpacity(
0.90),
),
child: Text(
'break'.i18n,
style: TextStyle(
color: Theme.of(
context)
.scaffoldBackgroundColor,
fontSize: 13.0,
fontWeight:
FontWeight.w500,
),
),
),
const SizedBox(
width: 10.0,
),
Text(
'${before.end.hour}:${before.end.minute} - ${lesson.start.hour}:${lesson.start.minute}'),
]),
),
),
Padding(
padding: EdgeInsets.only(
top:
index == 0 ? 0.0 : 12.0,
left: 24,
right: 24),
child: Container(
padding: const EdgeInsets
.symmetric(
vertical: 4.0,
horizontal: 10.0), horizontal: 10.0),
child: LessonViewable( decoration: BoxDecoration(
lesson, color: Theme.of(context)
swapDesc: swapDescDay, .colorScheme
.background,
borderRadius:
BorderRadius.only(
topLeft: index == 0
? const Radius
.circular(16.0)
: const Radius
.circular(16.0),
topRight: index == 0
? const Radius
.circular(16.0)
: const Radius
.circular(16.0),
bottomLeft: index + 1 ==
len
? const Radius
.circular(16.0)
: const Radius
.circular(16.0),
bottomRight: index + 1 ==
len
? const Radius
.circular(16.0)
: const Radius
.circular(16.0),
),
),
child: LessonViewable(
lesson,
swapDesc: swapDescDay,
),
),
), ),
), ],
); );
// return Padding(
// padding: const EdgeInsets.symmetric(
// horizontal: 24.0),
// child: PanelBody(
// padding:
// const EdgeInsets.symmetric(
// horizontal: 10.0),
// child: LessonViewable(
// lesson,
// swapDesc: swapDescDay,
// ),
// ),
// );
}, },
), ),
), ),

View File

@ -9,6 +9,7 @@ extension Localization on String {
"week": "Week", "week": "Week",
"error": "Failed to fetch timetable!", "error": "Failed to fetch timetable!",
"empty_timetable": "Timetable is empty!", "empty_timetable": "Timetable is empty!",
"break": "Break",
}, },
"hu_hu": { "hu_hu": {
"timetable": "Órarend", "timetable": "Órarend",
@ -16,6 +17,7 @@ extension Localization on String {
"week": "Hét", "week": "Hét",
"error": "Nem sikerült lekérni az órarendet!", "error": "Nem sikerült lekérni az órarendet!",
"empty_timetable": "Az órarend üres!", "empty_timetable": "Az órarend üres!",
"break": "Szünet",
}, },
"de_de": { "de_de": {
"timetable": "Zeitplan", "timetable": "Zeitplan",
@ -23,6 +25,7 @@ extension Localization on String {
"week": "Woche", "week": "Woche",
"error": "Der Fahrplan konnte nicht abgerufen werden!", "error": "Der Fahrplan konnte nicht abgerufen werden!",
"empty_timetable": "Der Zeitplan ist blank!", "empty_timetable": "Der Zeitplan ist blank!",
"break": "Pause",
}, },
}; };