From 8aa055a42c5a9ac79ba26e1b31ca90eb20b075af Mon Sep 17 00:00:00 2001 From: Developer Date: Fri, 3 Apr 2026 00:45:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BD=BB=E5=BA=95=E4=BF=AE=E5=A4=8D=20f?= =?UTF-8?q?low-anim.dart=20Obx=20=E5=B5=8C=E5=A5=97=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E7=9A=84=E9=A1=B5=E9=9D=A2=E5=8D=A1=E6=AD=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除 FlowingBorderContainer 内部的 Obx 和 ThemeController - FlowingBorderContainer 不再自行监听主题色变化 - 颜色通过 widget.color 参数从外部传入 - poetry.dart 中传入 primaryColor 变量 - 避免 Obx 嵌套导致的 GetX 异常 --- lib/views/profile/level/flow-anim.dart | 27 +++++++++----------------- lib/views/profile/level/poetry.dart | 3 +-- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/lib/views/profile/level/flow-anim.dart b/lib/views/profile/level/flow-anim.dart index bd6b293..d2f065a 100644 --- a/lib/views/profile/level/flow-anim.dart +++ b/lib/views/profile/level/flow-anim.dart @@ -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 with SingleTickerProviderStateMixin { late AnimationController _controller; late Animation _animation; - final ThemeController _themeController = Get.find(); @override void initState() { @@ -111,21 +108,15 @@ class _FlowingBorderContainerState extends State 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, - width: widget.width, - ), - child: widget.child, - ); - }); + return Container( + padding: EdgeInsets.all(widget.width), + decoration: FlowingBorderDecoration( + animation: _animation, + color: widget.color ?? ThemeColors.getThemeColor(0), + width: widget.width, + ), + child: widget.child, + ); }, ); } diff --git a/lib/views/profile/level/poetry.dart b/lib/views/profile/level/poetry.dart index 2a00a85..ff9f472 100644 --- a/lib/views/profile/level/poetry.dart +++ b/lib/views/profile/level/poetry.dart @@ -743,8 +743,7 @@ class _PoetryLevelPageState extends State : Colors.white, ), ), - color: AppConstants - .primaryColor, + color: primaryColor, width: 4, ), ),