ListView.builder scroll item by item in flutter. You can use the below example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | List<String> yourArray = ["A", "B", "C", "D"]; @override Widget build(BuildContext context) { double width = MediaQuery.of(context).size.width; return Container( height: 100, child: ListView.builder( physics: PageScrollPhysics(), // this is what you are looking for scrollDirection: Axis.horizontal, itemCount: yourArray.length, itemBuilder: (context, index) { return Container( color: Colors.grey, width: width, child: Center(child: Text("Index = ${index}")), ); }, ), ); } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.