imgs/tooltip.png와 같이 세부적인 경로를 지정해줘도 되지만, imgs/만 써 주어도 됩니다. 디렉터리만 적을 경우 디렉터리 내의 모든 이미지를 Asset으로 처리합니다.
class Intro extends StatelessWidget{
Widget build(BuildContext context){
return new Scaffold(
backgroundColor: Colors.lightBlue,
body: Center(
child: Image.asset("imgs/tooltip.png")
),
);
}
}
아래와 같이 이미지의 크기를 조절할 수 있습니다. width와 height중 하나만 지정하는 경우 이미지가 비율을 유지한 채 커지거나 작아집니다.
class Intro extends StatelessWidget{
Widget build(BuildContext context){
return new Scaffold(
backgroundColor: Colors.lightBlue,
body: Center(
child: Image.asset("imgs/tooltip.png", width:200)
),
);
}
}