Giter VIP home page Giter VIP logo

crop_your_image_gallery's People

Contributors

chooyan-eng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

crop_your_image_gallery's Issues

Cropping the image makes my VSCode freezed and prints cryptic messages to console.

I had to close VS code even after I stopped the debugging session since it's so laggy. So it's impossible to copy-paste the message. The freeze happened after onCropped is called.

This is my cropper page code:

import 'dart:typed_data';

class CropperPage extends StatefulWidget {
  final String title;
  final Uint8List image;
  final double aspectRatio;
  final bool isCircle;

  const CropperPage({
    Key? key,
    required this.title,
    required this.image,
    required this.aspectRatio,
    required this.isCircle,
  }) : super(key: key);

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

class _CropperPageState extends State<CropperPage> {
  bool _isProcessing = false;
  final CropController _cropController = CropController();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text(widget.title)),
      floatingActionButton: FloatingActionButton(
        backgroundColor: Colors.green,
        onPressed: () {
          setState(() {
            _isProcessing = true;
          });
          _cropController.crop();
        },
        child: Icon(Icons.done),
      ),
      body: _isProcessing
          ? Padding(
              padding: const EdgeInsets.all(16),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  SizedBox(
                    width: 14,
                    height: 14,
                    child: CircularProgressIndicator(strokeWidth: 2),
                  ),
                  const SizedBox(
                    width: 16,
                  ),
                  Text('Processing')
                ],
              ),
            )
          : Crop(
              image: widget.image,
              onCropped: (value) {
                setState(() {
                  _isProcessing = false;
                });
                Navigator.of(context).pop(value);
              },
              aspectRatio: widget.aspectRatio,
              withCircleUi: widget.isCircle,
              controller: _cropController,
            ),
    );
  }
}

This is the image

WhatsApp Image 2021-10-06 at 4 31 59 PM

It is possible to drag corner circles outside of widget area

If the crop widget does not reach all the way to the sides of the screen, then it is possible to drag corner circles outside of widget area. If you drop the circles there, there's no way to get them back again.

Probably what should happen is that when the crop area hits the side of the widget, dragging should stop -- and the circles should "push in" from the sides and top/bottom of the widget, so that they are always shown.

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.