horizontal_list_view 1.0.4 horizontal_list_view: ^1.0.4 copied to clipboard
Simple horizontal list view widget for displaying a list of items in a horizontal layout with fixed crosAxisCount.
horizontal_list_view #
Simple and customizable horizontal list view widget for displaying a list of items in a horizontal layout. This package is designed to simplify the creation of horizontal lists with a specified crossAxisCount without the need to provide a fixed height for the ListView.
Installing #
Add to pubspec.yaml file
dependencies:
horizontal_list_view: ^1.0.4
import
import 'package:horizontal_list_view/horizontal_list_view.dart';
Usage #
Code example #
import 'package:horizontal_list_view/horizontal_list_view.dart';
HorizontalListView(
crossAxisCount: 3, // Number of items displayed per row.
crossAxisSpacing: 16, // Spacing between items in the same row.
controller: HorizontalListViewController(), // Optional scroll controller.
itemCount: 12, // Total number of items in the list.
itemBuilder: (BuildContext context, int index) {
// Create and return the widgets for each item.
return AspectRatio(
aspectRatio: 16 / 9,
child: Container(
color: Colors.red,
child: Center(
child: Text('item: $index'),
),
),
);
},
)