FLUTTER ECOSYSTEM

himanshugarg08/draw_on_path

지정된 경로에 따라 텍스트 또는 패턴을 그리는 데 사용되는 플러터 패키지입니다.

draw_on_path 프로젝트 이미지
Stars
15
Forks
8
최근 푸시(UTC)
2023. 6. 1.
프로젝트 상태
활성
Himanshu Garg GitHub avatar
GITHUB User

Himanshu Garg ↗

Software Engineer | Flutter

언어C++DartCMakeHTMLCSwiftKotlinObjective-C

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 3 개
  • flutter{"sdk":"flutter"}
  • flutter_test개발 의존성{"sdk":"flutter"}
  • flutter_lints개발 의존성^2.0.0

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

README 펼치기 / 접기

Draw on Path

A Flutter package that is used to draw text or patterm along the given path.

Features

  • Draw text along path
  • Draw pattern along path
  • Support non-continuous path

Demo Video: https://youtu.be/TZAKSanD73k

Showcase

https://github.com/himanshugarg08/draw_on_path/blob/main/gifs/1.gif?raw=true https://github.com/himanshugarg08/draw_on_path/blob/main/gifs/2.gif?raw=true https://github.com/himanshugarg08/draw_on_path/blob/main/gifs/3.gif?raw=true https://github.com/himanshugarg08/draw_on_path/blob/main/gifs/4.gif?raw=true https://github.com/himanshugarg08/draw_on_path/blob/main/gifs/5.gif?raw=true https://github.com/himanshugarg08/draw_on_path/blob/main/gifs/6.gif?raw=true

Usage

  • drawTextOnPath function is used to draw text along path.

    canvas.drawTextOnPath(text, path);
    
  • drawOnPath function is used to draw pattern along path. index can be used to draw different element at different position based on some logic. Use canvas to draw anything at position. The next position is calculated based on spacing provided.

    spacing should be greater than 0. Ideally spacing is the sum of one element width and spacing between two elements (spacing between starting points of two consecutive elements)

    canvas.drawOnPath(
        path,
        (int index, Canvas canvas, Offset position) {
          canvas.drawRect(
            Rect.fromCircle(center: position.translate(0, -16), radius: 16),
            Paint()
              ..color = Colors.white38
              ..strokeWidth = 2.0
              ..style = PaintingStyle.stroke,
          );
        },
        spacing: 70,
      );
    
  • Note: If the text (for given textStyle) is larger than the path, then it will clip extra text.

Contributing

1. Fork it (<https://github.com/himanshugarg08/draw_on_path/fork>)
2. Create your feature branch (`git checkout -b feature/fooBar`)
3. Commit your changes (`git commit -am 'Add some fooBar'`)
4. Push to the branch (`git push origin feature/fooBar`)
5. Create a new Pull Request