-
Notifications
You must be signed in to change notification settings - Fork 0
/
img_list_builder.dart
38 lines (35 loc) · 990 Bytes
/
img_list_builder.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import 'package:flutter/material.dart';
class ImgList extends StatefulWidget {
const ImgList({super.key});
@override
State<ImgList> createState(){
return _ImgListState();
}
}
class _ImgListState extends State<ImgList> {
List<Widget> imageList = [
Image.asset('assets/images/img1.png'),
Image.asset('assets/images/img2.png'),
Image.asset('assets/images/img3.jpeg'),
Image.asset('assets/images/img4.jpeg'),
Image.asset('assets/images/img5.jpeg'),
Image.asset('assets/images/img6.jpeg'),
];
@override
Widget build(BuildContext context){
return Scaffold(
appBar: AppBar(
title: const Text('Image ListView'),
),
body: Container(
child: ListView.builder(
scrollDirection: Axis.horizontal,
padding: const EdgeInsets.all(5),
itemCount: 6,
itemBuilder: (BuildContext context, index){
return imageList[index];
}),
),
);
}
}