fix: 修复 flow-anim.dart Obx 使用不当导致的页面卡死

- 将 Obx 移到 AnimatedBuilder 内部,确保只监听主题色变化
- 避免 Obx 包裹整个 AnimatedBuilder 导致的不必要重建
This commit is contained in:
Developer
2026-04-03 00:40:57 +08:00
parent 3dbf0600a0
commit e52591b55e

View File

@@ -108,14 +108,14 @@ class _FlowingBorderContainerState extends State<FlowingBorderContainer>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Obx(() { return AnimatedBuilder(
final color = animation: _animation,
widget.color ?? builder: (context, child) {
ThemeColors.getThemeColor(_themeController.themeColorIndexRx.value); return Obx(() {
final color =
widget.color ??
ThemeColors.getThemeColor(_themeController.themeColorIndexRx.value);
return AnimatedBuilder(
animation: _animation,
builder: (context, child) {
return Container( return Container(
padding: EdgeInsets.all(widget.width), padding: EdgeInsets.all(widget.width),
decoration: FlowingBorderDecoration( decoration: FlowingBorderDecoration(
@@ -125,8 +125,8 @@ class _FlowingBorderContainerState extends State<FlowingBorderContainer>
), ),
child: widget.child, child: widget.child,
); );
}, });
); },
}); );
} }
} }