본문 바로가기

Programming/flutter

[flutter] 구글 드라이브를 이용하여 이미지 호스팅 방법

flutter에서 이미지를 동그라미 가져오는 방법은 다음과 같다.

 

Container(
  width: (가로 사이즈)
  height: (세로 사이즈)
  decoration: new BoxDecoration(
    shape: BoxShape.circle, //원으로 전환
    image: new DecorationImage(
      fit: BoxFit.fill,
      image: new NetworkImage(
	      "호스팅 주소")))),

 

 

그리고 이미지 호스팅 하는 방법은 간단하다.

 

1. 구글 드라이브에 이미지를 올려서 모든이에게 공개를 해둔다.

 

공개 링크로 들어가서 위에 ...을 클릭하여서 항목삽입을 클릭

 

 

 

클릭까지 하면 이런 것이 뜬다.

여기서 <iframe src="https://drive.google.com/file/d/{여기에 작성된 코드}/preview" width="640" height="480" allow="autoplay"></iframe>

 

{}안에 있는 코드만 슬쩍 가져온다. 

 

"https://drive.google.com/uc?export=view&id={여기에 작성된 코드}"

이렇게 하고 호스팅 하면 된다.