Added custom Appbar for each page

This commit is contained in:
2023-03-18 13:21:32 +01:00
parent cc47f9bee7
commit 3e7dd1b0c7
4 changed files with 178 additions and 145 deletions

View File

@ -26,80 +26,85 @@ class _TimetableState extends State<Timetable> {
@override
Widget build(BuildContext context) {
return Consumer<TimetableProps>(
builder: (context, value, child) {
if(value.primaryLoading()) {
return const Center(child: CircularProgressIndicator());
}
return Scaffold(
appBar: AppBar(
title: const Text("Vertretungsplan"),
),
body: 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: [
Expanded(
child: GestureDetector(
child: WeekView(value),
onHorizontalDragUpdate: (details) {
if(!draggable) return;
if(details.delta.dx > 5) {
draggable = false;
timetable.switchWeek(previous: true);
} else if(details.delta.dx < 5) {
draggable = false;
timetable.switchWeek();
}
},
onHorizontalDragEnd: (details) {
draggable = true;
},
),
),
// Flexible(
// child:
// ),
Visibility(
visible: false,
child: 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,
)
],
TimetableProps timetable = Provider.of<TimetableProps>(context, listen: false);
return Column(
children: [
Expanded(
child: GestureDetector(
child: WeekView(value),
onHorizontalDragUpdate: (details) {
if(!draggable) return;
if(details.delta.dx > 5) {
draggable = false;
timetable.switchWeek(previous: true);
} else if(details.delta.dx < 5) {
draggable = false;
timetable.switchWeek();
}
},
onHorizontalDragEnd: (details) {
draggable = true;
},
),
),
)
],
);
},
// Flexible(
// child:
// ),
Visibility(
visible: false,
child: 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,
)
],
),
),
)
],
);
},
),
);
}
}