Flutter FractionallySizedBox (Responsive Design)

Flutter FractionallySizedBox (Responsive Design)

HeyFlutter․com

2 года назад

7,154 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Akash Singh
Akash Singh - 19.05.2022 11:27

why should we use FractionallySizedBox...when we can get the same effect using Container with MediaQuery?? is their any specific reason?? Thanks.

Ответить
DDrop
DDrop - 07.03.2022 20:59

I have a general question not really related to this video...

Is this the best approach to a component you don't know if it will have to be scrollable?

body: (
child: SingleChildScrollView: (
child: Column( everything else... )
)
)

If not what is? 🤔

Ответить
Shamshad khan
Shamshad khan - 07.03.2022 17:46

Hii, can u make a video on pedometer

Ответить
Ritik Saxena
Ritik Saxena - 07.03.2022 16:40

Awesome 💙

Ответить
Alexander Donner
Alexander Donner - 07.03.2022 15:58

Hey,

könntest du vlt ein Video dazu machen, wo man zweit Items (zb. 2 Boxen mit einen Pfeil verbinden kann)? also wie zb bei einen Chant Chart.

Ответить
Rijads
Rijads - 07.03.2022 10:46

the prefered way of sizing widgets is this:

1. dont size your widget.
most widgets dont need a size. they can simply take up the space they need.
if your widget needs to span a width or height of some other widget or even the screen, then you can simply use a Row or Column with an Expanded.

if your widget needs a size, then:
2. give your widget a Logical Pixel size
logical pixels are the size measurement that flutter uses.
Container(
height: 40,
)

this container has a height of 40 Logical Pixels.
Logical Pixels promise you that your widget will have the same physical size on all devices.
this means, if your widget has the size of a 50 cent coin on your device, it will have that exact same size on all devices.

if you really need to size your widget depending on another widget it is in, or the screen*, then:
3. use a LayoutBuilder
a layoutbuilder will delay its own build until its parent is built, and then pass the constraints of said parent to its children. that way, the children can then build themselves depending on the size of the parent widget.
if the parent widget spans the entire screen, then youre basically sizing depending on the screen. DO NOT use this to multiply the size of your widget. that is not a good plan.

MediaQuery should be used to show different layouts of your screens depending on device size. It should not be used to scale your widgets directly.
-class spider extends arachnid

Ответить
Sarath R Krishnan
Sarath R Krishnan - 07.03.2022 06:16

🔥

Ответить
Sam Sheldin
Sam Sheldin - 07.03.2022 05:38

bro

Ответить
Mario Luque
Mario Luque - 07.03.2022 04:16

Wow this one is truly useful!

Ответить
Faqruddin Mohammad
Faqruddin Mohammad - 06.03.2022 23:08

Hello Johanne,
I need ready templates online to fix with any project/integrations. Please advice best websites. Thank you.

Ответить
NuncNuncNuncNunc
NuncNuncNuncNunc - 06.03.2022 22:40

Johannes, you are outdoing Google in explaining Flutter widgets. Quick, simple, outstanding!

Ответить
Hussam Mneimneh
Hussam Mneimneh - 06.03.2022 22:39

This is very useful 👍
I have been using MediaQuery to get the width and height then multiplying by the desired percentage. However, this seems much easier, faster, and less code.

Ответить
adil Elkhallouki
adil Elkhallouki - 06.03.2022 22:28

Very useful 👍👍👍

Ответить
Jackson Stephen
Jackson Stephen - 06.03.2022 22:23

Great videos.. Keep up the energy

Ответить