v1.0.1
path_drawing
(Canvas)パスの作成および操作を支援するFlutterライブラリ
223いいね 93.1万30日間ダウンロード140Pub ポイント
AndroidiOSWebmacOSWindowsLinux
dnfield/flutter_path_drawing open-source repository details.
以下は英語原文のスナップショットです。最新版は GitHub をご覧ください。
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):
Parse some path from svg string:
import 'package:path_drawing/path_drawing.dart';
final trianglePath = parseSvgPathData('M150 0 L75 200 L225 200 Z');
Create CustomPainter:
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:
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
依存関係一覧 7 件
^2.1.0^1.3.0^1.0.1{"sdk":"flutter"}^1.8.0^1.16.0{"sdk":"flutter"}用途で絞り込み、開発状況を比較し、採用前に元のリポジトリで要件を確認しましょう。
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗