dev
dart 78 lines 2.66 KB
Raw
1 import 'package:flutter/material.dart';
2
3 class PickerItemWidget extends StatelessWidget {
4 const PickerItemWidget(
5 {required this.title, this.iconPath, this.isSelected = false, this.tag, this.onTap});
6
7 final String? iconPath;
8 final String title;
9 final bool isSelected;
10 final String? tag;
11 final VoidCallback? onTap;
12
13 @override
14 Widget build(BuildContext context) {
15 return GestureDetector(
16 onTap: onTap,
17 child: Container(
18 color: Theme.of(context).colorScheme.surface,
19 child: Padding(
20 padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 24),
21 child: Row(
22 children: [
23 Container(
24 child: Image.asset(
25 iconPath ?? '',
26 height: 20.0,
27 width: 20.0,
28 ),
29 ),
30 const SizedBox(width: 12),
31 Expanded(
32 child: Row(
33 children: [
34 Text(
35 title.toUpperCase(),
36 style: Theme.of(context).textTheme.bodyMedium!.copyWith(
37 color: isSelected
38 ? Theme.of(context).colorScheme.primary
39 : Theme.of(context).colorScheme.onSurface,
40 fontSize: isSelected ? 16 : 14.0,
41 fontWeight: FontWeight.w600,
42 ),
43 ),
44 if (tag != null)
45 Align(
46 alignment: Alignment.topCenter,
47 child: Container(
48 width: 35.0,
49 height: 18.0,
50 child: Center(
51 child: Text(
52 tag!,
53 style: Theme.of(context).textTheme.bodyMedium!.copyWith(
54 fontSize: 7.0, color: Theme.of(context).colorScheme.primary),
55 ),
56 ),
57 decoration: BoxDecoration(
58 borderRadius: BorderRadius.circular(6.0),
59 //border: Border.all(color: ),
60 color: Theme.of(context).colorScheme.surfaceContainerHighest,
61 ),
62 ),
63 ),
64 ],
65 ),
66 ),
67 if (isSelected)
68 Icon(
69 Icons.check,
70 color: Theme.of(context).colorScheme.primary,
71 ),
72 ],
73 ),
74 ),
75 ),
76 );
77 }
78 }