kopia lustrzana https://gitlab.com/mysocialportal/relatica
53 wiersze
1.6 KiB
Dart
53 wiersze
1.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
import '../controls/padding.dart';
|
|
import '../globals.dart';
|
|
import '../riverpod_controllers/account_services.dart';
|
|
import '../riverpod_controllers/status_service.dart';
|
|
import '../routes.dart';
|
|
|
|
class SplashScreen extends ConsumerWidget {
|
|
const SplashScreen({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
final initializing =
|
|
!ref.watch(accountServicesInitializerProvider.notifier).initialized;
|
|
final loggedIn = ref.watch(activeProfileProvider.notifier).hasActiveProfile;
|
|
if (!initializing && !loggedIn) {
|
|
context.pushNamed(ScreenPaths.signin);
|
|
}
|
|
|
|
return Scaffold(
|
|
body: Center(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
SvgPicture.asset('icon/relatica_logo.svg', width: 128),
|
|
const VerticalPadding(),
|
|
Text(
|
|
'Relatica $appVersion',
|
|
style: Theme.of(context).textTheme.headlineLarge,
|
|
),
|
|
const VerticalPadding(),
|
|
if (initializing) ...[
|
|
const CircularProgressIndicator(),
|
|
const VerticalPadding(),
|
|
const Text('Logging in accounts...'),
|
|
const VerticalPadding(),
|
|
],
|
|
Text(
|
|
ref.watch(statusServiceProvider),
|
|
softWrap: true,
|
|
textAlign: TextAlign.center,
|
|
),
|
|
],
|
|
)),
|
|
);
|
|
}
|
|
}
|