added const
This commit is contained in:
@@ -56,7 +56,7 @@ class _CustomNavigationBarState extends State<CustomNavigationBar>
|
|||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await Navigator.push(
|
await Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (_) => SettingsView()),
|
MaterialPageRoute(builder: (_) => const SettingsView()),
|
||||||
);
|
);
|
||||||
setState(() {
|
setState(() {
|
||||||
tabKeyCount++;
|
tabKeyCount++;
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ class GameHistoryView extends StatefulWidget {
|
|||||||
class _GameHistoryViewState extends State<GameHistoryView> {
|
class _GameHistoryViewState extends State<GameHistoryView> {
|
||||||
late Future<List<Game>> _gameListFuture;
|
late Future<List<Game>> _gameListFuture;
|
||||||
late final AppDatabase db;
|
late final AppDatabase db;
|
||||||
late bool isLoading = true;
|
|
||||||
|
|
||||||
late final List<Game> skeletonData = List.filled(
|
late final List<Game> skeletonData = List.filled(
|
||||||
4,
|
4,
|
||||||
@@ -51,9 +50,6 @@ class _GameHistoryViewState extends State<GameHistoryView> {
|
|||||||
|
|
||||||
Future.wait([_gameListFuture]).then((result) async {
|
Future.wait([_gameListFuture]).then((result) async {
|
||||||
await Future.delayed(const Duration(milliseconds: 250));
|
await Future.delayed(const Duration(milliseconds: 250));
|
||||||
setState(() {
|
|
||||||
isLoading = false;
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,14 +83,14 @@ class _GameHistoryViewState extends State<GameHistoryView> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
final bool isLoading =
|
||||||
|
snapshot.connectionState == ConnectionState.waiting;
|
||||||
final List<Game> games =
|
final List<Game> games =
|
||||||
(isLoading ? skeletonData : (snapshot.data ?? [])
|
(isLoading ? skeletonData : (snapshot.data ?? [])
|
||||||
..sort(
|
..sort(
|
||||||
(a, b) => b.createdAt.compareTo(a.createdAt),
|
(a, b) => b.createdAt.compareTo(a.createdAt),
|
||||||
))
|
))
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
return AppSkeleton(
|
return AppSkeleton(
|
||||||
enabled: isLoading,
|
enabled: isLoading,
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
|
|||||||
Reference in New Issue
Block a user