Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ListContainer extends StatelessWidget {
- final ListContainerData? data;
- final bool isScrollable;
- final bool isHorizontal;
- final bool isDeletable;
- const ListContainer({
- Key? key,
- required this.data,
- this.isScrollable = true,
- this.isHorizontal = true,
- this.isDeletable = false,
- }) : super(key: key);
- @override
- Widget build(BuildContext context) {
- return ListView.builder(
- shrinkWrap: true,
- scrollDirection: isHorizontal ? Axis.horizontal : Axis.vertical,
- physics: isScrollable == true
- ? BouncingScrollPhysics()
- : NeverScrollableScrollPhysics(),
- itemCount: data!.items!.length,
- itemBuilder: (context, index) {
- return buildCard(
- index,
- data!.items![index],
- data!.items!.length,
- );
- },
- );
- }
- Widget buildCard(int index, ListItem listItem, int listLenght) {
- return ListCardHandler(listItem, isDeletable, index);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement