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(
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shadcn_ui/shadcn_ui.dart';
|
||||
|
||||
import '../theme/yanting_tokens.dart';
|
||||
|
||||
@@ -20,11 +21,17 @@ class AppCard extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final radius = BorderRadius.circular(YantingRadius.xl);
|
||||
final theme = ShadTheme.of(context);
|
||||
final colors = theme.colorScheme;
|
||||
final radius = theme.radius.resolve(TextDirection.ltr);
|
||||
final decoration = BoxDecoration(
|
||||
color: color,
|
||||
color: color == YantingColors.card ? colors.card : color,
|
||||
borderRadius: radius,
|
||||
border: Border.all(color: borderColor),
|
||||
border: Border.all(
|
||||
color: borderColor == YantingColors.border
|
||||
? colors.border
|
||||
: borderColor,
|
||||
),
|
||||
);
|
||||
if (onTap == null) {
|
||||
return DecoratedBox(
|
||||
@@ -40,8 +47,8 @@ class AppCard extends StatelessWidget {
|
||||
decoration: decoration,
|
||||
child: InkWell(
|
||||
borderRadius: radius,
|
||||
splashColor: YantingColors.mutedForeground.withValues(alpha: 0.08),
|
||||
highlightColor: YantingColors.mutedForeground.withValues(alpha: 0.04),
|
||||
splashColor: colors.mutedForeground.withValues(alpha: 0.08),
|
||||
highlightColor: colors.mutedForeground.withValues(alpha: 0.04),
|
||||
onTap: onTap,
|
||||
child: Padding(padding: padding, child: child),
|
||||
),
|
||||
@@ -58,10 +65,11 @@ class HeroReportCard extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colors = ShadTheme.of(context).colorScheme;
|
||||
return AppCard(
|
||||
onTap: onTap,
|
||||
color: YantingColors.brandSoft,
|
||||
borderColor: YantingColors.brandSoftBorder,
|
||||
color: colors.brandSoft,
|
||||
borderColor: colors.brandSoftBorder,
|
||||
padding: const EdgeInsets.all(YantingSpacing.cardPadding),
|
||||
child: child,
|
||||
);
|
||||
|
||||
+12
-11
@@ -17,6 +17,7 @@ class AppBadge extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colors = ShadTheme.of(context).colorScheme;
|
||||
final child = Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
@@ -27,7 +28,7 @@ class AppBadge extends StatelessWidget {
|
||||
final shape = RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(YantingRadius.sm),
|
||||
side: kind == BadgeKind.tier || kind == BadgeKind.warning
|
||||
? const BorderSide(color: YantingColors.border)
|
||||
? BorderSide(color: colors.border)
|
||||
: BorderSide.none,
|
||||
);
|
||||
|
||||
@@ -45,14 +46,15 @@ class AppBadge extends StatelessWidget {
|
||||
BadgeKind.tier => ShadBadge.outline(
|
||||
shape: shape,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 9, vertical: 3),
|
||||
foregroundColor: YantingColors.mutedForeground,
|
||||
foregroundColor: colors.mutedForeground,
|
||||
child: child,
|
||||
),
|
||||
BadgeKind.warning => ShadBadge.destructive(
|
||||
shape: shape,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 9, vertical: 3),
|
||||
backgroundColor: YantingColors.background,
|
||||
foregroundColor: YantingColors.destructive,
|
||||
backgroundColor: colors.warningSoft,
|
||||
foregroundColor: colors.warningSoftForeground,
|
||||
hoverBackgroundColor: colors.warningSoftBorder,
|
||||
child: child,
|
||||
),
|
||||
};
|
||||
@@ -75,19 +77,18 @@ class AppChip extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colors = ShadTheme.of(context).colorScheme;
|
||||
return ShadBadge.secondary(
|
||||
onPressed: onTap,
|
||||
shape: const StadiumBorder(),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 17, vertical: 9),
|
||||
backgroundColor: selected
|
||||
? YantingColors.foreground
|
||||
: YantingColors.secondary,
|
||||
backgroundColor: selected ? colors.foreground : colors.secondary,
|
||||
hoverBackgroundColor: selected
|
||||
? YantingColors.foreground.withValues(alpha: 0.9)
|
||||
: YantingColors.border,
|
||||
? colors.foreground.withValues(alpha: 0.9)
|
||||
: colors.border,
|
||||
foregroundColor: selected
|
||||
? YantingColors.background
|
||||
: YantingColors.secondaryForeground,
|
||||
? colors.background
|
||||
: colors.secondaryForeground,
|
||||
child: Text(label),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shadcn_ui/shadcn_ui.dart';
|
||||
|
||||
import '../theme/app_icons.dart';
|
||||
import '../theme/yanting_text.dart';
|
||||
@@ -30,24 +31,28 @@ class BottomTabBar extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colors = ShadTheme.of(context).colorScheme;
|
||||
return DecoratedBox(
|
||||
decoration: const BoxDecoration(
|
||||
color: YantingColors.background,
|
||||
border: Border(top: BorderSide(color: YantingColors.border)),
|
||||
),
|
||||
decoration: const BoxDecoration(color: Colors.transparent),
|
||||
child: SizedBox(
|
||||
height: YantingSpacing.tabBarHeight,
|
||||
child: Row(
|
||||
children: [
|
||||
for (var index = 0; index < items.length; index++)
|
||||
Expanded(
|
||||
child: _BottomTabButton(
|
||||
item: items[index],
|
||||
selected: index == selectedIndex,
|
||||
onTap: () => onSelected(index),
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: colors.background,
|
||||
border: Border(top: BorderSide(color: colors.border)),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
for (var index = 0; index < items.length; index++)
|
||||
Expanded(
|
||||
child: _BottomTabButton(
|
||||
item: items[index],
|
||||
selected: index == selectedIndex,
|
||||
onTap: () => onSelected(index),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -67,9 +72,8 @@ class _BottomTabButton extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final color = selected
|
||||
? YantingColors.foreground
|
||||
: YantingColors.mutedForeground;
|
||||
final colors = ShadTheme.of(context).colorScheme;
|
||||
final color = selected ? colors.foreground : colors.mutedForeground;
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: Column(
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shadcn_ui/shadcn_ui.dart';
|
||||
|
||||
import '../data/models/models.dart';
|
||||
import '../theme/yanting_text.dart';
|
||||
@@ -18,6 +19,7 @@ class InstitutionCard extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colors = ShadTheme.of(context).colorScheme;
|
||||
final initials = institution.nameCn.isEmpty
|
||||
? '研'
|
||||
: institution.nameCn.characters.take(2).toString();
|
||||
@@ -43,6 +45,7 @@ class InstitutionCard extends StatelessWidget {
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: YantingText.listTitle.copyWith(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: colors.foreground,
|
||||
),
|
||||
),
|
||||
if (institution.nameEn.isNotEmpty) ...[
|
||||
@@ -80,6 +83,7 @@ class InstitutionCard extends StatelessWidget {
|
||||
style: YantingText.sectionTitle.copyWith(
|
||||
fontSize: 20,
|
||||
fontFeatures: YantingTypographyFeatures.tabularNums,
|
||||
color: colors.foreground,
|
||||
),
|
||||
),
|
||||
Text('份研报', style: YantingText.meta.copyWith(fontSize: 11)),
|
||||
@@ -105,17 +109,18 @@ class InstitutionLogo extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colors = ShadTheme.of(context).colorScheme;
|
||||
final fallback = DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: YantingColors.secondary,
|
||||
border: Border.all(color: YantingColors.border),
|
||||
color: colors.secondary,
|
||||
border: Border.all(color: colors.border),
|
||||
borderRadius: BorderRadius.circular(size * 0.25),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
initials,
|
||||
style: YantingText.meta.copyWith(
|
||||
color: YantingColors.secondaryForeground,
|
||||
color: colors.secondaryForeground,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontFeatures: null,
|
||||
|
||||
@@ -4,7 +4,6 @@ import 'package:shadcn_ui/shadcn_ui.dart';
|
||||
import '../data/models/models.dart';
|
||||
import '../theme/app_icons.dart';
|
||||
import '../theme/yanting_text.dart';
|
||||
import '../theme/yanting_tokens.dart';
|
||||
import '../theme/wise_tokens.dart';
|
||||
import 'app_buttons.dart';
|
||||
import 'app_card.dart';
|
||||
@@ -60,13 +59,14 @@ class MiniPlayer extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (!player.hasAudio) return const SizedBox.shrink();
|
||||
final colors = ShadTheme.of(context).colorScheme;
|
||||
final ratio = player.durationSec == 0
|
||||
? 0.0
|
||||
: player.positionSec / player.durationSec;
|
||||
return DecoratedBox(
|
||||
decoration: const BoxDecoration(
|
||||
color: YantingColors.secondary,
|
||||
border: Border(top: BorderSide(color: YantingColors.border)),
|
||||
decoration: BoxDecoration(
|
||||
color: colors.secondary,
|
||||
border: Border(top: BorderSide(color: colors.border)),
|
||||
),
|
||||
child: Stack(
|
||||
children: [
|
||||
@@ -78,9 +78,9 @@ class MiniPlayer extends StatelessWidget {
|
||||
alignment: Alignment.centerLeft,
|
||||
child: FractionallySizedBox(
|
||||
widthFactor: ratio.clamp(0, 1),
|
||||
child: const SizedBox(
|
||||
child: SizedBox(
|
||||
height: 2,
|
||||
child: ColoredBox(color: YantingColors.primary),
|
||||
child: ColoredBox(color: colors.primary),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -93,12 +93,12 @@ class MiniPlayer extends StatelessWidget {
|
||||
width: 38,
|
||||
height: 38,
|
||||
decoration: BoxDecoration(
|
||||
color: YantingColors.primary,
|
||||
color: colors.primary,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: const Icon(
|
||||
child: Icon(
|
||||
AppIcons.disc,
|
||||
color: YantingColors.primaryForeground,
|
||||
color: colors.primaryForeground,
|
||||
size: 20,
|
||||
),
|
||||
),
|
||||
@@ -113,7 +113,7 @@ class MiniPlayer extends StatelessWidget {
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: YantingText.meta.copyWith(
|
||||
color: YantingColors.foreground,
|
||||
color: colors.foreground,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontFeatures: null,
|
||||
),
|
||||
@@ -169,9 +169,10 @@ class PlayerCard extends StatelessWidget {
|
||||
final active = player.hasAudio && player.title == title;
|
||||
final position = active ? player.positionSec : 0;
|
||||
final ratio = durationSec == 0 ? 0.0 : position / durationSec;
|
||||
final colors = ShadTheme.of(context).colorScheme;
|
||||
return AppCard(
|
||||
color: YantingColors.secondary,
|
||||
borderColor: YantingColors.border,
|
||||
color: colors.secondary,
|
||||
borderColor: colors.border,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -255,17 +256,18 @@ class _SkipButton extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colors = ShadTheme.of(context).colorScheme;
|
||||
return TextButton(
|
||||
onPressed: onPressed,
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor: YantingColors.foreground,
|
||||
foregroundColor: colors.foreground,
|
||||
minimumSize: const Size(40, 40),
|
||||
padding: EdgeInsets.zero,
|
||||
),
|
||||
child: Text(
|
||||
label,
|
||||
style: YantingText.meta.copyWith(
|
||||
color: YantingColors.foreground,
|
||||
color: colors.foreground,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shadcn_ui/shadcn_ui.dart';
|
||||
|
||||
import '../theme/yanting_text.dart';
|
||||
import '../theme/yanting_tokens.dart';
|
||||
@@ -11,6 +12,7 @@ class PageHeader extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colors = ShadTheme.of(context).colorScheme;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 4, bottom: 18),
|
||||
child: Column(
|
||||
@@ -21,9 +23,7 @@ class PageHeader extends StatelessWidget {
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
subtitle!,
|
||||
style: YantingText.sub.copyWith(
|
||||
color: YantingColors.mutedForeground,
|
||||
),
|
||||
style: YantingText.sub.copyWith(color: colors.mutedForeground),
|
||||
),
|
||||
],
|
||||
],
|
||||
@@ -40,6 +40,7 @@ class SectionTitle extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colors = ShadTheme.of(context).colorScheme;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: YantingSpacing.sectionGap,
|
||||
@@ -50,7 +51,7 @@ class SectionTitle extends StatelessWidget {
|
||||
Text(title, style: YantingText.sectionTitle),
|
||||
if (icon != null) ...[
|
||||
const SizedBox(width: 6),
|
||||
Icon(icon, size: 18, color: YantingColors.mutedForeground),
|
||||
Icon(icon, size: 18, color: colors.mutedForeground),
|
||||
],
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user