chore: 汇总2026-05-30全量更新
### 详细变更:
1. **文档与配置**:更新AGENTS.md添加命令超时约束,升级Rive依赖至0.14.7并替换平台插件引用
2. **UI优化**:重构AppInfo页面布局、移除图表冗余配置、锁定部分系统设置项
3. **功能增强**:
- 新增工具面板拖拽状态管理与介绍弹窗
- 新增进度页面编辑/重排/清空用户进度功能
- 新增摇一摇路由作用域拦截逻辑
4. **体验优化**:
- 统一外部链接跳转弹窗,添加文件打开确认逻辑
- 修复设备卡片IP溢出、Android权限声明问题
- 后台任务初始化增加协议校验
5. **代码重构**:拆分工具面板配置、拖拽逻辑与动画参数,优化状态管理代码
6. **工具脚本**:新增协议文件上传脚本
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
/// 创建时间: 2026-05-29
|
||||
/// 更新时间: 2026-05-29
|
||||
/// 作用: 使用Rive动画替代TabIconSprite,实现更丰富的角色动画
|
||||
/// 上次更新: 初始创建
|
||||
/// 上次更新: 迁移至 Rive 0.14.x API
|
||||
/// ============================================================
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
@@ -41,8 +41,9 @@ class RiveTabIcon extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _RiveTabIconState extends State<RiveTabIcon> {
|
||||
SMIInput<bool>? _selectedInput;
|
||||
Artboard? _artboard;
|
||||
RiveWidgetController? _controller;
|
||||
File? _file;
|
||||
bool _isLoading = true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -50,39 +51,49 @@ class _RiveTabIconState extends State<RiveTabIcon> {
|
||||
_loadRive();
|
||||
}
|
||||
|
||||
/// 加载 Rive 文件并初始化 StateMachine
|
||||
@override
|
||||
void dispose() {
|
||||
_controller?.dispose();
|
||||
_file?.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Future<void> _loadRive() async {
|
||||
try {
|
||||
final data = await RiveFile.asset(widget.assetPath);
|
||||
final artboard = data.mainArtboard;
|
||||
final controller = StateMachineController.fromArtboard(
|
||||
artboard,
|
||||
widget.stateMachineName,
|
||||
final file = await File.asset(
|
||||
widget.assetPath,
|
||||
riveFactory: Factory.rive,
|
||||
);
|
||||
if (controller != null) {
|
||||
artboard.addController(controller);
|
||||
_selectedInput = controller.findInput<bool>('isSelected');
|
||||
_selectedInput?.value = widget.isSelected;
|
||||
}
|
||||
if (mounted) {
|
||||
setState(() => _artboard = artboard);
|
||||
}
|
||||
if (!mounted) return;
|
||||
_file = file;
|
||||
_controller = RiveWidgetController(
|
||||
file!,
|
||||
stateMachineSelector: StateMachineSelector.byName(
|
||||
widget.stateMachineName,
|
||||
),
|
||||
);
|
||||
_syncSelection();
|
||||
setState(() => _isLoading = false);
|
||||
} catch (e) {
|
||||
// Rive文件加载失败时静默处理,不影响其他功能
|
||||
if (mounted) setState(() => _isLoading = false);
|
||||
}
|
||||
}
|
||||
|
||||
void _syncSelection() {
|
||||
_controller?.stateMachine.boolean('isSelected')?.value = widget.isSelected;
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(RiveTabIcon oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (oldWidget.isSelected != widget.isSelected) {
|
||||
_selectedInput?.value = widget.isSelected;
|
||||
_syncSelection();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (_artboard == null) {
|
||||
if (_isLoading || _controller == null) {
|
||||
return SizedBox(
|
||||
width: widget.size,
|
||||
height: widget.size,
|
||||
@@ -92,7 +103,7 @@ class _RiveTabIconState extends State<RiveTabIcon> {
|
||||
return SizedBox(
|
||||
width: widget.size,
|
||||
height: widget.size,
|
||||
child: Rive(artboard: _artboard!),
|
||||
child: RiveWidget(controller: _controller!),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user