**이 페이지에서 알 수 있는 내용 このページからわかること
- Image
- pubspec.yaml
- Image.Asset()
- Image.Network()
- width
- height
- fit**
main.dart
...
...
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'You have pushed the button this many times:',
),
SizedBox(width: 10, height: 50),
Image.asset('assets/images/ycbag.jpg', // Image.asset 위젯
width: 100,
height: 100,
fit: BoxFit.cover),
SizedBox(width: 10, height: 50),
Image.network( // Image.network 위젯
'<https://item.kakaocdn.net/do/9fc15909fcf047a5d500faabfc3d2c789f5287469802eca457586a25a096fd31>',
width: 100,
height: 100,
fit: BoxFit.fill // fit
)
],
),
),
...
...
);
}
}
pubspec.yaml
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- assets/images/ycbag.jpg


Image.asset( )을 사용하려면 pubspec.yaml에서 assets 섹션에 추가를 해야한다.
assets 섹션을 작성하기 위해서는 우측 사진처럼 폴더를 만들어야 한다.
Image.Asset()
Image.Network()
width
height
fit
Image.asset( )を使うためにはpubspec.yamlでassetsセクションに追加する必要がある
assetsセクションを作成するためには右の写真のようにフォルダを作る必要がある
ランタイムでアクセスすることなくイメージを呼び出すことができるウイジェット
urlからイメージを呼び出すウイジェット
イメージの幅を設定するプロパティ
イメージの高さを設定するプロパティ
イメージのサイズを調節できるプロパティ