fix;设置和深浅色
This commit is contained in:
@@ -24,23 +24,24 @@ class AppButton extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colors = ShadTheme.of(context).colorScheme;
|
||||
final variant = switch (kind) {
|
||||
AppButtonKind.primary => ShadButtonVariant.primary,
|
||||
AppButtonKind.dark => ShadButtonVariant.primary,
|
||||
AppButtonKind.accent => ShadButtonVariant.secondary,
|
||||
AppButtonKind.ghost => ShadButtonVariant.outline,
|
||||
};
|
||||
final colors = switch (kind) {
|
||||
final palette = switch (kind) {
|
||||
AppButtonKind.primary => (null, null, null),
|
||||
AppButtonKind.dark => (
|
||||
YantingColors.foreground,
|
||||
YantingColors.background,
|
||||
YantingColors.foreground.withValues(alpha: 0.9),
|
||||
colors.foreground,
|
||||
colors.background,
|
||||
colors.foreground.withValues(alpha: 0.9),
|
||||
),
|
||||
AppButtonKind.accent => (
|
||||
YantingColors.brandSoft,
|
||||
YantingColors.primaryForeground,
|
||||
YantingColors.brandSoftBorder,
|
||||
colors.brandSoft,
|
||||
colors.primaryForeground,
|
||||
colors.brandSoftBorder,
|
||||
),
|
||||
AppButtonKind.ghost => (null, null, null),
|
||||
};
|
||||
@@ -51,13 +52,13 @@ class AppButton extends StatelessWidget {
|
||||
width: expand ? double.infinity : null,
|
||||
height: compact ? 36 : 44,
|
||||
padding: EdgeInsets.symmetric(horizontal: compact ? 16 : 20),
|
||||
backgroundColor: colors.$1,
|
||||
foregroundColor: colors.$2,
|
||||
hoverBackgroundColor: colors.$3,
|
||||
backgroundColor: palette.$1,
|
||||
foregroundColor: palette.$2,
|
||||
hoverBackgroundColor: palette.$3,
|
||||
leading: icon == null ? null : Icon(icon, size: compact ? 15 : 16),
|
||||
gap: compact ? 5 : 7,
|
||||
textStyle: (compact ? YantingText.badge : YantingText.body).copyWith(
|
||||
color: colors.$2,
|
||||
color: palette.$2,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
child: Text(label),
|
||||
@@ -81,6 +82,7 @@ class AppIconButton extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final iconWidget = Icon(icon, size: 16);
|
||||
final colors = ShadTheme.of(context).colorScheme;
|
||||
return switch (kind) {
|
||||
AppButtonKind.primary => ShadIconButton(
|
||||
onPressed: onPressed,
|
||||
@@ -88,16 +90,16 @@ class AppIconButton extends StatelessWidget {
|
||||
),
|
||||
AppButtonKind.dark => ShadIconButton(
|
||||
onPressed: onPressed,
|
||||
backgroundColor: YantingColors.foreground,
|
||||
foregroundColor: YantingColors.background,
|
||||
hoverBackgroundColor: YantingColors.foreground.withValues(alpha: 0.9),
|
||||
backgroundColor: colors.foreground,
|
||||
foregroundColor: colors.background,
|
||||
hoverBackgroundColor: colors.foreground.withValues(alpha: 0.9),
|
||||
icon: iconWidget,
|
||||
),
|
||||
AppButtonKind.accent => ShadIconButton.secondary(
|
||||
onPressed: onPressed,
|
||||
backgroundColor: YantingColors.brandSoft,
|
||||
foregroundColor: YantingColors.primaryForeground,
|
||||
hoverBackgroundColor: YantingColors.brandSoftBorder,
|
||||
backgroundColor: colors.brandSoft,
|
||||
foregroundColor: colors.primaryForeground,
|
||||
hoverBackgroundColor: colors.brandSoftBorder,
|
||||
icon: iconWidget,
|
||||
),
|
||||
AppButtonKind.ghost => ShadIconButton.outline(
|
||||
|
||||
Reference in New Issue
Block a user