Flutter listview builder horizontal implementation. In this post, I will be implementing Flutter listview builder horizontal. What Flutter listview builder horizontal is and how to use it in Flutter app. I will be discussing each and everything about it using step by step explanation and by using an easy Flutter example code. So what are you waiting for, let’s start implementing Flutter listview builder horizontal.
What is Flutter Listview Builder Horizontal?
Flutter listview builder is the builder in Flutter in which we define a widget and give it some range of value and the listview builder returns a list of the Flutter widget that we have defined in that builder. Don’t worry I will explain everything using a proper Flutter example so you can have a better idea of how to use Flutter listview builder and how to change the scroll direction from default vertical to Flutter listview builder horizontal.
Default Flutter Listview Builder Scroll Direction
By default, the scroll direction of Flutter listview builder is vertical, means from top to bottom. It means the first item of listview builder list will be shown on top and the second one below it and so on. Let’s see it using a proper code. We have to define a simple Flutter listview builder and we have passed it some nested containers with beautiful shapes to make it look beautiful. Let’s see the default scroll direction of the items of Flutter listview builder.
ListView.builder( itemBuilder: (context, index) { return Container( height: 100, margin: EdgeInsets.all(20), decoration: BoxDecoration( borderRadius: BorderRadius.circular(20), color: Colors.green), child: Container( height: 100, width: 100, margin: EdgeInsets.all(10), decoration: BoxDecoration( borderRadius: BorderRadius.circular(20), color: Colors.white), child: Container( height: 100, width: 100, margin: EdgeInsets.all(10), decoration: BoxDecoration( borderRadius: BorderRadius.circular(20), color: Colors.green), ), ), ); })

Implementing Flutter Listview Builder Horizontal
Let’s see how to change the direction to horizontal in Flutter listview builder. For that we have to use the scroll direction constructor of the Flutter listview builder. By default it has scroll direction of axis vertical, we have to change it to axis vertical. See the below code:
scrollDirection: Axis.horizontal

Custom Flutter Listview Builder Design Source Code
import 'package:flutter/material.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, home: Homepage(), ); } } class Homepage extends StatefulWidget { @override State<Homepage> createState() => _HomepageState(); } class _HomepageState extends State<Homepage> { @override Widget build(BuildContext context) { return SafeArea( child: Scaffold( body: Container( height: 150, child: ListView.builder( scrollDirection: Axis.horizontal, itemBuilder: (context, index) { return Container( height: 200, margin: EdgeInsets.all(20), decoration: BoxDecoration( boxShadow: [BoxShadow(blurRadius: 3, color: Colors.black26)], borderRadius: BorderRadius.circular(100), color: Colors.green), child: Container( height: 100, width: 100, margin: EdgeInsets.all(10), decoration: BoxDecoration( borderRadius: BorderRadius.circular(20), color: Colors.white), child: Container( height: 100, width: 100, margin: EdgeInsets.all(10), decoration: BoxDecoration(boxShadow: [ BoxShadow( blurRadius: 5, spreadRadius: 2, color: Colors.black38) ], shape: BoxShape.circle, color: Colors.green), ), ), ); }), ))); } }
Conclusion
In the end, now you have a detailed understanding of how to implement Flutter listview builder horizontal in your Flutter app. I would love to read your thoughts about this post in the comment section. I also have other amazing posts for you regrading Flutter app development, Flutter amazing templates with free source code, custom Flutter animations, Flutter widgets explanations and many more, links to some of these amazing posts are listed below. Thanks for reading this post.