fix:按html的假数据demo

This commit is contained in:
jingyun
2026-06-05 11:12:55 +08:00
parent b4272b5ec9
commit 9727b906c6
28 changed files with 2159 additions and 711 deletions
+61 -18
View File
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import '../theme/wise_tokens.dart';
import '../theme/yanting_text.dart';
import '../theme/yanting_tokens.dart';
class AppBadge extends StatelessWidget {
const AppBadge({
@@ -17,19 +18,42 @@ class AppBadge extends StatelessWidget {
@override
Widget build(BuildContext context) {
final colors = switch (kind) {
BadgeKind.brand => (WiseColors.secondary200, WiseColors.primarySoft),
BadgeKind.audio => (const Color(0x1F00A2DD), WiseColors.accent),
BadgeKind.tier => (const Color(0x1A008026), WiseColors.positive),
BadgeKind.warning => (const Color(0x209A6500), WiseColors.warning),
BadgeKind.neutral => (const Color(0x1286A7BD), WiseColors.textSecondary),
BadgeKind.brand => (
YantingColors.primary,
YantingColors.primaryForeground,
Colors.transparent,
),
BadgeKind.audio => (
YantingColors.secondary,
YantingColors.secondaryForeground,
Colors.transparent,
),
BadgeKind.tier => (
YantingColors.background,
YantingColors.mutedForeground,
YantingColors.border,
),
BadgeKind.warning => (
YantingColors.background,
YantingColors.destructive,
YantingColors.border,
),
BadgeKind.neutral => (
YantingColors.secondary,
YantingColors.secondaryForeground,
Colors.transparent,
),
};
return DecoratedBox(
decoration: BoxDecoration(
color: colors.$1,
borderRadius: BorderRadius.circular(WiseRadius.pill),
border: colors.$3 == Colors.transparent
? null
: Border.all(color: colors.$3),
borderRadius: BorderRadius.circular(YantingRadius.sm),
),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 9, vertical: 4),
padding: const EdgeInsets.symmetric(horizontal: 9, vertical: 3),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
@@ -39,7 +63,9 @@ class AppBadge extends StatelessWidget {
],
Text(
text,
style: Theme.of(context).textTheme.labelSmall?.copyWith(color: colors.$2),
style:
(Theme.of(context).textTheme.labelSmall ?? YantingText.badge)
.copyWith(color: colors.$2, letterSpacing: 0),
),
],
),
@@ -64,16 +90,33 @@ class AppChip extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ActionChip(
onPressed: onTap,
label: Text(label),
labelStyle: TextStyle(
color: selected ? Colors.white : WiseColors.textSecondary,
fontWeight: FontWeight.w700,
final background = selected
? YantingColors.foreground
: YantingColors.secondary;
final foreground = selected
? YantingColors.background
: YantingColors.secondaryForeground;
return Material(
color: Colors.transparent,
child: Ink(
decoration: BoxDecoration(
color: background,
borderRadius: BorderRadius.circular(YantingRadius.pill),
),
child: InkWell(
borderRadius: BorderRadius.circular(YantingRadius.pill),
onTap: onTap,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 17, vertical: 9),
child: Text(
label,
style:
(Theme.of(context).textTheme.labelLarge ?? YantingText.chip)
.copyWith(color: foreground, letterSpacing: 0),
),
),
),
),
backgroundColor: selected ? WiseColors.primary : WiseColors.surface,
side: const BorderSide(color: WiseColors.border),
shape: const StadiumBorder(),
);
}
}