강의

멘토링

커뮤니티

Inflearn Community Q&A

dlqh4061066's profile image
dlqh4061066

asked

Flutter Beginner Extension - Instagram Clone 2.0

Upload image and save to DB

progressindicator 재질문

Written on

·

265

0

거듭된 실패와 관련 자료를 찾지 못해 부득이 재질문 드립니다

onPressed: () async {
setState(() {
isProgressing = true;
});
// if (isProgressing == true){
// return Center(child: CircularProgressIndicator());
// }
await _uploadFile(context);
setState(() {
isProgressing = false;
});
},

결과적으로 if 문을 어디에 넣어야하는 지 모르겠습니다... 

isProgressing 를 전역변수에 선언하고

저렇게 setState 뒤에도 넣어보고 (주석)

_uploadFile()안에도 넣어보고 했는데 표시가 안됩니다. 

혹 indicator가 ui 안쪽에서 실행되고있는거 아닌지 해서 관련자료 찾아보았으나 이마저도 아닌거 같습니다. 

조금더 힌트 주시면 감사드리겠습니다 ^^

Flutteriosfirebaseandroid클론코딩

Answer 2

0

dlqh4061066님의 프로필 이미지
dlqh4061066
Questioner

아~!! build에 if 문을 넣는게 관건이였네요 ㅠㅠ 감사합니다. 이제 되네요 

0

survivalcoding님의 프로필 이미지
survivalcoding
Instructor

코드 봤을 때는 잘 하신 것 같은데요?

_uploadFile() 도 당연히 async로 되어 있겠지요.

이렇게 하시는게 맞습니다.

지금 주석 처리되어 있는 UI 코드는 build () 메서드의 return 문 위에 넣으시면 되고요.

dlqh4061066's profile image
dlqh4061066

asked

Ask a question