I am trying to display a picture but it didn't work well.


I am trying to display a picture but it didn't work well.


I guess this is what you're looking for.
body: Center(
child: Image.network(
'https://docs.flutter.dev/assets/images/dash/dash-fainting.gif', width: 200, height: 200,),
),
Here is the complete code.
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Home',
home: Scaffold(
appBar: AppBar(title: Text('Image ornekleri')),
body: Center(
child: Image.network(
'https://docs.flutter.dev/assets/images/dash/dash-fainting.gif', width: 200, height: 200,),
),
),
);
}
}
You can use Image.asset() if you have local image files as explained here