80 lines
2.1 KiB
Dart
80 lines
2.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../theme/wise_tokens.dart';
|
|
|
|
class AppBadge extends StatelessWidget {
|
|
const AppBadge({
|
|
required this.text,
|
|
this.icon,
|
|
this.kind = BadgeKind.neutral,
|
|
super.key,
|
|
});
|
|
|
|
final String text;
|
|
final IconData? icon;
|
|
final BadgeKind kind;
|
|
|
|
@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),
|
|
};
|
|
return DecoratedBox(
|
|
decoration: BoxDecoration(
|
|
color: colors.$1,
|
|
borderRadius: BorderRadius.circular(WiseRadius.pill),
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 9, vertical: 4),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
if (icon != null) ...[
|
|
Icon(icon, size: 14, color: colors.$2),
|
|
const SizedBox(width: 4),
|
|
],
|
|
Text(
|
|
text,
|
|
style: Theme.of(context).textTheme.labelSmall?.copyWith(color: colors.$2),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
enum BadgeKind { brand, audio, tier, warning, neutral }
|
|
|
|
class AppChip extends StatelessWidget {
|
|
const AppChip({
|
|
required this.label,
|
|
this.selected = false,
|
|
this.onTap,
|
|
super.key,
|
|
});
|
|
|
|
final String label;
|
|
final bool selected;
|
|
final VoidCallback? onTap;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ActionChip(
|
|
onPressed: onTap,
|
|
label: Text(label),
|
|
labelStyle: TextStyle(
|
|
color: selected ? Colors.white : WiseColors.textSecondary,
|
|
fontWeight: FontWeight.w700,
|
|
),
|
|
backgroundColor: selected ? WiseColors.primary : WiseColors.surface,
|
|
side: const BorderSide(color: WiseColors.border),
|
|
shape: const StadiumBorder(),
|
|
);
|
|
}
|
|
}
|