# path_drawing 0.5.0+1

A flutter library to help with (Canvas) Path creation and manipulation





## Installing
```
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.com
flutter pub add 'path_drawing:0.5.0+1'
```
Published: 2021-10-08T21:04:00.544462Z
Expected archive SHA-256: 074db0c219ac01d1661e47283e8fb6fb1fc59989771165dddc6a73dc959636f2

Available in cache; verification: upstream_checksum
## Direct dependencies
- flutter: map[sdk:flutter]
- meta: ^1.3.0
- path_parsing: ^0.2.0
- vector_math: ^2.1.0

## Package README (untrusted upstream documentation)
# path_drawing

[![pub package](https://img.shields.io/pub/v/path_drawing.svg)](https://pub.dev/packages/path_drawing)

A Flutter library to assist with creating and manipulating paths.

Currently supports parsing a `Path` from an SVG path data string
(including normalizing the path commands to be amenable to Flutter's exposed
Path methods).

Dash paths has an initial implementation that relies on flutter 0.3.6 at a minimum.

Planned for future release(s):

- Trim paths

## Example

Parse some path from svg string:

```dart
import 'package:path_drawing/path_drawing.dart';

final trianglePath = parseSvgPathData('M150 0 L75 200 L225 200 Z');
```

Create [CustomPainter](https://api.flutter.dev/flutter/rendering/CustomPainter-class.html):

```dart
class FilledPathPainter extends CustomPainter {
  const FilledPathPainter({
    @required this.path,
    @required this.color,
  });

  final Path path;
  final Color color;

  @override
  bool shouldRepaint(FilledPathPainter oldDelegate) =>
      oldDelegate.path != path || oldDelegate.color != color;

  @override
  void paint(Canvas canvas, Size size) {
    canvas.drawPath(
      path,
      Paint()
        ..color = color
        ..style = PaintingStyle.fill,
    );
  }

  @override
  bool hitTest(Offset position) => path.contains(position);
}
```

Use it inside [CustomPaint](https://api.flutter.dev/flutter/widgets/CustomPaint-class.html):

```dart
class MyWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () => print('tap'),
      child: CustomPaint(
        painter: FilledPathPainter(
          path: trianglePath,
          color: Colors.blue,
        ),
      ),
    );
  }
}
```

More examples can be found in [example folder](example/lib/main.dart)

## Changelog
# CHANGELOG

## 0.5.0+1

- Make `DashOffset` comparable.

## 0.5.0

- Stable nullsafe release.

## 0.5.0-nullsafety.0

- Null safe migration, general modernization

## 0.4.1+1

- Set uses-material-design to false.

## 0.4.1

- Consume latest path_parsing version.

## 0.4.0

- Implement path trimming routine
- Update example to demonstrate dash paths and trim paths.
- Remove `new` keyword.

## 0.3.1

- Consume updated version of parsing library
- Fix layout to conform to newer Flutter package requirements.

## 0.3.0

- Split out parsing logic into separate package that does not depend on Flutter
- Consume latest version of package, which fixes bug in smooth curve parsing

## 0.2.x

- 0.2.4: Fix bug in exponent validation logic
- 0.2.3: Fix bugs in _decomposeCubic - `Offset.scale` and `Offset.translate` related
- 0.2.2: Fix handling of null dashOffset
- 0.2.1: Add support for dashed paths, update docs
- 0.2.0: _not published_

## 0.1.x

- 0.1.1: Fix bug in matrix translate logic
- 0.1.0: Initial release







 
