搜尋套件、儲存庫與 APP 分類

flutter_polygon 封面
套件詳情v0.3.0+2

flutter_polygon

一個用於在 Flutter 中處理多邊形的外掛程式。提供裁剪器(PolygonClipper、ClipPolygon)和邊框(PolygonBorder)

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
3170
喜歡數
48
Pub 分數
150

安裝套件

flutter pub add flutter_polygon

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

flutter_polygon 是一個 Flutter 插件,提供用於在使用者介面中處理多邊形的工具。它包含一個裁剪器(PolygonClipper、ClipPolygon),可將元件裁剪為多邊形形狀,以及一個邊框(PolygonBorder),用於繪製多邊形輪廓。該套件支援多個平台,包括 Android、iOS、Web、macOS、Windows 和 Linux,非常適合建立自訂形狀的 UI 元件。它讓開發者能使用簡單且可重複使用的元件,設計出具有非矩形邊界的視覺吸引人佈局。

適用情境

  • 建立自定形狀的容器
  • 設計互動式多邊形按鈕
  • 構建幾何使用者介面佈局
  • 動畫多邊形過渡
  • 實現基於地圖的多邊形疊加
  • 渲染裝飾性多邊形邊框

主要特色

  • PolygonClipper 用於裁剪組件
  • PolygonBorder 用於繪製多邊形輪廓
  • 跨平台支援
  • 用於定義頂點的簡單 API
  • 支援動態多邊形更新
  • 內建的形狀渲染工具

適合對象

  • 尋求獨特形狀的UI設計師
  • 開發幾何介面的開發者
  • 需要自定義剪切路徑的應用
  • 帶有多邊形元素的互動式視覺化
  • 需要響應式多邊形邊框的專案

使用建議

  • 需要手動定義頂點
  • 效能可能會因複雜多邊形而異
  • 有限的內建形狀預設
  • 未針對高頻率更新進行優化
  • 可能需要額外的邏輯來檢測碰撞
  • 最適合靜態或很少變化的多邊形

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

flutter_polygon

A Flutter plugin to create views using regular polygon shapes (e.g. Pentagons and Hexagons).

Based on the polygon_clipper package by leonardocaldas.

Example1 Example2

Installation

Add this to your package's pubspec.yaml file:

dependencies:
  flutter_polygon: ^0.2.0

Usage

Clipping

Use the ClipPolygon widget to clip a child widget.

import 'package:flutter_polygon/flutter_polygon.dart';

ClipPolygon(  
 sides: 6, 
 borderRadius: 5.0,     // Defaults to 0.0 degrees
 rotate: 90.0,          // Defaults to 0.0 degrees
 boxShadows: [  
  PolygonBoxShadow(color: Colors.black, elevation: 1.0),
  PolygonBoxShadow(color: Colors.grey, elevation: 5.0)
 ],
 child: Container(color: Colors.black),
);
Borders

Use the PolygonBorder shape with your favorites widgets!

import 'package:flutter_polygon/flutter_polygon.dart';

FloatingActionButton(
  shape: PolygonBorder(
    sides: 6,
    borderRadius: 5.0,                                      // Defaults to 0.0 degrees
    rotate: 30.0,                                           // Defaults to 0.0 degrees
    border: BorderSide(color: Colors.red, width: 2.0),      // Defaults to BorderSide.none
  ),
  onPressed: () {},
  child: Icon(Icons.star),
),

Other widgets:

  • TextButton, ElevatedButton, ...
  • Container
  • Chip
  • ...

Contributing

If you find an issue with this package, please open an issue on github.

If you wish to contribute to this project, I encourage you to open a pull request.

Credit

Based on the polygon_clipper package by leonardocaldas.

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。