Added Timetable gesturedetection, removed Timetable "next" and "previous" buttons
This commit is contained in:
@ -33,44 +33,60 @@ class _TimetableState extends State<Timetable> {
|
||||
TimetableProps timetable = Provider.of<TimetableProps>(context, listen: false);
|
||||
return Column(
|
||||
children: [
|
||||
Flexible(
|
||||
child: WeekView(value),
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
child: WeekView(value),
|
||||
onHorizontalDragEnd: (details) {
|
||||
if(details.primaryVelocity! < 0) {
|
||||
timetable.switchWeek();
|
||||
} else {
|
||||
timetable.switchWeek(previous: true);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
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,
|
||||
// Flexible(
|
||||
// child:
|
||||
// ),
|
||||
|
||||
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,
|
||||
)
|
||||
],
|
||||
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,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
|
Reference in New Issue
Block a user