Added constants class
This commit is contained in:
@@ -1,2 +1,6 @@
|
||||
/// Minimum duration of all app skeletons
|
||||
Duration minimumSkeletonDuration = const Duration(milliseconds: 250);
|
||||
class Constants {
|
||||
Constants._(); // Private constructor to prevent instantiation
|
||||
|
||||
/// Minimum duration of all app skeletons
|
||||
static Duration minimumSkeletonDuration = const Duration(milliseconds: 250);
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ class _GroupsViewState extends State<GroupsView> {
|
||||
void loadGroups() {
|
||||
Future.wait([
|
||||
db.groupDao.getAllGroups(),
|
||||
Future.delayed(minimumSkeletonDuration),
|
||||
Future.delayed(Constants.minimumSkeletonDuration),
|
||||
]).then((results) {
|
||||
loadedGroups = results[0] as List<Group>;
|
||||
setState(() {
|
||||
|
||||
@@ -47,7 +47,7 @@ class _HomeViewState extends State<HomeView> {
|
||||
db.matchDao.getMatchCount(),
|
||||
db.groupDao.getGroupCount(),
|
||||
db.matchDao.getAllMatches(),
|
||||
Future.delayed(minimumSkeletonDuration),
|
||||
Future.delayed(Constants.minimumSkeletonDuration),
|
||||
]).then((results) {
|
||||
matchCount = results[0] as int;
|
||||
groupCount = results[1] as int;
|
||||
|
||||
@@ -120,7 +120,7 @@ class _MatchViewState extends State<MatchView> {
|
||||
void loadGames() {
|
||||
Future.wait([
|
||||
db.matchDao.getAllMatches(),
|
||||
Future.delayed(minimumSkeletonDuration),
|
||||
Future.delayed(Constants.minimumSkeletonDuration),
|
||||
]).then((results) {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
|
||||
@@ -31,7 +31,7 @@ class _StatisticsViewState extends State<StatisticsView> {
|
||||
Future.wait([
|
||||
db.matchDao.getAllMatches(),
|
||||
db.playerDao.getAllPlayers(),
|
||||
Future.delayed(minimumSkeletonDuration),
|
||||
Future.delayed(Constants.minimumSkeletonDuration),
|
||||
]).then((results) async {
|
||||
if (!mounted) return;
|
||||
final matches = results[0] as List<Match>;
|
||||
|
||||
@@ -52,7 +52,7 @@ class _PlayerSelectionState extends State<PlayerSelection> {
|
||||
void loadPlayerList() {
|
||||
_allPlayersFuture = Future.wait([
|
||||
db.playerDao.getAllPlayers(),
|
||||
Future.delayed(minimumSkeletonDuration),
|
||||
Future.delayed(Constants.minimumSkeletonDuration),
|
||||
]).then((results) => results[0] as List<Player>);
|
||||
if (mounted) {
|
||||
_allPlayersFuture.then((loadedPlayers) {
|
||||
|
||||
Reference in New Issue
Block a user