82 lines
2.5 KiB
Dart
82 lines
2.5 KiB
Dart
|
|
import 'package:flutter/material.dart';
|
|
import 'package:marianum_mobile/data/timetable/timetableProps.dart';
|
|
import 'package:marianum_mobile/screen/pages/timetable/weekView.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
class Timetable extends StatefulWidget {
|
|
const Timetable({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<Timetable> createState() => _TimetableState();
|
|
}
|
|
|
|
class _TimetableState extends State<Timetable> {
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
|
Provider.of<TimetableProps>(context, listen: false).run();
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Consumer<TimetableProps>(
|
|
builder: (context, value, child) {
|
|
if(value.primaryLoading()) {
|
|
return const Center(child: CircularProgressIndicator());
|
|
}
|
|
|
|
TimetableProps timetable = Provider.of<TimetableProps>(context, listen: false);
|
|
return Column(
|
|
children: [
|
|
Flexible(
|
|
child: WeekView(value),
|
|
),
|
|
|
|
Container(
|
|
padding: const EdgeInsets.only(top: 5, bottom: 5),
|
|
decoration: BoxDecoration(
|
|
border: Border(
|
|
top: BorderSide(width: 2, color: Theme.of(context).disabledColor)
|
|
)
|
|
),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
IconButton(
|
|
onPressed: () => timetable.switchWeek(previous: true),
|
|
icon: const Icon(Icons.navigate_before_sharp),
|
|
color: Theme.of(context).primaryColor,
|
|
iconSize: 30,
|
|
),
|
|
Row(
|
|
children: [
|
|
IconButton(
|
|
onPressed: () => timetable.nearest(),
|
|
icon: const Icon(Icons.home),
|
|
color: Theme.of(context).primaryColor,
|
|
iconSize: 30,
|
|
),
|
|
],
|
|
),
|
|
IconButton(
|
|
onPressed: () => timetable.switchWeek(),
|
|
icon: const Icon(Icons.navigate_next_sharp),
|
|
color: Theme.of(context).primaryColor,
|
|
iconSize: 30,
|
|
)
|
|
],
|
|
),
|
|
)
|
|
],
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|