image_crop_widget 0.0.6 copy "image_crop_widget: ^0.0.6" to clipboard
image_crop_widget: ^0.0.6 copied to clipboard

A Flutter widget to crop images. The widget is completely written in Dart and has minimal dependencies.

example/example.dart

import 'dart:ui' as ui;

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

class ExampleScreen extends StatefulWidget {
  final ui.Image imageFile;
  ExampleScreen(this.imageFile);

  @override
  _ExampleScreenState createState() => _ExampleScreenState();
}

class _ExampleScreenState extends State<ExampleScreen> {
  final key = GlobalKey<ImageCropState>();

  void _onCropPress() async {
    final croppedImage = await key.currentState.cropImage();

    showModalBottomSheet(
      context: context,
      builder: (context) => RawImage(
        image: croppedImage,
        fit: BoxFit.contain,
        height: croppedImage.height.toDouble(),
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: Column(
          children: <Widget>[
            Expanded(
              child: ImageCrop(key: key, image: widget.imageFile),
            ),
            FlatButton(
              child: Text("Okay"),
              onPressed: _onCropPress,
            ),
          ],
        ),
      ),
    );
  }
}
9
likes
40
pub points
41%
popularity

Publisher

unverified uploader

A Flutter widget to crop images. The widget is completely written in Dart and has minimal dependencies.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on image_crop_widget