2022-09-05 04:32:36 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
2022-11-23 05:18:10 +01:00
|
|
|
class CustomChip extends StatelessWidget {
|
|
|
|
const CustomChip({
|
2022-09-05 04:32:36 +02:00
|
|
|
Key? key,
|
|
|
|
required this.label,
|
2022-11-23 05:18:10 +01:00
|
|
|
this.isSelected = false,
|
2022-09-05 04:32:36 +02:00
|
|
|
this.onSelected,
|
|
|
|
}) : super(key: key);
|
2023-01-30 13:35:06 +01:00
|
|
|
final Widget label;
|
|
|
|
final bool isSelected;
|
|
|
|
final Function(bool)? onSelected;
|
2022-09-05 04:32:36 +02:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return RawChip(
|
|
|
|
showCheckmark: false,
|
|
|
|
label: label,
|
|
|
|
selected: isSelected,
|
2023-02-19 04:16:49 +01:00
|
|
|
labelStyle: Theme.of(context).textTheme.titleSmall!.copyWith(
|
2022-09-06 15:39:15 +02:00
|
|
|
color: isSelected
|
|
|
|
? Theme.of(context).colorScheme.primary
|
|
|
|
: Theme.of(context).colorScheme.secondary,
|
2022-09-17 10:02:49 +02:00
|
|
|
fontWeight: FontWeight.w500,
|
2022-09-05 04:32:36 +02:00
|
|
|
),
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
selectedColor: Theme.of(context).colorScheme.secondaryContainer,
|
|
|
|
padding: const EdgeInsets.all(10),
|
|
|
|
onSelected: onSelected,
|
2022-09-06 15:39:15 +02:00
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
borderRadius: BorderRadius.circular(12),
|
|
|
|
side: isSelected
|
|
|
|
? BorderSide.none
|
|
|
|
: BorderSide(
|
|
|
|
width: 0.2,
|
|
|
|
color: Theme.of(context).colorScheme.secondary,
|
|
|
|
),
|
|
|
|
),
|
2022-09-05 04:32:36 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|