creek

The AI Image Editor of 2030

lib/ui/widgets/tag_chip.dart (1242B)


 1import 'package:flutter/material.dart';
 2import 'package:creekui/ui/styles/variables.dart';
 3
 4class TagChip extends StatelessWidget {
 5  final String label;
 6  final VoidCallback? onDelete;
 7  final Widget? icon;
 8
 9  const TagChip({super.key, required this.label, this.onDelete, this.icon});
10
11  @override
12  Widget build(BuildContext context) {
13    return Container(
14      padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
15      decoration: BoxDecoration(
16        color: Variables.chipBackground,
17        borderRadius: BorderRadius.circular(48),
18      ),
19      child: Row(
20        mainAxisSize: MainAxisSize.min,
21        children: [
22          if (icon != null) ...[icon!, const SizedBox(width: 8)],
23          Text(
24            label,
25            style: Variables.captionStyle.copyWith(
26              fontSize: 12,
27              color: Variables.textPrimary,
28            ),
29          ),
30          if (onDelete != null) ...[
31            const SizedBox(width: 8),
32            GestureDetector(
33              onTap: onDelete,
34              child: const Icon(
35                Icons.close,
36                size: 16,
37                color: Variables.textPrimary,
38              ),
39            ),
40          ],
41        ],
42      ),
43    );
44  }
45}