最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Flutter: Get device resoution - Stack Overflow

programmeradmin0浏览0评论

Is there a way to get device resolution as "$height*$width"? Any packages or just plain Flutter?

I want the device resolution: computer or phone resolution. NOT the browser or app resolution.

Thanks.

Is there a way to get device resolution as "$height*$width"? Any packages or just plain Flutter?

I want the device resolution: computer or phone resolution. NOT the browser or app resolution.

Thanks.

Share Improve this question asked Feb 5 at 15:18 Rami DhouibRami Dhouib 351 silver badge6 bronze badges 1
  • 1 This question is similar to: How to Determine Screen Height and Width. If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem. – sori Commented Feb 8 at 20:38
Add a comment  | 

1 Answer 1

Reset to default 0

dart:ui package has two properties that can handle what you need.

import 'dart:ui';
PlatformDispatcher.instance.views.first.physicalSize.height
PlatformDispatcher.instance.views.first.physicalSize.width

good luck!

发布评论

评论列表(0)

  1. 暂无评论