proper way to get widget height in SafeArea

后端 未结 4 1952
轮回少年
轮回少年 2021-02-07 02:01

I\'m trying to get the height of widget but it prints the same values

I/flutter (19253): full height: 976.0
I/flutter (19253): safe height: 976.0
         


        
4条回答
  •  感情败类
    2021-02-07 02:17

    Flutter 1.7.4

    Add this at top level of Widget...and you can get exact SafeArea height.

    final availableHeight = MediaQuery.of(context).size.height -
        AppBar().preferredSize.height -
        MediaQuery.of(context).padding.top -
        MediaQuery.of(context).padding.bottom;
    

提交回复
热议问题