Files
eatvio_app/lib/features/feed/presentation/widgets/choice_chip_widget.dart
2024-11-25 16:01:02 +07:00

49 lines
1.4 KiB
Dart

import 'package:eatvio_app/core/theme/theme_helper.dart';
import 'package:flutter/material.dart';
class ChoiceChipWidget extends StatelessWidget {
const ChoiceChipWidget({
super.key,
required this.chipsLabelList,
required this.index,
required this.selectedChipIndex,
required this.onSelected,
this.padding,
this.fontSize,
this.activeColor,
this.inactiveColor,
this.fontWeight,
});
final List<String> chipsLabelList;
final int index;
final int selectedChipIndex;
final double? fontSize;
final Color? activeColor;
final Color? inactiveColor;
final FontWeight? fontWeight;
final void Function(bool) onSelected;
final EdgeInsetsGeometry? padding;
@override
Widget build(BuildContext context) {
return ChoiceChip(
selectedColor: appTheme.blueA400,
pressElevation: 0,
showCheckmark: false,
side: BorderSide.none,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
padding: padding ?? const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
label: Text(chipsLabelList[index]),
labelStyle: TextStyle(
color: index == selectedChipIndex ? activeColor ?? Colors.white : inactiveColor ?? appTheme.gray600,
fontWeight: fontWeight ?? FontWeight.w500,
fontSize: fontSize ?? 12,
),
selected: selectedChipIndex == index,
backgroundColor: appTheme.gray100,
onSelected: onSelected,
);
}
}