mirror of
https://github.com/austinried/subtracks.git
synced 2026-02-10 23:02:43 +01:00
migrate l10n, state preloading
This commit is contained in:
30
lib/app/screens/preload_screen.dart
Normal file
30
lib/app/screens/preload_screen.dart
Normal file
@@ -0,0 +1,30 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
|
||||
import '../state/database.dart';
|
||||
import '../state/settings.dart';
|
||||
import '../state/source.dart';
|
||||
|
||||
class PreloadScreen extends HookConsumerWidget {
|
||||
const PreloadScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final initializers = [
|
||||
ref.watch(databaseInitializer),
|
||||
ref.watch(sourceInitializer),
|
||||
ref.watch(packageInfoInitializer),
|
||||
];
|
||||
|
||||
if (initializers.every((v) => v.hasValue)) {
|
||||
Future.delayed(Duration(microseconds: 1)).then((_) {
|
||||
if (context.mounted) {
|
||||
context.replace('/');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return Container();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user