fix(theme): 修复组件主题硬编码问题
- asset_card: Colors.white/black → colorScheme - gradient_button: Colors.white → onPrimary - trade_button: Colors.white → onPrimary - 支持亮/暗主题动态切换
This commit is contained in:
@@ -96,6 +96,9 @@ class GradientButton extends StatelessWidget {
|
||||
final buttonGradient = gradient ??
|
||||
(isDark ? AppColorScheme.darkCtaGradient : AppColorScheme.lightCtaGradient);
|
||||
|
||||
// 主题感知颜色 - 在渐变背景上使用 onPrimary
|
||||
final textColor = colorScheme.onPrimary;
|
||||
|
||||
return Container(
|
||||
width: isFullWidth ? double.infinity : null,
|
||||
height: height,
|
||||
@@ -114,23 +117,23 @@ class GradientButton extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
if (isLoading)
|
||||
const SizedBox(
|
||||
SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
color: Colors.white,
|
||||
color: textColor,
|
||||
),
|
||||
)
|
||||
else ...[
|
||||
if (icon != null) ...[
|
||||
Icon(icon, size: 18, color: Colors.white),
|
||||
Icon(icon, size: 18, color: textColor),
|
||||
SizedBox(width: AppSpacing.sm),
|
||||
],
|
||||
Text(
|
||||
text,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
style: TextStyle(
|
||||
color: textColor,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user