Search packages, repositories and app categories

flutter_polygon cover
Package detailsv0.3.0+2

flutter_polygon

A plugin with tools for working with polygons in Flutter. Provides a clipper (PolygonClipper, ClipPolygon) and border (PolygonBorder)

AndroidiOSWebmacOSWindowsLinux
30-day downloads
3.2K
Likes
48
Pub points
150

Install package

flutter pub add flutter_polygon

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

flutter_polygon is a Flutter plugin that provides tools for working with polygons in user interfaces. It includes a clipper (PolygonClipper, ClipPolygon) to clip widgets into polygonal shapes and a border (PolygonBorder) to draw polygon outlines. The package supports multiple platforms including Android, iOS, Web, macOS, Windows, and Linux, making it ideal for creating custom-shaped UI elements. It enables developers to design visually engaging layouts with non-rectangular boundaries using simple, reusable components.

Use cases

  • Creating custom-shaped containers
  • Designing interactive polygonal buttons
  • Building geometric UI layouts
  • Animating polygonal transitions
  • Implementing map-based polygon overlays
  • Rendering decorative polygonal borders

Key features

  • PolygonClipper for clipping widgets
  • PolygonBorder for drawing polygon outlines
  • Cross-platform support
  • Simple API for defining vertices
  • Supports dynamic polygon updates
  • Built-in shape rendering utilities

Suitable for

  • UI designers seeking unique shapes
  • Developers building geometric interfaces
  • Apps requiring custom clipping paths
  • Interactive visualizations with polygonal elements
  • Projects needing responsive polygonal borders

Considerations

  • Requires manual vertex definition
  • Performance may vary with complex polygons
  • Limited built-in shape presets
  • Not optimized for high-frequency updates
  • May need additional logic for collision detection
  • Best suited for static or infrequently changing polygons

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

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.

Categories

Source repository

Projects using this package

No data available yet.