Files
eatvio_app/lib/features/feed/presentation/widgets/chip_group.dart
2025-08-01 10:53:28 +03:00

40 lines
1.3 KiB
Dart

import 'package:eatvio_app/features/feed/presentation/widgets/choice_chip_widget.dart';
import 'package:flutter/widgets.dart';
class ChipGroup extends StatelessWidget {
const ChipGroup({super.key, required this.selectedChipIndex, required this.chipsLabelList, required this.setSelectedChipIndex});
final int selectedChipIndex;
final List<String> chipsLabelList;
final void Function(int) setSelectedChipIndex;
@override
Widget build(BuildContext context) {
return Align(
alignment: Alignment.centerLeft,
child: SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 16),
scrollDirection: Axis.horizontal,
child: Row(
children: [
...List.generate(
chipsLabelList.length,
(index) => Padding(
padding: const EdgeInsets.only(right: 8.0),
child: ChoiceChipWidget(
index: index,
selectedChipIndex: selectedChipIndex,
chipsLabelList: chipsLabelList,
onSelected: (bool selected) {
setSelectedChipIndex(index);
FocusScope.of(context).requestFocus(FocusNode());
},
),
),
),
],
),
),
);
}
}