728x90
1.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:
- images/
2. Image 위젯으로 사진 가져오기
import "package:flutter/material.dart";
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Test'),
),
body: Column(children: [
Image.asset("images/icon1.png"),
Image.asset("images/icon2.png"),
Image.asset("images/icon3.png"),
])),
);
}
}
'Flutter' 카테고리의 다른 글
flutter) Image asset > png 투명도 설정 (0) | 2024.02.25 |
---|---|
flutter) OutlinedButton을 label과 text로 사용하기 (1) | 2024.02.25 |
flutter) 기본적인 플러터 구조 숙지를 위한 단순반복연습 (0) | 2024.02.15 |
flutter) dart math패키지사용하기, 문자열+변수 사용하기 (0) | 2024.02.13 |
flutter) StatefulWidget으로 re-excute build하기 (0) | 2024.02.12 |