fix: 修复 flow-anim.dart Obx 使用不当导致的页面卡死
- 将 Obx 移到 AnimatedBuilder 内部,确保只监听主题色变化 - 避免 Obx 包裹整个 AnimatedBuilder 导致的不必要重建
This commit is contained in:
@@ -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,
|
||||||
);
|
);
|
||||||
},
|
});
|
||||||
);
|
},
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user