Change magic numbers to be a variable. :)
This commit is contained in:
parent
54ae255e9e
commit
8c8b848090
@ -1,6 +1,6 @@
|
||||
// Local
|
||||
import '/var/secrets.dart';
|
||||
import '/var/locals.dart';
|
||||
import 'var/config.dart';
|
||||
|
||||
// Flutter / Dart
|
||||
import 'package:flutter/material.dart';
|
||||
@ -23,7 +23,9 @@ class MainApp extends StatefulWidget {
|
||||
class _MainAppState extends State<MainApp> {
|
||||
String weather = loadText;
|
||||
bool keepLoading = false;
|
||||
DateTime lastLoadTime = DateTime.now().subtract(Duration(seconds: 5));
|
||||
DateTime lastLoadTime = DateTime.now().subtract(
|
||||
Duration(seconds: limitRefreshSeconds),
|
||||
);
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -108,7 +110,7 @@ class _MainAppState extends State<MainApp> {
|
||||
var lastReloadSeconds = DateTime.now().difference(lastLoadTime).inSeconds;
|
||||
if (debug) debugPrint("DEBUG: Refresh was $lastReloadSeconds seconds ago.");
|
||||
|
||||
if (lastReloadSeconds < 5) {
|
||||
if (lastReloadSeconds < limitRefreshSeconds) {
|
||||
debugPrint("DEBUG: Skipping reload.");
|
||||
// TODO / TBD: Show a toast / scaffold snackbar that it cannot reload yet,
|
||||
// or change the button text to "Please wait X seconds!".
|
||||
|
Loading…
x
Reference in New Issue
Block a user