82 lines
2.1 KiB
Dart
82 lines
2.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
import '../../../core/router/routes.dart';
|
|
import '../../../core/constants/app_colors.dart';
|
|
import '../../providers/user_providers.dart';
|
|
|
|
class SplashPage extends ConsumerStatefulWidget {
|
|
const SplashPage({super.key});
|
|
|
|
@override
|
|
ConsumerState<SplashPage> createState() => _SplashPageState();
|
|
}
|
|
|
|
class _SplashPageState extends ConsumerState<SplashPage> {
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_initialize();
|
|
}
|
|
|
|
Future<void> _initialize() async {
|
|
await Future.delayed(const Duration(seconds: 2));
|
|
|
|
if (!mounted) return;
|
|
|
|
// 设置模拟用户
|
|
ref.read(userNotifierProvider.notifier).setMockUser();
|
|
|
|
context.go(Routes.home);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: AppColors.primary,
|
|
body: Center(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Container(
|
|
width: 100,
|
|
height: 100,
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(20),
|
|
),
|
|
child: const Icon(
|
|
Icons.eco,
|
|
size: 60,
|
|
color: AppColors.primary,
|
|
),
|
|
),
|
|
const SizedBox(height: 24),
|
|
const Text(
|
|
'榴莲挖矿',
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 28,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
const Text(
|
|
'绿色财富 共享未来',
|
|
style: TextStyle(
|
|
color: Colors.white70,
|
|
fontSize: 16,
|
|
),
|
|
),
|
|
const SizedBox(height: 48),
|
|
const CircularProgressIndicator(
|
|
color: Colors.white,
|
|
strokeWidth: 2,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|