a package for flutter canvas paint dash line path easily.

Related tags

Image dash_painter
Overview

dash_painter

a package for flutter canvas paint dash line path easily.

1. DashPainter 如何使用

DashPainter 只负责对 路径 Path 的虚线化绘制,不承担组件职能。 一般用在拥有 Canvas 对象的回调方法中,比如自定义的 CustomPainterDecoration。 具体使用案例见 demo

const DashPainter(span: 4, step: 9).paint(canvas, path, paint);

对于所有的路径都是使用的,如下的 圆角矩形圆形

圆角矩形 圆形

2. 点划线的使用

除了虚线,还可以绘制点划线 , pointCountpointWidth两个属性,分别表示点划线数点划线长

const DashPainter(
    span: 4, // 空格长
    step: 10, // 实线长
    pointCount: 2, // 点划线个数
    pointWidth: 2 // 点划线长
).paint(canvas, path, paint);
  • 单点划线

  • 双点划线

  • 三点划线


点画线圆


DashPainter

可能很多人不会自定义画板自己绘制,或只想简单地使用。其实除了 CustomPainter 还有其他地方有 canvas。比如 Decoration 。 这里提供了 DashDecoration 的装饰,方便使用。如下实现一个渐变的单点画线圆角虚线框

Container(
  width: 100,
  height: 100,
  decoration: DashDecoration(
      pointWidth: 2,
      step: 5,
      pointCount: 1,
      radius: Radius.circular(15),
      gradient: SweepGradient(colors: [
        Colors.blue,
        Colors.red,
        Colors.yellow,
        Colors.green
      ])),
  child: Icon(
    Icons.add,
    color: Colors.orangeAccent,
    size: 40,
  ),
),
You might also like...

Multi image pixker using the image_picker package in flutter

multi_image_selection A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you st

Oct 13, 2021

Flutter Package to Pick Image From Gallery or Camera

Flutter Package to Pick Image From Gallery or Camera

image_picker_gallery_camera Flutter Package to Pick Image From Gallery or Camera Getting Started A Flutter plugin for iOS and Android for picking imag

Oct 5, 2022

A flutter package for image carousels.

A flutter package for image carousels.

flutter_image_carousel A flutter package for image carousels. Supports both Asset and Network images. Example new ImageCarousel( ImageProvider[

Aug 9, 2021

Flutter's package that comes with several popular icons packages.

icons_plus icons_plus is a package that comes with several popular icons packages. How to I know icons' name? Simple answer, using flutter's auto-sugg

Dec 13, 2022

Flutter package for image editing

Flutter package for image editing

You can edit image using this package and also you can create flex preview image by setting foreground to null. For now, you can use only asset files.

Nov 21, 2022

A flutter carousel widget, support infinite scroll, and custom child widget.

A flutter carousel widget, support infinite scroll, and custom child widget.

carousel_slider A carousel slider widget. Features Infinite scroll Custom child widgets Auto play Supported platforms Flutter Android Flutter iOS Flut

Dec 30, 2022

A Flutter widget that paints an image and moves it at a slower speed than the main scrolling content.

A Flutter widget that paints an image and moves it at a slower speed than the main scrolling content.

A Flutter widget that paints an image and moves it at a slower speed than the main scrolling content. Installation Add dependency to your pubspec.yaml

Dec 23, 2022

📸 Easy to use yet very customizable zoomable image widget for Flutter, Photo View provides a gesture sensitive zoomable widget. Photo View is largely used to show interacive images and other stuff such as SVG.

📸 Easy to use yet very customizable zoomable image widget for Flutter, Photo View provides a gesture sensitive zoomable widget. Photo View is largely used to show interacive images and other stuff such as SVG.

Flutter Photo View A simple zoomable image/content widget for Flutter. PhotoView enables images to become able to zoom and pan with user gestures such

Jan 3, 2023

SVG parsing, rendering, and widget library for Flutter

SVG parsing, rendering, and widget library for Flutter

flutter_svg Draw SVG (and some Android VectorDrawable (XML)) files on a Flutter Widget. Getting Started This is a Dart-native rendering library. Issue

Jan 6, 2023
Comments
  • 绘制垂直方向虚线时,虚线方向错误

    绘制垂直方向虚线时,虚线方向错误

    微信图片_20220821163437 水平方向没有问题, 这是我的代码 const DashPainter(span: 5, step: 5).paint(canvas, horizonGridLine, paint); const DashPainter(span: 5, step: 5).paint(canvas, verticalGridLine, paint);

    opened by WYZ1780 0
Owner
FlutterCandies
Custom Flutter candies (packages) for you to build your Flutter app easily. Enjoy it!
FlutterCandies
A powerful official extension library of image, which support placeholder(loading)/ failed state, cache network, zoom pan image, photo view, slide out page, editor(crop,rotate,flip), paint custom etc.

extended_image Language: English| 中文简体 A powerful official extension library of image, which support placeholder(loading)/ failed state, cache network

FlutterCandies 1.6k Dec 31, 2022
A OpenGLES context canvas in flutter.

gl_canvas A OpenGLES context canvas in flutter. Usage // New a GLCanvas require a builder GLCanvas( builder: _builder, ) The builder should return

null 8 Oct 17, 2022
Uses a Canvas to create a fluid-style navigation bar with flutter

fluid_nav_test_project Fluid Button Bar (null safety) Uses a Canvas to create a fluid-style navigation bar that has a fun bouncy feel to it; also show

Promise Amadi 5 Nov 9, 2022
Minimal Unsplash Android App to easily search and download images

Minimal Unsplash Android App to easily search and download images

Yash Garg 18 Dec 7, 2022
Insipred by Font awesome Icons package 🤗 . This package contains more than 2000 icons 🥰

flutter_cmoon_icons ?? Insipred by Font awesome Icons package ?? . This package contains more than 2000 icons ?? . The amazing thing about this icons

Rexford Asamoah 3 Nov 3, 2021
A simple Flutter Package to Mimic iMessage Image Picker for Flutter

A simple Flutter Package to Mimic iMessage Image Picker for Flutter

Paras Jain 64 Dec 26, 2022
A Flutter package for manipulating bitmaps

Flutter Bitmap A minimalist Flutter package to perform fast bitmaps operations. The focus here is to provide a cool bitmap manipulation interface. The

Renan 152 Dec 23, 2022
A flutter package which makes it easy to track a series of images.

A flutter package which makes it easy to track a series of images.

Jaehee Kim 2 Oct 7, 2022
Flutter package for Image Carousel It is an image carousel widget.

Snapshot Carousel Flutter package for Image Carousel It is an image carousel widget. Supported platforms Flutter Android Flutter iOS Flutter web Flutt

Mrigank Anand 12 Jun 3, 2021
A flutter package to convert any widget to an Image.

Davinci A package to convert any widget to an image which can be saved locally or can be shared to other apps and chats. ?? Preview ℹ️ Usage Prerequis

Sai Gokula Krishnan 37 Dec 20, 2022