fix: 彻底修复 flow-anim.dart Obx 嵌套导致的页面卡死

- 移除 FlowingBorderContainer 内部的 Obx 和 ThemeController
- FlowingBorderContainer 不再自行监听主题色变化
- 颜色通过 widget.color 参数从外部传入
- poetry.dart 中传入 primaryColor 变量
- 避免 Obx 嵌套导致的 GetX 异常
This commit is contained in:
Developer
2026-04-03 00:45:52 +08:00
parent e52591b55e
commit 8aa055a42c
2 changed files with 10 additions and 20 deletions

View File

@@ -1,9 +1,7 @@
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../../services/get/theme_controller.dart';
import '../../../models/colors/theme_colors.dart';
/// 流动边框装饰器
@@ -84,7 +82,6 @@ class _FlowingBorderContainerState extends State<FlowingBorderContainer>
with SingleTickerProviderStateMixin {
late AnimationController _controller;
late Animation<double> _animation;
final ThemeController _themeController = Get.find<ThemeController>();
@override
void initState() {
@@ -111,21 +108,15 @@ class _FlowingBorderContainerState extends State<FlowingBorderContainer>
return AnimatedBuilder(
animation: _animation,
builder: (context, child) {
return Obx(() {
final color =
widget.color ??
ThemeColors.getThemeColor(_themeController.themeColorIndexRx.value);
return Container(
padding: EdgeInsets.all(widget.width),
decoration: FlowingBorderDecoration(
animation: _animation,
color: color,
color: widget.color ?? ThemeColors.getThemeColor(0),
width: widget.width,
),
child: widget.child,
);
});
},
);
}

View File

@@ -743,8 +743,7 @@ class _PoetryLevelPageState extends State<PoetryLevelPage>
: Colors.white,
),
),
color: AppConstants
.primaryColor,
color: primaryColor,
width: 4,
),
),