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); TimetableProps timetable = Provider.of<TimetableProps>(context, listen: false);
return Column( return Column(
children: [ children: [
Flexible( Expanded(
child: WeekView(value), child: GestureDetector(
child: WeekView(value),
onHorizontalDragEnd: (details) {
if(details.primaryVelocity! < 0) {
timetable.switchWeek();
} else {
timetable.switchWeek(previous: true);
}
},
),
), ),
Container( // Flexible(
padding: const EdgeInsets.only(top: 5, bottom: 5), // child:
decoration: BoxDecoration( // ),
border: Border(
top: BorderSide(width: 2, color: Theme.of(context).disabledColor)
)
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [ Visibility(
IconButton( visible: false,
onPressed: () => timetable.switchWeek(previous: true), child: Container(
icon: const Icon(Icons.navigate_before_sharp), padding: const EdgeInsets.only(top: 5, bottom: 5),
color: Theme.of(context).primaryColor, decoration: BoxDecoration(
iconSize: 30, border: Border(
), top: BorderSide(width: 2, color: Theme.of(context).disabledColor)
Row( )
children: [ ),
IconButton( child: Row(
onPressed: () => timetable.nearest(), mainAxisAlignment: MainAxisAlignment.center,
icon: const Icon(Icons.home),
color: Theme.of(context).primaryColor, children: [
iconSize: 30, IconButton(
), onPressed: () => timetable.switchWeek(previous: true),
], icon: const Icon(Icons.navigate_before_sharp),
), color: Theme.of(context).primaryColor,
IconButton( iconSize: 30,
onPressed: () => timetable.switchWeek(), ),
icon: const Icon(Icons.navigate_next_sharp), Row(
color: Theme.of(context).primaryColor, children: [
iconSize: 30, 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,
)
],
),
), ),
) )
], ],