dash_painter 1.0.2 copy "dash_painter: ^1.0.2" to clipboard
dash_painter: ^1.0.2 copied to clipboard

a package for flutter canvas paint dash line path easily.

example/main.dart

import 'package:dash_painter/dash_painter.dart';
import 'package:flutter/material.dart';


void main() => runApp(MyApp());

class MyApp extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
        body: Center(
          child: CustomPaint(
              size: Size(200,200),
              painter: TolyPainter()),
        ),
      ),
    );
  }
}

class TolyPainter extends CustomPainter {

  @override
  void paint(Canvas canvas, Size size) {
    canvas.translate(size.width / 2, size.height / 2);

    Paint paint = Paint()
      ..style = PaintingStyle.stroke
      ..color = Colors.orangeAccent
      ..strokeWidth = 1;

    final Path path = Path();
    path.moveTo(-200, 0);
    path.lineTo(200, 0);
    path.moveTo(0, -200);
    path.lineTo(0, 200);

    path.addOval(Rect.fromCircle(center: Offset.zero, radius: 80));
    path.addRRect(RRect.fromRectAndRadius(
      Rect.fromCircle(center: Offset.zero, radius: 100),
      Radius.circular(20),
    ));
    const DashPainter(span: 4, step: 9).paint(canvas, path, paint);
  }

  @override
  bool shouldRepaint(covariant TolyPainter oldDelegate) => false;
}
31
likes
130
pub points
88%
popularity

Publisher

verified publisherfluttercandies.com

a package for flutter canvas paint dash line path easily.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on dash_painter