Skip to content

Instantly share code, notes, and snippets.

@melodysdreamj
Last active July 18, 2021 09:27
Show Gist options
  • Save melodysdreamj/2c239ec0c18eb2f7a9be99fa15e49a86 to your computer and use it in GitHub Desktop.
Save melodysdreamj/2c239ec0c18eb2f7a9be99fa15e49a86 to your computer and use it in GitHub Desktop.
Future<Size> mediaQuerySizeByCodingPapa(BuildContext context) async{
Size size = MediaQuery.of(context).size;
if(size.width > 0){
return size;
}else{
await Future.delayed(Duration(milliseconds: 100));
return await mediaQuerySizeByCodingPapa(context);
}
}
@melodysdreamj
Copy link
Author

melodysdreamj commented Aug 8, 2020

사용할때는 이런식으로..

var deviceW = (await mediaQuerySizeByCodingPapa(context)).width;

@God-kimchi
Copy link

ㄱㅅㄱㅅ

@sshinndo
Copy link

감사합니다

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment