forked from eatvio/eatvio_app
Merge pull request 'new test cases' (#218) from misha/eatvio_app:main into main
Reviewed-on: eatvio/eatvio_app#218
This commit is contained in:
44
lib/features/feed/presentation/widgets/chip_group.dart
Normal file
44
lib/features/feed/presentation/widgets/chip_group.dart
Normal file
@@ -0,0 +1,44 @@
|
||||
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: EdgeInsets.symmetric(horizontal: 16),
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
children: [
|
||||
...List.generate(
|
||||
5,
|
||||
(index) => Padding(
|
||||
padding: EdgeInsets.only(right: 8.0),
|
||||
child: ChoiceChipWidget(
|
||||
index: index,
|
||||
selectedChipIndex: selectedChipIndex,
|
||||
chipsLabelList: chipsLabelList,
|
||||
onSelected: (bool selected) {
|
||||
setSelectedChipIndex(index);
|
||||
FocusScope.of(context).requestFocus(new FocusNode());
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user