Giter Club home page Giter Club logo

flutter_cropperx's Introduction

CropperX

A cropper package made fully in Flutter.

Circle Rectangle Grid
Screenshot circle Screenshot rectangle Screenshot grid

Types of overlays

The overlay can be defined by adding an overlay type through the overlayType parameter. The following types are currently supported:

  • OverlayType.none: No overlay at all.
  • OverlayType.circle: An overlay with a circular gap.
  • OverlayType.rectangle: An overlay with a rectangular gap, takes the given aspect ratio.
  • OverlayType.grid: An overlay of grid lines: 2 horizontal and 2 vertical, evenly spaced.
  • OverlayType.gridHorizontal: An overlay of 2 horizontal grid lines, evenly spaced.
  • OverlayType.gridVertical: An overlay of 2 vertical grid lines, evenly spaced.

Rotating the image

The image rotation can be defined through the rotationTurns parameter. The default value is 0, corresponding to 0 degrees of rotation. Making the value larger by 1 will rotate the image 90 degrees clockwise, making it smaller will rotate the image 90 degrees counterclockwise. 0 to 4 is not a limit, so going above or below these values will keep rotating the image.

Example

// Import package
import 'package:cropperx/cropper.dart';

// Define a key
final _cropperKey = GlobalKey(debugLabel: 'cropperKey');

// Add the Cropper widget to your tree, using the above key and adding the image to crop
Cropper(
    cropperKey: _cropperKey, // Use your key here
    image: Image.network(
        'https://i.pinimg.com/originals/6b/4d/18/6b4d18c0b756ab20c3591490dfc10090.jpg',
    ),
)

// Get the cropped image as bytes
final imageBytes = await Cropper.crop(
    cropperKey: _cropperKey, // Reference it through the key
)

flutter_cropperx's People

Contributors

thomasmiddel avatar dylan-kwon avatar dylanstouls avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.