Getting Started
This package uses to generate Widget with Custom Painter inside from svg source.
Installation
dependencies:
...
svg_to_path_annotation: <latest_version>
dev_dependencies:
...
build_runner: <latest_version>
svg_to_path_generator: <latest_version>
examples
Annotate come class by @SvgSource('<path-to-svg>')
:
import 'package:svg_to_path_annotation/svg_to_path_annotation.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/rendering.dart';
part 'card.g.dart';
@SvgSource('assets/Card.svg')
class CardSvg extends _CardSvg {
}
Then run:
flutter pub run build_runner build --delete-conflicting-outputs
Use generated widget:
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color(0xFF555555),
body: Center(
child: Container(
height: 500,
width: 500,
child: CardSvg(),
),
),
);
}
Libraries
- builder
- helpers/colors
- parsers/common/color_parser
- parsers/common/stroke_parser
- parsers/common/transform_parser
- parsers/svg_elements/circle_parser
- parsers/svg_elements/group_parser
- parsers/svg_elements/path_parser
- parsers/svg_elements/svg_element_parser
- parsers/svg_elements/unknown_element_parser
- parsers/svg_parser
- svg_to_path_generator