polygon_clipper 1.0.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 39

Polygon Clipper

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

Example1 Example2 Example3

Installation

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

dependencies:
  polygon_clipper: "^1.0.0"

Usage

// Import package  
import 'package:polygon_clipper/polygon_clipper.dart';  
  
new ClipPolygon(  
 sides: 6, 
 borderRadius: 5.0, // Default 0.0 degrees
 rotate: 90.0, // Default 0.0 degrees
 boxShadows: [  
  new PolygonBoxShadow(color: Colors.black, elevation: 1.0),
  new PolygonBoxShadow(color: Colors.grey, elevation: 5.0)
 ],
 child: new Container(color: Colors.black),
);

Parameters

ClipPolygon

| Param | Type | Description | |---|---|---|
| sides | int | The number of sides to draw the polygon | borderRadius | double | The length of the border radius in degrees. | rotate | double | The initial polgyon rotation in degrees. | child | Widget | The widget that will be rendered inside the polygon. | boxShadows | PolygonBoxShadow[] |A list of box shadows.

PolygonBoxShadow

| Param | Type | Description | |---|---|---|
| color | Color | The color of the box shadow. | elevation | double | The distance of the shadow.

Contributing

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

v0.0.1 - First release

This release includes:

  • Ability to create polygon views
  • Ability to round the corners
  • Ability to add a list of shadows

example/main.dart

import 'package:flutter/material.dart';
import 'package:polygon_clipper/polygon_clipper.dart';

void main() => runApp(new ExampleApp());

class ExampleApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new Container(
      color: Colors.white,
      child: new Center(
        child: new ClipPolygon(
          child: new Container(
              decoration: new BoxDecoration(
                gradient: new LinearGradient(
                  begin: Alignment.topLeft,
                  end: Alignment.bottomRight,
                  colors: [
                    Colors.red[200],
                    Colors.red[800],
                  ],
                ),
              ),
              child: new Center(
                child: new Icon(
                  Icons.add_a_photo,
                  color: Colors.white,
                  size: 150.0,
                  textDirection: TextDirection.ltr,
                ),
              )
          ),
          boxShadows: [
            new PolygonBoxShadow(color: Colors.black, elevation: 5.0),
          ],
          sides: 6,
          borderRadius: 5.0,
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  polygon_clipper: ^1.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:polygon_clipper/polygon_clipper.dart';
  
Version Uploaded Documentation Archive
1.0.0 Jun 21, 2018 Go to the documentation of polygon_clipper 1.0.0 Download polygon_clipper 1.0.0 archive
0.0.2 Jun 21, 2018 Go to the documentation of polygon_clipper 0.0.2 Download polygon_clipper 0.0.2 archive
0.0.1 Jun 21, 2018 Go to the documentation of polygon_clipper 0.0.1 Download polygon_clipper 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
78
Health:
Code health derived from static analysis. [more]
0
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
39
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.19.0 <2.0.0