revanced-manager/lib/ui/widgets/shared/custom_chip.dart

42 lines
1.2 KiB
Dart
Raw Normal View History

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