Added Timetable gesturedetection, removed Timetable "next" and "previous" buttons

This commit is contained in:
Elias Müller 2023-02-21 13:55:46 +01:00
parent 29dd96940b
commit 8357b07c7b
3 changed files with 51 additions and 85 deletions

View File

@ -1,31 +0,0 @@
// // GENERATED CODE - DO NOT MODIFY BY HAND
//
// part of 'cacheableFile.dart';
//
// // **************************************************************************
// // JsonSerializableGenerator
// // **************************************************************************
//
// CacheableFile _$CacheableFileFromJson(Map<String, dynamic> json) =>
// CacheableFile(
// json['path'] as String?,
// json['isDir'] as bool?,
// json['name'] as String?,
// json['mimeType'] as String?,
// json['size'] as int?,
// json['eTag'] as String?,
// json['cTime'] == null ? null : DateTime.parse(json['cTime'] as String),
// json['mTime'] == null ? null : DateTime.parse(json['mTime'] as String),
// );
//
// Map<String, dynamic> _$CacheableFileToJson(CacheableFile instance) =>
// <String, dynamic>{
// 'path': instance.path,
// 'isDir': instance.isDir,
// 'name': instance.name,
// 'mimeType': instance.mimeType,
// 'size': instance.size,
// 'eTag': instance.eTag,
// 'cTime': instance.cTime?.toIso8601String(),
// 'mTime': instance.mTime?.toIso8601String(),
// };

View File

@ -1,19 +0,0 @@
// // GENERATED CODE - DO NOT MODIFY BY HAND
//
// part of 'listFilesResponse.dart';
//
// // **************************************************************************
// // JsonSerializableGenerator
// // **************************************************************************
//
// ListFilesResponse _$ListFilesResponseFromJson(Map<String, dynamic> json) =>
// ListFilesResponse(
// (json['files'] as List<dynamic>)
// .map((e) => CacheableFile.fromJson(e as Map<String, dynamic>))
// .toSet(),
// );
//
// Map<String, dynamic> _$ListFilesResponseToJson(ListFilesResponse instance) =>
// <String, dynamic>{
// 'files': instance.files.map((e) => e.toJson()).toList(),
// };

View File

@ -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,
)
],
),
),
)
],