Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Flutter support negative margin?

Tags:

flutter

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 container to a negative value, I got the following error:

I/flutter ( 3173): 'package:flutter/src/widgets/container.dart': Failed assertion: line 251: 'margin == null || I/flutter ( 3173): margin.isNonNegative': is not true. 
like image 786
Wei Song Avatar asked Jan 03 '18 23:01

Wei Song


People also ask

Is Flutter negative or positive?

If the re-entry has a clockwise direction, the flutter waves are positive in lead II, III, aVF and the P-waves typically have a notch on the apex.

Does negative values are allowed in margin?

It is possible to give margins a negative value. This allows you to draw the element closer to its top or left neighbour, or draw its right and bottom neighbour closer to it.

How do you change text margins in Flutter?

In this example, you will learn different ways to add padding and margin on the Text widget in Flutter. We will use, Padding() and Container() widget to wrap Text() widget and apply padding and margin. Furthermore, you will learn about EdgeInsets method.


1 Answers

The container has a useful transform property.

enter image description here

child: Container(   color: Theme.of(context).accentColor,   transform: Matrix4.translationValues(0.0, -50.0, 0.0), ), 
like image 51
Praveen Vijayan Avatar answered Sep 21 '22 15:09

Praveen Vijayan