From ee3106ff4b3d144e66daf6e0c0341517eb46c1ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20M=C3=BCller?= Date: Wed, 22 Feb 2023 11:01:53 +0100 Subject: [PATCH] Timetable better week swipe, timetable performance upgrade --- flutter_03.log | 59 +++++++++++++++++++++++ lib/screen/pages/timetable/timetable.dart | 17 +++++-- 2 files changed, 71 insertions(+), 5 deletions(-) create mode 100644 flutter_03.log diff --git a/flutter_03.log b/flutter_03.log new file mode 100644 index 0000000..0cd14fd --- /dev/null +++ b/flutter_03.log @@ -0,0 +1,59 @@ +Flutter crash report. +Please report a bug at https://github.com/flutter/flutter/issues. + +## command + +flutter --no-color run --machine --device-id=5200de3d4dd02295 --profile --dart-define=flutter.inspector.structuredErrors=true lib/main.dart + +## exception + +String: failed to connect to http://127.0.0.1:45965/t1VeUhnSFsQ=/ + +``` +``` + +## flutter doctor + +``` +[!] Flutter (Channel stable, 3.7.4, on Linux Mint 20.3 5.15.0-60-generic, locale de_DE.UTF-8) + • Flutter version 3.7.4 on channel stable at /opt/flutter + ! The flutter binary is not on your path. Consider adding /opt/flutter/bin to your path. + ! The dart binary is not on your path. Consider adding /opt/flutter/bin to your path. + • Upstream repository https://github.com/flutter/flutter.git + • Framework revision b4bce91dd0 (vor 32 Stunden), 2023-02-21 09:50:50 +0800 + • Engine revision 248290d6d5 + • Dart version 2.19.2 + • DevTools version 2.20.1 + • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades. + +[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0) + • Android SDK at /home/elias/Android/Sdk + • Platform android-33, build-tools 33.0.0 + • Java binary at: /home/elias/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9123335/jre/bin/java + • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866) + • All Android licenses accepted. + +[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome) + ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable. + +[✓] Linux toolchain - develop for Linux desktop + • clang version 10.0.0-4ubuntu1 + • cmake version 3.16.3 + • ninja version 1.10.0 + • pkg-config version 0.29.1 + +[✓] Android Studio (version 2021.3) + • Android Studio at /home/elias/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9123335 + • Flutter plugin version 72.1.1 + • Dart plugin version 213.7433 + • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866) + +[✓] Connected device (2 available) + • SM G800F (mobile) • 5200de3d4dd02295 • android-arm • Android 6.0.1 (API 23) + • Linux (desktop) • linux • linux-x64 • Linux Mint 20.3 5.15.0-60-generic + +[✓] HTTP Host Availability + • All required HTTP hosts are available + +! Doctor found issues in 2 categories. +``` diff --git a/lib/screen/pages/timetable/timetable.dart b/lib/screen/pages/timetable/timetable.dart index 7fa77f5..667bfb1 100644 --- a/lib/screen/pages/timetable/timetable.dart +++ b/lib/screen/pages/timetable/timetable.dart @@ -13,6 +13,8 @@ class Timetable extends StatefulWidget { } class _TimetableState extends State { + bool draggable = true; + @override void initState() { super.initState(); @@ -36,14 +38,19 @@ class _TimetableState extends State { Expanded( child: GestureDetector( child: WeekView(value), - //onDoubleTap: () => timetable.nearest(), - onHorizontalDragEnd: (details) { - if(details.primaryVelocity! < 0) { - timetable.switchWeek(); - } else { + 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; + }, ), ),