Added constants class

This commit is contained in:
2026-01-07 13:02:09 +01:00
parent 8df9a27dc7
commit a78614851b
6 changed files with 11 additions and 7 deletions

View File

@@ -1,2 +1,6 @@
/// Minimum duration of all app skeletons class Constants {
Duration minimumSkeletonDuration = const Duration(milliseconds: 250); Constants._(); // Private constructor to prevent instantiation
/// Minimum duration of all app skeletons
static Duration minimumSkeletonDuration = const Duration(milliseconds: 250);
}

View File

@@ -101,7 +101,7 @@ class _GroupsViewState extends State<GroupsView> {
void loadGroups() { void loadGroups() {
Future.wait([ Future.wait([
db.groupDao.getAllGroups(), db.groupDao.getAllGroups(),
Future.delayed(minimumSkeletonDuration), Future.delayed(Constants.minimumSkeletonDuration),
]).then((results) { ]).then((results) {
loadedGroups = results[0] as List<Group>; loadedGroups = results[0] as List<Group>;
setState(() { setState(() {

View File

@@ -47,7 +47,7 @@ class _HomeViewState extends State<HomeView> {
db.matchDao.getMatchCount(), db.matchDao.getMatchCount(),
db.groupDao.getGroupCount(), db.groupDao.getGroupCount(),
db.matchDao.getAllMatches(), db.matchDao.getAllMatches(),
Future.delayed(minimumSkeletonDuration), Future.delayed(Constants.minimumSkeletonDuration),
]).then((results) { ]).then((results) {
matchCount = results[0] as int; matchCount = results[0] as int;
groupCount = results[1] as int; groupCount = results[1] as int;

View File

@@ -120,7 +120,7 @@ class _MatchViewState extends State<MatchView> {
void loadGames() { void loadGames() {
Future.wait([ Future.wait([
db.matchDao.getAllMatches(), db.matchDao.getAllMatches(),
Future.delayed(minimumSkeletonDuration), Future.delayed(Constants.minimumSkeletonDuration),
]).then((results) { ]).then((results) {
if (mounted) { if (mounted) {
setState(() { setState(() {

View File

@@ -31,7 +31,7 @@ class _StatisticsViewState extends State<StatisticsView> {
Future.wait([ Future.wait([
db.matchDao.getAllMatches(), db.matchDao.getAllMatches(),
db.playerDao.getAllPlayers(), db.playerDao.getAllPlayers(),
Future.delayed(minimumSkeletonDuration), Future.delayed(Constants.minimumSkeletonDuration),
]).then((results) async { ]).then((results) async {
if (!mounted) return; if (!mounted) return;
final matches = results[0] as List<Match>; final matches = results[0] as List<Match>;

View File

@@ -52,7 +52,7 @@ class _PlayerSelectionState extends State<PlayerSelection> {
void loadPlayerList() { void loadPlayerList() {
_allPlayersFuture = Future.wait([ _allPlayersFuture = Future.wait([
db.playerDao.getAllPlayers(), db.playerDao.getAllPlayers(),
Future.delayed(minimumSkeletonDuration), Future.delayed(Constants.minimumSkeletonDuration),
]).then((results) => results[0] as List<Player>); ]).then((results) => results[0] as List<Player>);
if (mounted) { if (mounted) {
_allPlayersFuture.then((loadedPlayers) { _allPlayersFuture.then((loadedPlayers) {