diff --git a/lib/utils/prevent_update_notifs.dart b/lib/utils/prevent_update_notifs.dart index 145ed3c..76fa39a 100644 --- a/lib/utils/prevent_update_notifs.dart +++ b/lib/utils/prevent_update_notifs.dart @@ -1,7 +1,7 @@ //If less than 3 days, since the last notif is scheduled, do not rescehdule //3 days = 259200000 millis //15 seconds = 15000 -//6 hours = 21600000 +//4 hours = 14400000 import 'package:fluttertoast/fluttertoast.dart'; import 'package:get_storage/get_storage.dart'; import 'package:waktusolatmalaysia/CONSTANTS.dart'; @@ -10,7 +10,7 @@ class PreventUpdatingNotifs { static void now() { if ((DateTime.now().millisecondsSinceEpoch - GetStorage().read(kStoredLastUpdateNotif)) < - 15000) { + 14400000) { print('Notification should not update'); //TODO: Remove when release, toast is for debug purposes Fluttertoast.showToast(msg: 'Notification should not update'); diff --git a/lib/views/Settings part/SettingsPage.dart b/lib/views/Settings part/SettingsPage.dart index 25ec074..53abc36 100644 --- a/lib/views/Settings part/SettingsPage.dart +++ b/lib/views/Settings part/SettingsPage.dart @@ -88,10 +88,12 @@ class _SettingsPageState extends State { subtitle: Text('App notification behavior'), onTap: () async { Navigator.push( - context, - MaterialPageRoute( - builder: (BuildContext context) => - NotificationPageSetting())); + context, + MaterialPageRoute( + builder: (BuildContext context) => + NotificationPageSetting(), + ), + ); }, ), ), @@ -103,9 +105,11 @@ class _SettingsPageState extends State { title: Text('About app (Ver. ${widget.info.version})'), onTap: () { Navigator.push( - context, - MaterialPageRoute( - builder: (context) => AboutAppPage(widget.info))); + context, + MaterialPageRoute( + builder: (context) => AboutAppPage(widget.info), + ), + ); }, subtitle: Text('Privacy Policy, Release Notes, Contribution etc.'), diff --git a/lib/views/ZoneChooser.dart b/lib/views/ZoneChooser.dart index be87e97..7d821aa 100644 --- a/lib/views/ZoneChooser.dart +++ b/lib/views/ZoneChooser.dart @@ -1,7 +1,7 @@ ///This widget is rendered as Location button at header part. ///Also handle the location selection import 'dart:async'; - +import 'package:get/get.dart' show Get, GetNavigation; import 'package:flutter/foundation.dart' show kIsWeb; import 'package:flutter/material.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart'; @@ -178,15 +178,9 @@ Future openshowModalBottomSheet(BuildContext context, Function callback) async { if (selectedIndex != globalIndex) { if (selectedIndex != null) { globalIndex = selectedIndex; - ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: Row( - children: [ - Icon(Icons.done), - Text('Updated and saved'), - ], - ))); + showSnackbarLocationSaved(context); + // Fluttertoast.showToast(msg: 'Location updated and saved'); - // RestartWidget.restartApp(context); callback(); GetPrayerTime.updateUI(selectedIndex); } @@ -360,13 +354,7 @@ class Completed extends StatelessWidget { onPressed: () { GetStorage().write(kStoredGlobalIndex, index); globalIndex = index; - ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: Row( - children: [ - Icon(Icons.done), - Text('Updated and saved'), - ], - ))); + showSnackbarLocationSaved(context); // Fluttertoast.showToast(msg: 'Location updated and saved'); onCallback(); Navigator.pop(context); @@ -382,6 +370,26 @@ class Completed extends StatelessWidget { } } +void showSnackbarLocationSaved(BuildContext context) => + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + behavior: SnackBarBehavior.floating, + duration: Duration(milliseconds: 2500), + content: Row( + children: [ + Icon( + Icons.pin_drop_rounded, + color: Get.isDarkMode ? Colors.black87 : Colors.white70, + ), + SizedBox( + width: 10, + ), + Text('Updated and saved'), + ], + ), + ), + ); + class Error extends StatelessWidget { final String errorMessage;