fix: 彻底修复 flow-anim.dart Obx 嵌套导致的页面卡死
- 移除 FlowingBorderContainer 内部的 Obx 和 ThemeController - FlowingBorderContainer 不再自行监听主题色变化 - 颜色通过 widget.color 参数从外部传入 - poetry.dart 中传入 primaryColor 变量 - 避免 Obx 嵌套导致的 GetX 异常
This commit is contained in:
@@ -1,9 +1,7 @@
|
|||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
|
||||||
|
|
||||||
import '../../../services/get/theme_controller.dart';
|
|
||||||
import '../../../models/colors/theme_colors.dart';
|
import '../../../models/colors/theme_colors.dart';
|
||||||
|
|
||||||
/// 流动边框装饰器
|
/// 流动边框装饰器
|
||||||
@@ -84,7 +82,6 @@ class _FlowingBorderContainerState extends State<FlowingBorderContainer>
|
|||||||
with SingleTickerProviderStateMixin {
|
with SingleTickerProviderStateMixin {
|
||||||
late AnimationController _controller;
|
late AnimationController _controller;
|
||||||
late Animation<double> _animation;
|
late Animation<double> _animation;
|
||||||
final ThemeController _themeController = Get.find<ThemeController>();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -111,21 +108,15 @@ class _FlowingBorderContainerState extends State<FlowingBorderContainer>
|
|||||||
return AnimatedBuilder(
|
return AnimatedBuilder(
|
||||||
animation: _animation,
|
animation: _animation,
|
||||||
builder: (context, child) {
|
builder: (context, child) {
|
||||||
return Obx(() {
|
|
||||||
final color =
|
|
||||||
widget.color ??
|
|
||||||
ThemeColors.getThemeColor(_themeController.themeColorIndexRx.value);
|
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
padding: EdgeInsets.all(widget.width),
|
padding: EdgeInsets.all(widget.width),
|
||||||
decoration: FlowingBorderDecoration(
|
decoration: FlowingBorderDecoration(
|
||||||
animation: _animation,
|
animation: _animation,
|
||||||
color: color,
|
color: widget.color ?? ThemeColors.getThemeColor(0),
|
||||||
width: widget.width,
|
width: widget.width,
|
||||||
),
|
),
|
||||||
child: widget.child,
|
child: widget.child,
|
||||||
);
|
);
|
||||||
});
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -743,8 +743,7 @@ class _PoetryLevelPageState extends State<PoetryLevelPage>
|
|||||||
: Colors.white,
|
: Colors.white,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
color: AppConstants
|
color: primaryColor,
|
||||||
.primaryColor,
|
|
||||||
width: 4,
|
width: 4,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user