Follow the below steps to add multiple images to the Flutter project and make it scrollable.
You need to follow this article to add images to your project,
runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Flutter Demo',
theme: new ThemeData(
primarySwatch: Colors.blue,
),
home: new MyHomePage(title: 'Flutter Image Examples'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => new _MyHomePageState();
}
class _MyHomePageState extends State {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text(widget.title),
),
body: new Center(
child: new ListView(
children: [
Image.asset('images/carimg.jpeg',
width: 600.0,
height: 240.0,
fit: BoxFit.cover,),
Image.asset('images/carimg.jpeg',
width: 600.0,
height: 240.0,
fit: BoxFit.cover,),
Image.asset('images/carimg.jpeg',
width: 600.0,
height: 240.0,
fit: BoxFit.cover,),
Image.asset('images/carimg.jpeg',
width: 600.0,
height: 240.0,
fit: BoxFit.cover,)
],
),
),
);
}
}
In this example, you can observe that I have used ListView to display multiple Images. It is required because, it will make images scrollable.
Thanks,
Srikanth