FractionalTranslation Widget – Flutter Widget Guide By Flutter Agency

· 3 min read
FractionalTranslation
FractionalTranslation

What is FractionalTranslation Widget in Flutter?

FractionalTranslation Widget is a widget that applies a translation expressed as a fraction of the box’s size before painting its child.

The translation is expressed as an Offset scaled to the child’s size. For example, an Offset with a dx of 0.25 will result in a horizontal translation of one-quarter of the width of the child.

Hit tests will only be detected inside the bounds of the FractionalTranslation Widget, even if the contents are offset such that they overflow.

The constructor of FractionalTranslation Widget will look like below:

  FractionalTranslation({
    Key key,
    @required Offset translation,
    bool transformHitTests: true,
    Widget child,
  });

Properties :

  • key: A Key is an identifier for Widgets, Elements, and SemanticsNodes. A new widget will only be used to update an existing element if its key is the same as the key of the current widget associated with the element.
  • translation: The translation to apply to the child, scaled to the child’s size.
  • transformHitTests: Whether to apply the translation when performing hit tests.
  • child: A child is a widget below this widget in the tree. A child can only have one child. To layout multiple children, let this widget’s child be a widget such as Row Widget, Column Widget, or Stack Widget, which have a children’s property, and then provide the children to that widget.

    Thanks for reading !!!

Conclusion:

In this article, we have been through What is FractionalTranslation Widget in Flutter along with its property.

Do let us know your valuable suggestion/feedback to serve you better.

FlutterAgency.com is our portal Platform dedicated to Flutter Technology and Flutter Developers. The portal is full of cool resources from Flutter like Flutter Widget Guide, Flutter Projects, Code libs and etc.

FlutterAgency.com is one of the most popular online portal dedicated to Flutter Technology and daily thousands of unique visitors come to this portal to enhance their knowledge on Flutter.

Leave a Reply