Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

flutter.io (dart) - set padding as a percentage of device width?

Tags:

flutter

dart

How can I set padding as a percentage of screen width in Flutter?

The problem I'm trying to solve, I initially tried to solve with AspectRatio and FractionallySizedBox, as well as different attempts with Row and Columns, but the parent is a Positioned widget with a child image. Nothing worked.

like image 543
Deborah Avatar asked Nov 16 '17 21:11

Deborah


1 Answers

Use MediaQuery by doing MediaQuery.of(context).size.width to get the screen width

like image 178
Rémi Rousselet Avatar answered Oct 20 '22 11:10

Rémi Rousselet