패키지, 저장소 및 앱 카테고리 검색

polygon 표지
패키지 상세v0.1.0

polygon

다각형 모양을 그리는 간단한 방법과 자르기.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
2.2천
좋아요
49
Pub 점수
160

패키지 설치

flutter pub add polygon

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

polygon 패키지는 Flutter 애플리케이션에서 다각형 모양을 생성하고 클리핑하는 간단한 방법을 제공합니다. 개발자는 점의 목록을 사용하여 사용자 정의 다각형 경로를 정의할 수 있어 복잡한 기하학적 형태를 쉽게 렌더링할 수 있습니다. 이 패키지는 콘텐츠를 다각형 경계 내에 제한할 수 있는 클리핑 작업을 지원하여 창의적인 시각 효과를 구현할 수 있습니다. 비사각형 레이아웃이나 상호작용 기반의 형상 인터페이스를 포함한 UI 디자인에 이상적이며, Android, iOS, Web, macOS, Windows 및 Linux 등 모든 주요 플랫폼에서 원활하게 작동합니다.

사용 사례

  • 사용자 정의 모양의 컨테이너 만들기
  • 다각형 경계에 위젯 클리핑
  • 인터랙티브 기하학적 UI 설계
  • 불규칙한 모양으로 게임 또는 지도 인터페이스 만들기
  • 다각형 전환 애니메이션

주요 기능

  • 간단한 다각형 경로 생성
  • 내장 클리핑 지원
  • 크로스 플랫폼 호환성
  • 기존 Flutter 위젯과의 간편한 통합
  • 동적 포인트 업데이트 지원

적합한 대상

  • 독특한 형태 레이아웃을 찾는 UI 디자이너
  • 게임 또는 지도를 개발하는 개발자
  • 비사각형 클리핑이 필요한 앱
  • 기하학적 인터페이스 프로토타이핑
  • 다중 플랫폼을 대상으로 하는 프로젝트

고려 사항

  • 복잡한 다각형에 따라 성능이 달라질 수 있습니다
  • 정확한 렌더링을 위해 점의 순서를 신중하게 다뤄야 합니다
  • 고주기 업데이트에 최적화되지 않음
  • 2차원 모양 조작에 제한됨
  • 충돌 감지에 추가 로직이 필요할 수 있습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

polygon

Create any polygon easily in Flutter with this package!

Pub Donate

https://user-images.githubusercontent.com/9378033/181354646-63d1d8aa-315e-4ef4-8ff3-e5c3a15341bb.mov

Features

  • Create regular convex polygons.
  • Create regular star polygons.
  • Create a polygon border.
  • Clip any widget with a polygon shape.

Usage

Create a Polygon

With this package you can easily create any kind of polygons by just setting its vertices (in a [(-1,-1);(1,1)] rect).

const polygon = Polygon([
  Offset(0.25, -1),
  Offset(0, -0.25),
  Offset(0.5, 0),
  Offset(-0.25, 1),
  Offset(0, 0.25),
  Offset(-0.5, 0),
]);

You can then create a path from this polygon by using its computePath method. For example you can use it in a CustomPainter:

class PolygonPainter extends CustomPainter {
  PolygonPainter(this.polygon);

  final Polygon polygon;

  @override
  void paint(Canvas canvas, Size size) {
    canvas.drawPath(
      polygon.computePath(rect: Offset.zero & size),
      Paint()..color = Colors.yellow.shade800,
    );
  }

  @override
  bool shouldRepaint(PolygonPainter oldDelegate) {
    return oldDelegate.polygon != polygon;
  }
}

sharp

The computePath methods accepts various parameters and you can, for example apply a corner radius to all of the polygon's corners:

rounded

PolygonBorder

This package has also a dedicated ShapeBorder called PolygonBorder, so that you can easily apply a color, a border, an image to the polygon or clip anything through Clip.shape.

DecoratedBox(
  decoration: ShapeDecoration(
    shape: PolygonBorder(
      polygon: polygon,
      turn: 0.125,
      radius: 20.0,
      borderAlign: BorderAlign.outside,
      side:  BorderSide(
        width: 4,
        color: Colors.red,
      ),
    ),
    color: Colors.pink,
  ),
  child: const SizedBox(
    height: 400,
    width: 400,
  ),
),
Specialized polygons.

This package comes with two specialized polygons: A RegularConvexPolygon which can create triangles, tetragons, pentagons, etc. A RegularStarPolygon which can create various star shapes.

https://user-images.githubusercontent.com/9378033/181354589-1c12b68b-2ecc-4ded-a46b-16fe03d6cd57.mov

Sponsoring

I'm working on my packages on my free-time, but I don't have as much time as I would. If this package or any other package I created is helping you, please consider to sponsor me. By doing so, I will prioritize your issues or your pull-requests before the others.

Changelog

Please see the Changelog page to know what's recently changed.

Contributions

Feel free to contribute to this project.

If you find a bug or want a feature, but don't know how to fix/implement it, please fill an issue.
If you fixed a bug or implemented a feature, please send a pull request.

카테고리

의존성

의존성 목록 1 개

소스 저장소

이 패키지를 사용하는 프로젝트