Added constants class
This commit is contained in:
@@ -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);
|
||||||
|
}
|
||||||
|
|||||||
@@ -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(() {
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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(() {
|
||||||
|
|||||||
@@ -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>;
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user