Search code examples
flutterlayoutwidgetsafearea

Flutter SafeArea


I am new to flutter and I was wondering if there is any way to only get the padding values of the SafeArea Widget without using it. I only want some of my widgets to be affected by the padding and a complete SafeArea widget seems to overcomplicate everything.

Thanks in advance.


Solution

  • MediaQuery with viewPadding do the trick, by using

    MediaQuery.of(context).viewPadding
    

    you can get padding informations (like app bar size...), you can also check this medium article.