dashed_path 1.0.0 copy "dashed_path: ^1.0.0" to clipboard
dashed_path: ^1.0.0 copied to clipboard

Converts any path into a dashed path.

example/lib/main.dart

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

void main() {
  runApp(const DashedPathExampleApp());
}

class DashedPathExampleApp extends StatelessWidget {
  const DashedPathExampleApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Dashed Path Example App',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        scaffoldBackgroundColor: const Color.fromARGB(255, 33, 34, 35),
      ),
      home: const ExampleDashedPathPainter(),
    );
  }
}

class ExampleDashedPathPainter extends StatelessWidget {
  const ExampleDashedPathPainter({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: SingleChildScrollView(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              const SizedBox(height: 25),
              CustomPaint(
                painter: DashedPathPainter(
                  originalPath: Path()..lineTo(100, 0),
                  pathColor: Colors.red,
                  strokeWidth: 5.0,
                  dashGapLength: 10.0,
                  dashLength: 10.0,
                ),
                size: const Size(100.0, 2.0),
              ),
              const SizedBox(height: 50),
              CustomPaint(
                painter: DashedPathPainter(
                  originalPath: Path()
                    ..addOval(
                      const Rect.fromLTWH(0, 0, 100, 100),
                    ),
                  pathColor: Colors.white,
                ),
                size: const Size(100.0, 100.0),
              ),
              const SizedBox(height: 50),
              CustomPaint(
                painter: DashedPathPainter(
                  originalPath: Path()
                    ..addRect(
                      const Rect.fromLTWH(0, 0, 100, 100),
                    ),
                  pathColor: Colors.grey,
                  strokeWidth: 2.0,
                  dashLength: 25.0,
                ),
                size: const Size(100.0, 100.0),
              ),
              const SizedBox(height: 25),
            ],
          ),
        ),
      ),
    );
  }
}
2
likes
150
pub points
78%
popularity

Publisher

verified publisherappcerto.de

Converts any path into a dashed path.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on dashed_path