Does Flutter support negative margin?

前端 未结 8 739
你的背包
你的背包 2020-12-15 02:34

Negative margin is generally not needed but there are situations where it’s really useful. For example: why use negative margins?

For now, when I set margin for a co

8条回答
  •  长情又很酷
    2020-12-15 03:12

    The short answer is "No, it doesn't".

    To give few more details, Flutter has a sophisticated but effective algorithm for rendering its widgets. Margins and Paddings are analyzed at runtime, and the final size and position of the widget is determined. When you try to issue a negative margine you are purposefully creating a not valide layout where a widget is somehow dropping out of the space it is supposed to occupy.

    Consider reading the doc here.

    Anyhow I believe you should formulate better the question in another thread and really ask a solution for the behavior you are trying to achieve with those negative margins. I am sure you'll get much more that way.

    Cheers

提交回复
热议问题