flutter


Sizing elements to percentage of screen width/height


Is there a simple (non-LayoutBuilder) way to size an element relative to screen size (width/height)? For example: how do I set the width of a CardView to be 65% of the screen width.
It can't be done inside the build method (obviously) so it would have to be deferred until post build. Is there a preferred place to put logic like this?
FractionallySizedBox may also be useful.
You can also read the screen width directly out of MediaQuery.of(context), and create a sized box based on that, if you really want to size as a fraction of the screen regardless of what the layout is.
You could build a Column/Row with Flexible or Expanded children that have flex values that add up to the percentages you want.
You may also find the AspectRatio widget useful.

Related Links

Unable to install Flutter on my windows machine
PageView with horizontal, non-filled children
How to navigate between flutter screen to native(android/ios) screens
Creating raw image from Widget or Canvas
The equivalent of wrap_content and match_parent in flutter?
Is there an AdMob or other ad service SDK for Flutter apps
How can I access the contents of a StatefulWidget's State during a unit test?
How can I tightly wrap a Column of widgets inside a Card?
What's the reason for “async” in testWidgets methods?
How can I inherit a StatefulWidget's State?
Why is this icon being clipped?
IconButton calling setState during onPressed shows no ripple effect
How can I test a TextPainter?
Passing command line arguments to a flutter app
How can I save to local storage using Flutter?
Life cycle in flutter

Categories

HOME
math
hadoop
ffmpeg
logstash
magento
auth0
x-editable
android-wear
sql-server-2012
word-vba
fonts
gluu
geany
application-cache
httpbuilder-ng
winsql
android-bluetooth
pyusb
wav
stm
xorg
light-inject
hyperion
google-weather-api
scrollbar
calabash-android
apex
lag
eigen3
html-email
abaqus
exe4j
stm32f4discovery
spring-restdocs
revitpythonshell
ghost-blog
opencms
deadbolt
jsgrid
nested-loops
flexjs
whatsapi
dlopen
html-select
ose
subtotal
tweenmax
outlook-vba
extraction
docker-image
vue2
flags
cookiestore
weebly
bem
uitabbarcontroller
stateful
using
httpexception
distributed-lock
gretl
slt
opal
openwebanalytics
html-form
koala-framework
biological-neural-network
jawr
a-star
mysql-error-1050
wxhaskell
mink
rsh
geneos
angularjs-filter
vb6-migration
groupbox
uiswitch
docklight
radix-sort
ospf
folder-structure
push-api
mailx
iphone-5
access-log
gitattributes
getuikit
prettyfaces
private-methods
tinkerpop-frames
dojo.gridx
custom-titlebar
sirtrevor
jqgrid-php
declspec
cfile
scala-pickling
inputview
django-endless-pagination
mips64
chomsky-hierarchy
mms-gateway
cakephp-2.1
calloc
harvest
android-actionmode
xml-dtd
adaboost
hpple
bapi
katta
ladon
jquery-pagination
mkreversegeocoder
sloc
development-machine
web-based
roguelike
plumtree

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App