update news
This commit is contained in:
82
lib/features/auth/presentation/pages/splash_page.dart
Normal file
82
lib/features/auth/presentation/pages/splash_page.dart
Normal file
@@ -0,0 +1,82 @@
|
||||
/// Splash Screen Page
|
||||
///
|
||||
/// Displays while checking authentication state on app startup.
|
||||
library;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:worker/core/theme/colors.dart';
|
||||
|
||||
/// Splash Page
|
||||
///
|
||||
/// Shows a loading screen while the app checks for stored authentication.
|
||||
/// This prevents the brief flash of login page before redirecting to home.
|
||||
class SplashPage extends StatelessWidget {
|
||||
const SplashPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.white,
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
// Logo
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 32.0, vertical: 20.0),
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
colors: [AppColors.primaryBlue, AppColors.lightBlue],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(20.0),
|
||||
),
|
||||
child: const Column(
|
||||
children: [
|
||||
Text(
|
||||
'EUROTILE',
|
||||
style: TextStyle(
|
||||
color: AppColors.white,
|
||||
fontSize: 32.0,
|
||||
fontWeight: FontWeight.w700,
|
||||
letterSpacing: 1.5,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 4.0),
|
||||
Text(
|
||||
'Worker App',
|
||||
style: TextStyle(
|
||||
color: AppColors.white,
|
||||
fontSize: 12.0,
|
||||
letterSpacing: 0.5,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 48.0),
|
||||
|
||||
// Loading Indicator
|
||||
const CircularProgressIndicator(
|
||||
valueColor: AlwaysStoppedAnimation<Color>(AppColors.primaryBlue),
|
||||
strokeWidth: 3.0,
|
||||
),
|
||||
|
||||
const SizedBox(height: 16.0),
|
||||
|
||||
// Loading Text
|
||||
const Text(
|
||||
'Đang tải...',
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
color: AppColors.grey500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -272,7 +272,7 @@ final class AuthProvider extends $AsyncNotifierProvider<Auth, User?> {
|
||||
Auth create() => Auth();
|
||||
}
|
||||
|
||||
String _$authHash() => r'3f0562ffb573be47d8aae8beebccb1946240cbb6';
|
||||
String _$authHash() => r'f1a16022d628a21f230c0bb567e80ff6e293d840';
|
||||
|
||||
/// Authentication Provider
|
||||
///
|
||||
@@ -591,3 +591,69 @@ final class UserTotalPointsProvider extends $FunctionalProvider<int, int, int>
|
||||
}
|
||||
|
||||
String _$userTotalPointsHash() => r'9ccebb48a8641c3c0624b1649303b436e82602bd';
|
||||
|
||||
/// Initialize Frappe session
|
||||
///
|
||||
/// Call this to ensure a Frappe session exists before making API calls.
|
||||
/// This is separate from the Auth provider to avoid disposal issues.
|
||||
///
|
||||
/// Usage:
|
||||
/// ```dart
|
||||
/// // On login page or before API calls that need session
|
||||
/// await ref.read(initializeFrappeSessionProvider.future);
|
||||
/// ```
|
||||
|
||||
@ProviderFor(initializeFrappeSession)
|
||||
const initializeFrappeSessionProvider = InitializeFrappeSessionProvider._();
|
||||
|
||||
/// Initialize Frappe session
|
||||
///
|
||||
/// Call this to ensure a Frappe session exists before making API calls.
|
||||
/// This is separate from the Auth provider to avoid disposal issues.
|
||||
///
|
||||
/// Usage:
|
||||
/// ```dart
|
||||
/// // On login page or before API calls that need session
|
||||
/// await ref.read(initializeFrappeSessionProvider.future);
|
||||
/// ```
|
||||
|
||||
final class InitializeFrappeSessionProvider
|
||||
extends $FunctionalProvider<AsyncValue<void>, void, FutureOr<void>>
|
||||
with $FutureModifier<void>, $FutureProvider<void> {
|
||||
/// Initialize Frappe session
|
||||
///
|
||||
/// Call this to ensure a Frappe session exists before making API calls.
|
||||
/// This is separate from the Auth provider to avoid disposal issues.
|
||||
///
|
||||
/// Usage:
|
||||
/// ```dart
|
||||
/// // On login page or before API calls that need session
|
||||
/// await ref.read(initializeFrappeSessionProvider.future);
|
||||
/// ```
|
||||
const InitializeFrappeSessionProvider._()
|
||||
: super(
|
||||
from: null,
|
||||
argument: null,
|
||||
retry: null,
|
||||
name: r'initializeFrappeSessionProvider',
|
||||
isAutoDispose: true,
|
||||
dependencies: null,
|
||||
$allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@override
|
||||
String debugGetCreateSourceHash() => _$initializeFrappeSessionHash();
|
||||
|
||||
@$internal
|
||||
@override
|
||||
$FutureProviderElement<void> $createElement($ProviderPointer pointer) =>
|
||||
$FutureProviderElement(pointer);
|
||||
|
||||
@override
|
||||
FutureOr<void> create(Ref ref) {
|
||||
return initializeFrappeSession(ref);
|
||||
}
|
||||
}
|
||||
|
||||
String _$initializeFrappeSessionHash() =>
|
||||
r'1a9001246a39396e4712efc2cbeb0cac8b911f0c';
|
||||
|
||||
Reference in New Issue
Block a user