refactor(splash): 简化开屏动画为纯帧播放,恢复监控Tab
- 重构 splash_page.dart: 移除 video_player 依赖,改用纯帧动画播放 - 帧数从53张调整为36张,添加预加载优化 - 移除 pubspec.yaml 中的 video_player 依赖 - 恢复底部导航栏"监控"Tab(原"矿机") - 调整路由索引:0-龙虎榜, 1-监控, 2-兑换, 3-我 - 移除"我的"页面的"领取全部"按钮 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Before Width: | Height: | Size: 866 KiB After Width: | Height: | Size: 1.9 MiB |
|
Before Width: | Height: | Size: 943 KiB After Width: | Height: | Size: 2.0 MiB |
|
Before Width: | Height: | Size: 968 KiB After Width: | Height: | Size: 2.0 MiB |
|
Before Width: | Height: | Size: 986 KiB After Width: | Height: | Size: 2.1 MiB |
|
Before Width: | Height: | Size: 985 KiB After Width: | Height: | Size: 2.0 MiB |
|
Before Width: | Height: | Size: 931 KiB After Width: | Height: | Size: 2.1 MiB |
|
Before Width: | Height: | Size: 975 KiB After Width: | Height: | Size: 2.1 MiB |
|
Before Width: | Height: | Size: 982 KiB After Width: | Height: | Size: 2.1 MiB |
|
Before Width: | Height: | Size: 971 KiB After Width: | Height: | Size: 2.0 MiB |
|
Before Width: | Height: | Size: 954 KiB After Width: | Height: | Size: 2.0 MiB |
|
Before Width: | Height: | Size: 903 KiB After Width: | Height: | Size: 2.1 MiB |
|
Before Width: | Height: | Size: 960 KiB After Width: | Height: | Size: 2.0 MiB |
|
Before Width: | Height: | Size: 972 KiB After Width: | Height: | Size: 2.0 MiB |
|
Before Width: | Height: | Size: 974 KiB After Width: | Height: | Size: 2.0 MiB |
|
Before Width: | Height: | Size: 972 KiB After Width: | Height: | Size: 2.0 MiB |
|
Before Width: | Height: | Size: 921 KiB After Width: | Height: | Size: 1.7 MiB |
|
Before Width: | Height: | Size: 958 KiB After Width: | Height: | Size: 1.9 MiB |
|
Before Width: | Height: | Size: 959 KiB After Width: | Height: | Size: 1.8 MiB |
|
Before Width: | Height: | Size: 935 KiB After Width: | Height: | Size: 1.8 MiB |
|
Before Width: | Height: | Size: 904 KiB After Width: | Height: | Size: 1.6 MiB |
|
Before Width: | Height: | Size: 820 KiB After Width: | Height: | Size: 1.7 MiB |
|
Before Width: | Height: | Size: 867 KiB After Width: | Height: | Size: 1.6 MiB |
|
Before Width: | Height: | Size: 872 KiB After Width: | Height: | Size: 1.6 MiB |
|
Before Width: | Height: | Size: 861 KiB After Width: | Height: | Size: 1.5 MiB |
|
Before Width: | Height: | Size: 840 KiB After Width: | Height: | Size: 1.5 MiB |
|
Before Width: | Height: | Size: 767 KiB After Width: | Height: | Size: 1.5 MiB |
|
Before Width: | Height: | Size: 812 KiB After Width: | Height: | Size: 1.6 MiB |
|
Before Width: | Height: | Size: 823 KiB After Width: | Height: | Size: 1.5 MiB |
|
Before Width: | Height: | Size: 805 KiB After Width: | Height: | Size: 1.6 MiB |
|
Before Width: | Height: | Size: 781 KiB After Width: | Height: | Size: 1.6 MiB |
|
Before Width: | Height: | Size: 693 KiB After Width: | Height: | Size: 1.7 MiB |
|
Before Width: | Height: | Size: 760 KiB After Width: | Height: | Size: 1.7 MiB |
|
Before Width: | Height: | Size: 788 KiB After Width: | Height: | Size: 1.8 MiB |
|
Before Width: | Height: | Size: 799 KiB After Width: | Height: | Size: 1.8 MiB |
|
Before Width: | Height: | Size: 806 KiB After Width: | Height: | Size: 1.9 MiB |
|
Before Width: | Height: | Size: 734 KiB After Width: | Height: | Size: 1.9 MiB |
|
Before Width: | Height: | Size: 820 KiB |
|
Before Width: | Height: | Size: 848 KiB |
|
Before Width: | Height: | Size: 857 KiB |
|
Before Width: | Height: | Size: 876 KiB |
|
Before Width: | Height: | Size: 817 KiB |
|
Before Width: | Height: | Size: 894 KiB |
|
Before Width: | Height: | Size: 924 KiB |
|
Before Width: | Height: | Size: 936 KiB |
|
Before Width: | Height: | Size: 941 KiB |
|
Before Width: | Height: | Size: 896 KiB |
|
Before Width: | Height: | Size: 936 KiB |
|
Before Width: | Height: | Size: 941 KiB |
|
Before Width: | Height: | Size: 936 KiB |
|
Before Width: | Height: | Size: 923 KiB |
|
Before Width: | Height: | Size: 870 KiB |
|
Before Width: | Height: | Size: 874 KiB |
|
Before Width: | Height: | Size: 873 KiB |
|
|
@ -1,14 +1,13 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:video_player/video_player.dart';
|
|
||||||
import '../../../../routes/route_paths.dart';
|
import '../../../../routes/route_paths.dart';
|
||||||
import '../../../../routes/app_router.dart';
|
import '../../../../routes/app_router.dart';
|
||||||
import '../../../../bootstrap.dart';
|
import '../../../../bootstrap.dart';
|
||||||
import '../providers/auth_provider.dart';
|
import '../providers/auth_provider.dart';
|
||||||
|
|
||||||
/// 开屏页面 - 应用启动时显示的第一个页面
|
/// 开屏页面 - 应用启动时显示的第一个页面
|
||||||
/// 播放开屏视频,视频结束后检查用户认证状态并跳转
|
/// 播放帧动画,动画结束后检查用户认证状态并跳转
|
||||||
class SplashPage extends ConsumerStatefulWidget {
|
class SplashPage extends ConsumerStatefulWidget {
|
||||||
const SplashPage({super.key});
|
const SplashPage({super.key});
|
||||||
|
|
||||||
|
|
@ -17,11 +16,14 @@ class SplashPage extends ConsumerStatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _SplashPageState extends ConsumerState<SplashPage> {
|
class _SplashPageState extends ConsumerState<SplashPage> {
|
||||||
/// 视频播放控制器
|
/// 帧动画总帧数
|
||||||
VideoPlayerController? _videoController;
|
static const int _totalFrames = 36;
|
||||||
|
|
||||||
/// 视频是否已初始化
|
/// 帧动画帧率 (fps)
|
||||||
bool _isVideoInitialized = false;
|
static const int _frameRate = 15;
|
||||||
|
|
||||||
|
/// 当前显示的帧索引 (0-based)
|
||||||
|
int _currentFrameIndex = 0;
|
||||||
|
|
||||||
/// 是否显示跳过按钮
|
/// 是否显示跳过按钮
|
||||||
bool _showSkipButton = false;
|
bool _showSkipButton = false;
|
||||||
|
|
@ -29,168 +31,85 @@ class _SplashPageState extends ConsumerState<SplashPage> {
|
||||||
/// 是否已经开始跳转(防止重复跳转)
|
/// 是否已经开始跳转(防止重复跳转)
|
||||||
bool _isNavigating = false;
|
bool _isNavigating = false;
|
||||||
|
|
||||||
/// 视频加载是否失败(使用 fallback 动画)
|
|
||||||
bool _videoFailed = false;
|
|
||||||
|
|
||||||
/// 帧动画总帧数
|
|
||||||
static const int _totalFrames = 53;
|
|
||||||
|
|
||||||
/// 帧动画帧率 (fps)
|
|
||||||
static const int _frameRate = 15;
|
|
||||||
|
|
||||||
/// 当前显示的帧索引
|
|
||||||
int _currentFrameIndex = 0;
|
|
||||||
|
|
||||||
/// 帧动画是否正在播放
|
/// 帧动画是否正在播放
|
||||||
bool _isFrameAnimationPlaying = false;
|
bool _isPlaying = true;
|
||||||
|
|
||||||
|
/// 预加载的图片缓存
|
||||||
|
final List<ImageProvider> _frameProviders = [];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_initializeVideo();
|
_initializeFrames();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 初始化帧动画
|
||||||
|
void _initializeFrames() {
|
||||||
|
// 创建所有帧的 ImageProvider(不会立即加载,只是创建引用)
|
||||||
|
for (int i = 1; i <= _totalFrames; i++) {
|
||||||
|
final frameNumber = i.toString().padLeft(3, '0');
|
||||||
|
final framePath = 'assets/images/splash_frames/frame_$frameNumber.png';
|
||||||
|
_frameProviders.add(AssetImage(framePath));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 启动帧动画播放
|
||||||
|
_playAnimation();
|
||||||
|
|
||||||
|
// 1秒后显示跳过按钮
|
||||||
|
Future.delayed(const Duration(seconds: 1), () {
|
||||||
|
if (mounted) {
|
||||||
|
setState(() {
|
||||||
|
_showSkipButton = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void didChangeDependencies() {
|
||||||
_videoController?.removeListener(_onVideoStateChanged);
|
super.didChangeDependencies();
|
||||||
_videoController?.dispose();
|
// 预加载前几帧到内存,确保播放流畅
|
||||||
super.dispose();
|
_precacheInitialFrames();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 初始化视频播放器
|
/// 预加载前几帧
|
||||||
Future<void> _initializeVideo() async {
|
void _precacheInitialFrames() {
|
||||||
debugPrint('[SplashPage] ========== 开始初始化视频 ==========');
|
// 预加载前5帧,确保启动时不卡顿
|
||||||
debugPrint('[SplashPage] 视频路径: assets/videos/splash.mp4');
|
final framesToPrecache = _totalFrames < 5 ? _totalFrames : 5;
|
||||||
|
for (int i = 0; i < framesToPrecache; i++) {
|
||||||
try {
|
precacheImage(_frameProviders[i], context);
|
||||||
// 从 assets 加载视频
|
|
||||||
debugPrint('[SplashPage] 创建 VideoPlayerController...');
|
|
||||||
_videoController = VideoPlayerController.asset('assets/videos/splash.mp4');
|
|
||||||
|
|
||||||
debugPrint('[SplashPage] 开始 initialize()...');
|
|
||||||
final stopwatch = Stopwatch()..start();
|
|
||||||
await _videoController!.initialize();
|
|
||||||
stopwatch.stop();
|
|
||||||
debugPrint('[SplashPage] initialize() 完成,耗时: ${stopwatch.elapsedMilliseconds}ms');
|
|
||||||
|
|
||||||
// 打印视频信息
|
|
||||||
final value = _videoController!.value;
|
|
||||||
debugPrint('[SplashPage] 视频信息:');
|
|
||||||
debugPrint('[SplashPage] - 尺寸: ${value.size.width} x ${value.size.height}');
|
|
||||||
debugPrint('[SplashPage] - 时长: ${value.duration.inMilliseconds}ms');
|
|
||||||
debugPrint('[SplashPage] - 是否已初始化: ${value.isInitialized}');
|
|
||||||
debugPrint('[SplashPage] - 是否有错误: ${value.hasError}');
|
|
||||||
if (value.hasError) {
|
|
||||||
debugPrint('[SplashPage] - 错误信息: ${value.errorDescription}');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mounted) {
|
|
||||||
setState(() {
|
|
||||||
_isVideoInitialized = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
// 设置视频播放完成监听
|
|
||||||
_videoController!.addListener(_onVideoStateChanged);
|
|
||||||
|
|
||||||
// 开始播放视频
|
|
||||||
debugPrint('[SplashPage] 开始播放视频...');
|
|
||||||
await _videoController!.play();
|
|
||||||
debugPrint('[SplashPage] play() 调用完成,isPlaying: ${_videoController!.value.isPlaying}');
|
|
||||||
|
|
||||||
// 1秒后显示跳过按钮
|
|
||||||
Future.delayed(const Duration(seconds: 1), () {
|
|
||||||
if (mounted) {
|
|
||||||
setState(() {
|
|
||||||
_showSkipButton = true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} catch (e, stackTrace) {
|
|
||||||
debugPrint('[SplashPage] ========== 视频初始化失败 ==========');
|
|
||||||
debugPrint('[SplashPage] 错误类型: ${e.runtimeType}');
|
|
||||||
debugPrint('[SplashPage] 错误信息: $e');
|
|
||||||
debugPrint('[SplashPage] 堆栈跟踪:\n$stackTrace');
|
|
||||||
|
|
||||||
// 检查 controller 状态
|
|
||||||
if (_videoController != null) {
|
|
||||||
final value = _videoController!.value;
|
|
||||||
debugPrint('[SplashPage] Controller 状态:');
|
|
||||||
debugPrint('[SplashPage] - 是否已初始化: ${value.isInitialized}');
|
|
||||||
debugPrint('[SplashPage] - 是否有错误: ${value.hasError}');
|
|
||||||
if (value.hasError) {
|
|
||||||
debugPrint('[SplashPage] - 错误描述: ${value.errorDescription}');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果视频加载失败,启动 fallback 动画
|
|
||||||
_startFallbackAnimation();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 启动 fallback 帧动画(视频加载失败时使用)
|
|
||||||
void _startFallbackAnimation() {
|
|
||||||
debugPrint('[SplashPage] 启动 fallback 帧动画,共 $_totalFrames 帧');
|
|
||||||
|
|
||||||
setState(() {
|
|
||||||
_videoFailed = true;
|
|
||||||
_isFrameAnimationPlaying = true;
|
|
||||||
_currentFrameIndex = 0;
|
|
||||||
});
|
|
||||||
|
|
||||||
// 启动帧动画播放
|
|
||||||
_playFrameAnimation();
|
|
||||||
|
|
||||||
// 1秒后显示跳过按钮
|
|
||||||
Future.delayed(const Duration(seconds: 1), () {
|
|
||||||
if (mounted) {
|
|
||||||
setState(() {
|
|
||||||
_showSkipButton = true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 播放帧动画
|
/// 播放帧动画
|
||||||
Future<void> _playFrameAnimation() async {
|
Future<void> _playAnimation() async {
|
||||||
final frameDuration = Duration(milliseconds: 1000 ~/ _frameRate);
|
final frameDuration = Duration(milliseconds: 1000 ~/ _frameRate);
|
||||||
|
|
||||||
while (_isFrameAnimationPlaying && _currentFrameIndex < _totalFrames && mounted) {
|
while (_isPlaying && _currentFrameIndex < _totalFrames - 1 && mounted) {
|
||||||
await Future.delayed(frameDuration);
|
await Future.delayed(frameDuration);
|
||||||
|
|
||||||
if (!mounted || !_isFrameAnimationPlaying) break;
|
if (!mounted || !_isPlaying) break;
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
_currentFrameIndex++;
|
_currentFrameIndex++;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 预加载后续帧(提前2帧预加载)
|
||||||
|
final nextFrameIndex = _currentFrameIndex + 2;
|
||||||
|
if (nextFrameIndex < _totalFrames) {
|
||||||
|
precacheImage(_frameProviders[nextFrameIndex], context);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 动画播放完成
|
// 动画播放完成
|
||||||
if (_currentFrameIndex >= _totalFrames && mounted && _isFrameAnimationPlaying) {
|
if (_currentFrameIndex >= _totalFrames - 1 && mounted && _isPlaying) {
|
||||||
_navigateToNextPage();
|
_navigateToNextPage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 跳过 fallback 帧动画
|
/// 跳过动画
|
||||||
void _skipFallbackAnimation() {
|
void _skipAnimation() {
|
||||||
_isFrameAnimationPlaying = false;
|
_isPlaying = false;
|
||||||
_navigateToNextPage();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 视频状态变化监听
|
|
||||||
void _onVideoStateChanged() {
|
|
||||||
if (_videoController == null) return;
|
|
||||||
|
|
||||||
// 视频播放完成
|
|
||||||
if (_videoController!.value.position >= _videoController!.value.duration &&
|
|
||||||
_videoController!.value.duration > Duration.zero) {
|
|
||||||
_navigateToNextPage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 跳过视频
|
|
||||||
void _skipVideo() {
|
|
||||||
_videoController?.pause();
|
|
||||||
_navigateToNextPage();
|
_navigateToNextPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -249,24 +168,8 @@ class _SplashPageState extends ConsumerState<SplashPage> {
|
||||||
body: Stack(
|
body: Stack(
|
||||||
fit: StackFit.expand,
|
fit: StackFit.expand,
|
||||||
children: [
|
children: [
|
||||||
// 视频播放器(全屏覆盖)
|
// 帧动画(全屏覆盖)
|
||||||
if (_isVideoInitialized && _videoController != null)
|
_buildFrameAnimation(),
|
||||||
SizedBox.expand(
|
|
||||||
child: FittedBox(
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
child: SizedBox(
|
|
||||||
width: _videoController!.value.size.width,
|
|
||||||
height: _videoController!.value.size.height,
|
|
||||||
child: VideoPlayer(_videoController!),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
else if (_videoFailed)
|
|
||||||
// 视频加载失败,显示 fallback 动画
|
|
||||||
_buildFallbackAnimationView()
|
|
||||||
else
|
|
||||||
// 视频加载中显示 Logo
|
|
||||||
_buildLoadingView(),
|
|
||||||
|
|
||||||
// 跳过按钮
|
// 跳过按钮
|
||||||
if (_showSkipButton)
|
if (_showSkipButton)
|
||||||
|
|
@ -280,108 +183,13 @@ class _SplashPageState extends ConsumerState<SplashPage> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 构建加载中视图(视频未加载完成时显示)
|
/// 构建帧动画视图
|
||||||
Widget _buildLoadingView() {
|
Widget _buildFrameAnimation() {
|
||||||
return Container(
|
|
||||||
width: double.infinity,
|
|
||||||
height: double.infinity,
|
|
||||||
decoration: const BoxDecoration(
|
|
||||||
gradient: LinearGradient(
|
|
||||||
begin: Alignment.topCenter,
|
|
||||||
end: Alignment.bottomCenter,
|
|
||||||
colors: [
|
|
||||||
Color(0xFFFFF5E6),
|
|
||||||
Color(0xFFFFE4B5),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
// Logo
|
|
||||||
Image.asset(
|
|
||||||
'assets/images/logo/app_icon.png',
|
|
||||||
width: 128,
|
|
||||||
height: 128,
|
|
||||||
),
|
|
||||||
const SizedBox(height: 24),
|
|
||||||
const Text(
|
|
||||||
'榴莲皇后',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 32,
|
|
||||||
fontFamily: 'Noto Sans SC',
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
height: 1.25,
|
|
||||||
letterSpacing: 1.6,
|
|
||||||
color: Color(0xFF4A3F35),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 24),
|
|
||||||
// 加载指示器
|
|
||||||
const SizedBox(
|
|
||||||
width: 24,
|
|
||||||
height: 24,
|
|
||||||
child: CircularProgressIndicator(
|
|
||||||
strokeWidth: 2,
|
|
||||||
valueColor: AlwaysStoppedAnimation<Color>(Color(0xFFD4AF37)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 构建 fallback 帧动画视图(视频加载失败时使用)
|
|
||||||
Widget _buildFallbackAnimationView() {
|
|
||||||
// 帧文件名格式: frame_001.png, frame_002.png, ... frame_053.png
|
|
||||||
final frameNumber = (_currentFrameIndex + 1).toString().padLeft(3, '0');
|
|
||||||
final framePath = 'assets/images/splash_frames/frame_$frameNumber.png';
|
|
||||||
|
|
||||||
return SizedBox.expand(
|
return SizedBox.expand(
|
||||||
child: Image.asset(
|
child: Image(
|
||||||
framePath,
|
image: _frameProviders[_currentFrameIndex],
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
gaplessPlayback: true, // 关键:防止帧切换时闪烁
|
gaplessPlayback: true, // 关键:防止帧切换时闪烁
|
||||||
errorBuilder: (context, error, stackTrace) {
|
|
||||||
// 帧加载失败时显示静态 fallback
|
|
||||||
debugPrint('[SplashPage] 帧加载失败: $framePath, 错误: $error');
|
|
||||||
return Container(
|
|
||||||
width: double.infinity,
|
|
||||||
height: double.infinity,
|
|
||||||
decoration: const BoxDecoration(
|
|
||||||
gradient: LinearGradient(
|
|
||||||
begin: Alignment.topCenter,
|
|
||||||
end: Alignment.bottomCenter,
|
|
||||||
colors: [
|
|
||||||
Color(0xFFFFF5E6),
|
|
||||||
Color(0xFFFFE4B5),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Image.asset(
|
|
||||||
'assets/images/logo/app_icon.png',
|
|
||||||
width: 128,
|
|
||||||
height: 128,
|
|
||||||
),
|
|
||||||
const SizedBox(height: 24),
|
|
||||||
const Text(
|
|
||||||
'榴莲皇后',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 32,
|
|
||||||
fontFamily: 'Noto Sans SC',
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
height: 1.25,
|
|
||||||
letterSpacing: 1.6,
|
|
||||||
color: Color(0xFF4A3F35),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -389,7 +197,7 @@ class _SplashPageState extends ConsumerState<SplashPage> {
|
||||||
/// 构建跳过按钮
|
/// 构建跳过按钮
|
||||||
Widget _buildSkipButton() {
|
Widget _buildSkipButton() {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: _videoFailed ? _skipFallbackAnimation : _skipVideo,
|
onTap: _skipAnimation,
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
|
|
|
||||||
|
|
@ -60,27 +60,27 @@ class _HomeShellPageState extends ConsumerState<HomeShellPage>
|
||||||
|
|
||||||
int _getCurrentIndex(BuildContext context) {
|
int _getCurrentIndex(BuildContext context) {
|
||||||
final location = GoRouterState.of(context).uri.path;
|
final location = GoRouterState.of(context).uri.path;
|
||||||
// 矿机Tab暂时隐藏,索引调整为: 0-龙虎榜, 1-兑换, 2-我
|
// 索引: 0-龙虎榜, 1-监控, 2-兑换, 3-我
|
||||||
if (location.startsWith(RoutePaths.ranking)) return 0;
|
if (location.startsWith(RoutePaths.ranking)) return 0;
|
||||||
// if (location.startsWith(RoutePaths.mining)) return 1; // 矿机暂时隐藏
|
if (location.startsWith(RoutePaths.mining)) return 1;
|
||||||
if (location.startsWith(RoutePaths.trading)) return 1;
|
if (location.startsWith(RoutePaths.trading)) return 2;
|
||||||
if (location.startsWith(RoutePaths.profile)) return 2;
|
if (location.startsWith(RoutePaths.profile)) return 3;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onTabTapped(BuildContext context, int index) {
|
void _onTabTapped(BuildContext context, int index) {
|
||||||
// 矿机Tab暂时隐藏,索引调整为: 0-龙虎榜, 1-兑换, 2-我
|
// 索引: 0-龙虎榜, 1-监控, 2-兑换, 3-我
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
context.go(RoutePaths.ranking);
|
context.go(RoutePaths.ranking);
|
||||||
break;
|
break;
|
||||||
// case 1: // 矿机暂时隐藏
|
|
||||||
// context.go(RoutePaths.mining);
|
|
||||||
// break;
|
|
||||||
case 1:
|
case 1:
|
||||||
context.go(RoutePaths.trading);
|
context.go(RoutePaths.mining);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
context.go(RoutePaths.trading);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
context.go(RoutePaths.profile);
|
context.go(RoutePaths.profile);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
/// 底部导航栏组件
|
/// 底部导航栏组件
|
||||||
/// 包含三个Tab:龙虎榜、兑换、我
|
/// 包含四个Tab:龙虎榜、监控、兑换、我
|
||||||
/// 注意:矿机Tab暂时隐藏(未删除代码,方便后续恢复)
|
|
||||||
/// 自定义设计风格,使用 LayoutBuilder 确保自适应
|
/// 自定义设计风格,使用 LayoutBuilder 确保自适应
|
||||||
class BottomNavBar extends StatelessWidget {
|
class BottomNavBar extends StatelessWidget {
|
||||||
final int currentIndex;
|
final int currentIndex;
|
||||||
|
|
@ -42,21 +41,20 @@ class BottomNavBar extends StatelessWidget {
|
||||||
activeIcon: Icons.leaderboard,
|
activeIcon: Icons.leaderboard,
|
||||||
label: '龙虎榜',
|
label: '龙虎榜',
|
||||||
),
|
),
|
||||||
// 矿机Tab暂时隐藏,保留代码方便后续恢复
|
|
||||||
// _buildNavItem(
|
|
||||||
// index: 1,
|
|
||||||
// icon: Icons.memory_outlined,
|
|
||||||
// activeIcon: Icons.memory,
|
|
||||||
// label: '矿机',
|
|
||||||
// ),
|
|
||||||
_buildNavItem(
|
_buildNavItem(
|
||||||
index: 1, // 原 index: 2
|
index: 1,
|
||||||
|
icon: Icons.monitor_heart_outlined,
|
||||||
|
activeIcon: Icons.monitor_heart,
|
||||||
|
label: '监控',
|
||||||
|
),
|
||||||
|
_buildNavItem(
|
||||||
|
index: 2,
|
||||||
icon: Icons.swap_horiz_outlined,
|
icon: Icons.swap_horiz_outlined,
|
||||||
activeIcon: Icons.swap_horiz,
|
activeIcon: Icons.swap_horiz,
|
||||||
label: '兑换',
|
label: '兑换',
|
||||||
),
|
),
|
||||||
_buildNavItem(
|
_buildNavItem(
|
||||||
index: 2, // 原 index: 3
|
index: 3,
|
||||||
icon: Icons.person_outline,
|
icon: Icons.person_outline,
|
||||||
activeIcon: Icons.person,
|
activeIcon: Icons.person,
|
||||||
label: '我',
|
label: '我',
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ enum MiningStatus {
|
||||||
paused, // 已暂停
|
paused, // 已暂停
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 矿机页面 - 显示挖矿状态和控制
|
/// 监控页面 - 显示挖矿状态和控制
|
||||||
/// 展示用户序列号、社区信息和挖矿开关
|
/// 展示用户序列号、社区信息和挖矿开关
|
||||||
class MiningPage extends ConsumerStatefulWidget {
|
class MiningPage extends ConsumerStatefulWidget {
|
||||||
const MiningPage({super.key});
|
const MiningPage({super.key});
|
||||||
|
|
@ -130,8 +130,8 @@ class _MiningPageState extends ConsumerState<MiningPage> {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => AlertDialog(
|
builder: (context) => AlertDialog(
|
||||||
title: const Text('矿机说明'),
|
title: const Text('监控说明'),
|
||||||
content: const Text('矿机是您参与挖矿的核心工具。\n\n'
|
content: const Text('监控是您查看挖矿状态的工具。\n\n'
|
||||||
'开启挖矿后,您将开始获得收益。\n\n'
|
'开启挖矿后,您将开始获得收益。\n\n'
|
||||||
'收益与您的算力和团队规模相关。'),
|
'收益与您的算力和团队规模相关。'),
|
||||||
actions: [
|
actions: [
|
||||||
|
|
@ -217,7 +217,7 @@ class _MiningPageState extends ConsumerState<MiningPage> {
|
||||||
// 标题
|
// 标题
|
||||||
const Expanded(
|
const Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
'矿机',
|
'监控',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
fontFamily: 'Inter',
|
fontFamily: 'Inter',
|
||||||
|
|
|
||||||
|
|
@ -1500,32 +1500,6 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
|
||||||
// 奖励条目列表
|
// 奖励条目列表
|
||||||
...(_pendingRewards.map((item) => _buildPendingRewardItem(item))),
|
...(_pendingRewards.map((item) => _buildPendingRewardItem(item))),
|
||||||
],
|
],
|
||||||
const SizedBox(height: 15),
|
|
||||||
// 领取全部按钮
|
|
||||||
GestureDetector(
|
|
||||||
onTap: _claimAllEarnings,
|
|
||||||
child: Container(
|
|
||||||
width: double.infinity,
|
|
||||||
height: 40,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: const Color(0xFFD4AF37),
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
child: const Center(
|
|
||||||
child: Text(
|
|
||||||
'领取全部',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 14,
|
|
||||||
fontFamily: 'Inter',
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
height: 1.5,
|
|
||||||
letterSpacing: 0.21,
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,6 @@ dependencies:
|
||||||
mobile_scanner: ^5.1.1
|
mobile_scanner: ^5.1.1
|
||||||
flutter_screenutil: ^5.9.0
|
flutter_screenutil: ^5.9.0
|
||||||
city_pickers: ^1.3.0
|
city_pickers: ^1.3.0
|
||||||
video_player: ^2.8.6
|
|
||||||
|
|
||||||
# 工具
|
# 工具
|
||||||
intl: ^0.20.2
|
intl: ^0.20.2
|
||||||
|
|
|
||||||