From ba79191a7823a086a7888fa3156caeb22c6cdf5c Mon Sep 17 00:00:00 2001 From: Jonas Braus Date: Thu, 28 Nov 2024 10:55:11 +0100 Subject: [PATCH] Fix No Time Now MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Achtung: ZEITZÖNCHEN RICHTIG EINSTELLEN!!! --- lib/spaces/spaceHome.dart | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/lib/spaces/spaceHome.dart b/lib/spaces/spaceHome.dart index 02723df..8eb415a 100644 --- a/lib/spaces/spaceHome.dart +++ b/lib/spaces/spaceHome.dart @@ -99,18 +99,14 @@ class _SpaceHomeState extends State { return Scaffold( body: GestureDetector( onTap: () { - var now = DateTime.now(); + var now = TimeOfDay.now(); + int startHour = 11; + int endHour = 14; - if (!(now - .difference( - DateTime(now.year, now.month, now.day, 11, 30)) - .inMinutes > - 0 && - now - .difference( - DateTime(now.year, now.month, now.day, 14, 30)) - .inMinutes < - 0)) { + if (now.hour == startHour && now.minute <= 30 || + now.hour < startHour || + now.hour == endHour && now.minute >= 30 || + now.hour >= endHour + 1) { _showNotRateTimeDialog(context); } else { Provider.of(context, listen: false)