forked from eatvio/eatvio_app
create diet screen
This commit is contained in:
@@ -2,11 +2,27 @@ 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});
|
||||
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(
|
||||
@@ -17,12 +33,12 @@ class ChoiceChipWidget extends StatelessWidget {
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
padding: padding ?? const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
label: Text(chipsLabelList[index]),
|
||||
labelStyle: TextStyle(
|
||||
color: index == selectedChipIndex ? Colors.white : appTheme.gray600,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 12,
|
||||
color: index == selectedChipIndex ? activeColor ?? Colors.white : inactiveColor ?? appTheme.gray600,
|
||||
fontWeight: fontWeight ?? FontWeight.w500,
|
||||
fontSize: fontSize ?? 12,
|
||||
),
|
||||
selected: selectedChipIndex == index,
|
||||
backgroundColor: appTheme.gray100,
|
||||
|
||||
Reference in New Issue
Block a user