Files
please-pay-me/mobile/lib/ui/molecules/app_chip.dart
T
2026-09-21 04:06:43 +03:00

60 lines
1.7 KiB
Dart

import 'package:flutter/cupertino.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:please_pay_me/theme/tokens.dart';
/// Capsule tag / filter pill (iOS has no Material chip — this is the HIG-ish
/// equivalent used in Photos & Mail filters).
class AppChip extends StatelessWidget {
const AppChip({
super.key,
required this.label,
this.selected = false,
this.icon,
this.onPressed,
});
final String label;
final bool selected;
final IconData? icon;
final VoidCallback? onPressed;
@override
Widget build(BuildContext context) {
final accent = AppColors.of(context, AppColors.accent);
final background = selected ? accent : AppColors.of(context, AppColors.systemGray5);
final foreground = selected ? const Color(0xFFFFFFFF) : AppColors.of(context, AppColors.label);
return CupertinoButton(
padding: EdgeInsets.zero,
minimumSize: Size.zero,
onPressed: onPressed,
child: Container(
padding: const EdgeInsets.symmetric(
horizontal: AppSpacing.s3,
vertical: AppSpacing.s2 - 1,
),
decoration: BoxDecoration(
color: background,
borderRadius: BorderRadius.circular(AppRadii.capsule),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
if (icon != null) ...[
Icon(icon, size: 15, color: foreground),
const SizedBox(width: AppSpacing.s1 + 2),
],
Text(
label,
style: GoogleFonts.inter(
textStyle: AppTypography.subhead.copyWith(fontWeight: FontWeight.w500),
color: foreground,
),
),
],
),
),
);
}
}