---
title: Getting Started
---

# Getting Started

## Installation

Add this package to your dependencies in your `pubspec.yaml` file:

```dart
  dependencies:
    box_transform: <latest_version>
```

## Models

[Box Transform][boxTransform] defines several models to mimic that of Flutter's.

- The equivalent of `Size` is `Dimension`.
- The equivalent of `Offset` is `Vector2` from the `vector_math` package.
- The equivalent of `Rect` is `Box`.
- The equivalent of `BoxConstraints` is `Constraints`.

## Usage

You can call the `BoxTransformer.resize` method to resize a box. The method takes the following parameters:

`handle`: The handle that is being dragged.
`initialRect`: The box before resizing started.
`initialLocalPosition`: The position of the mouse pointer before resizing started.
`localPosition`: The current position of the mouse pointer.
`resizeMode`: The resize mode. See [Resize Modes](/resize_modes) for more information.
`initialFlip`: The flip state before resizing started.

```dart title="Resizing a Box"
  final Box rect = Box.fromLTWH(50, 50, 100, 100);

  final ResizeResult result = BoxTransformer.resize(
    handle: HandlePosition.bottomRight, // handle that is being dragged
    initialRect: rect,
    initialLocalPosition: Vector2.zero(),
    localPosition: Vector2.zero(),
    resizeMode: ResizeMode.freeform,
    initialFlip: Flip.none,
  );

  result.rect; // the new rect
```
<Info>You can also use a **_isolates_** for these simultaneous resizing operations since this is a pure dart implementation.</Info>

You can use `BoxTransformer.move` to move a box.

```dart title="Moving a box"
  final Box rect = Box.fromLTWH(50, 50, 100, 100);
  final MoveResult result = BoxTransformer.move(
    initialRect: rect,
    initialLocalPosition: Vector2.zero(),
    localPosition: Vector2.zero(),
  );

  result.position; // the new position of the box
```

[boxTransform]: https://github.com/hyper-designed/box_transform