Your Question contains the first step, but you need width and height. you can get the width and height of the screen. Here is a small edit
//gets the screen width and height double Width = MediaQuery.of(context).size.width; double Height = MediaQuery.of(context).size.height; Widget background = new Image.asset( asset.background, fit: BoxFit.fill, width: Width, height: Height, ); return new Stack( children: <Widget>[ background, foreground, ], );
You can also use Width and Height to size other objects based on screen size.
ex: width: Height/2, height: Height/2 //using height for both keeps aspect ratio
Follow
answered Jun 8 '19 at 13:50
5353 silver badges12 bronze badges
- 2
- fit: BoxFit.fill, on Image was a life saver, thanks :) – STEEL Aug 25 '20 at 11:07
'개발일지' 카테고리의 다른 글
리눅스 안드로이드 스튜디오 한글입력 문제 해결법 (0) | 2021.10.19 |
---|---|
Dartlang class에 Object를 argument로 넘겨주기 (0) | 2021.06.20 |
http 연결 허용시키기 (0) | 2021.05.22 |
graphql_flutter subscription 구현 저장 (0) | 2021.05.13 |
Android studio snippet 추가하기 (0) | 2021.05.11 |