Container(
child: Image.asset(
'assets/images/image.jpg',
width: 350,
height: 300,
fit:BoxFit.fill
),
),
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: true,
title: Text('Image From Assets'),
backgroundColor: Colors.black,
),
body: Container(
child: Image.asset(
'assets/images/image.jpg',
width: 350,
height: 300,
fit:BoxFit.fill
),
),
);
}
}