horizontal_list_view 1.0.0 horizontal_list_view: ^1.0.0 copied to clipboard
Flutter horizontal list view with fixed crossAxisCount.
horizontal_list_view #
Flutter horizontal list view with fixed crossAxisCount.
Installing #
Add to pubspec.yaml file
dependencies:
horizontal_list_view: ^1.0.0
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: 10, // 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'),
),
),
);
},
)