fix(theme): 修复组件主题硬编码问题
- asset_card: Colors.white/black → colorScheme - gradient_button: Colors.white → onPrimary - trade_button: Colors.white → onPrimary - 支持亮/暗主题动态切换
This commit is contained in:
@@ -45,11 +45,15 @@ class TradeButton extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final gradient = isBuy ? AppColorScheme.buyGradient : AppColorScheme.sellGradient;
|
||||
final text = isBuy
|
||||
? '买入${coinCode != null ? ' $coinCode' : ''}'
|
||||
: '卖出${coinCode != null ? ' $coinCode' : ''}';
|
||||
|
||||
// 主题感知颜色 - 在渐变背景上使用 onPrimary
|
||||
final textColor = colorScheme.onPrimary;
|
||||
|
||||
return Container(
|
||||
width: fullWidth ? double.infinity : null,
|
||||
height: 48,
|
||||
@@ -68,24 +72,24 @@ class TradeButton extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
if (isLoading)
|
||||
const SizedBox.square(
|
||||
SizedBox.square(
|
||||
dimension: 16,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
color: Colors.white,
|
||||
color: textColor,
|
||||
),
|
||||
)
|
||||
else
|
||||
Icon(
|
||||
isBuy ? Icons.arrow_downward_rounded : Icons.arrow_upward_rounded,
|
||||
size: 18,
|
||||
color: Colors.white,
|
||||
color: textColor,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
text,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
style: TextStyle(
|
||||
color: textColor,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user