transformable 0.1.0 copy "transformable: ^0.1.0" to clipboard
transformable: ^0.1.0 copied to clipboard

outdated

A new Flutter project.

Transformable #

A 2D Scrollable and Scalable Flutter Widget.

Example #

This example app is included in the package (/lib/example/lib/main.dart).

The following example restricts the child's size to be at least half of the view size, and at most the entire view size. It also keeps the child positioned over the middle half of the view.

LayoutBuilder(
  builder: (context, constraints) => Transformable(
        child: Grid(),
        viewerSize: viewerSize,
        size: Size(100, 100),
        startSize: Size(200, 200),
        startOffset: Offset(100, 100),
        innerBoundRect: Rect.fromLTWH(
          constraints.biggest.width / 4,
          constraints.biggest.height / 4,
          constraints.biggest.width / 2,
          constraints.biggest.height / 2,
        ),
        outerBoundRect: Rect.fromPoints(
            Offset.zero, constraints.biggest.bottomRight(Offset.zero)),
      ),
);

Usage #

Wrap your desired widget in the Transformable widget, and specify the size of the child and the size of the view. To use the maximum available view, wrap this in a LayoutBuilder and use constraints.biggest as the size.

Transformable(
  child: Grid(),
  size: Size(100, 100)
);

Restrict the allowed area that the child can be moved to by specifying an inner and/or outer boundary rectangle. The inner rectangle is useful in situations like a photo viewer, where you want to make sure the child fills the a given area at all times. The outer rectangle is useful anytime you want to keep the child within a given area.

Details #

The outerBoundRect restricts the child's size to the size of the view, and restricts the child's position such that no part of the child can be out of the view. The innerBoundRect restricts the child's size to at least the size of the innerBoundRect, and restricts the child's position such that the child will completely cover innerBoundRect at all times.

0
likes
0
pub points
0%
popularity

Publisher

unverified uploader

A new Flutter project.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

cupertino_icons, flutter

More

Packages that depend on transformable