A simple flutter widget to paint with your fingers

Overview

painter

A simple flutter widget to paint with your fingers.

Features

The widget supports:

  • Changing fore- and background color
  • Changing the thickness of lines you draw
  • Exporting your painting as png
  • Undo drawing a line
  • Clearing the whole drawing
  • Check if anything was drawn at all (using `PainterController.isEmpty')
  • Erase Mode

Some Notes

  • After calling 'finish()' on a PainterController you can't draw on this painting any more
  • To create a new painting after finishing the old one simply create a new PainterController
  • Calling 'finish()' for the first time will render the drawing. Successive calls will then return a cached version of the rendered picture

Example

For a full example take a look at the example project. Here is a short recording showing it. Note that the color picker is an external dependency which is only required for the example.

demo!

Comments
  • access to image data while it is not finished

    access to image data while it is not finished

    before I set the painter as finished I would like to:

    • know if anything has been painted at all (true/false)
    • get a snapshot image of the drawing but still let the user draw more is that possible?
    enhancement 
    opened by gbuela 6
  • Null safety

    Null safety

    Hey, Do you guys plan to upgrade to support Dart Null Safety?

     dart pub outdated --mode=null-safety
    
    Resolving...
    Showing dependencies that are currently not opted in to null-safety.
    [✗] indicates versions without null safety support.
    [✓] indicates versions opting in to null safety.   
    
    Computing null safety support...
    Package Name                          Current        Upgradable      Resolvable  Latest
    
    direct dependencies:
    ...
    painter                               ✗0.4.0         ✗0.4.0          -           ✗0.4.0
    ...
    
    opened by BartusZak 5
  • Adding a decoration option to add an image as a background

    Adding a decoration option to add an image as a background

    Example usage:

    controller.decorationForPainter = new BoxDecoration(
          image: new DecorationImage(
            image: ExactAssetImage('assets/bg.jpg'),
          ),
        );
    

    I am not sure if this is the best approach, as I am still quite new to flutter. Equally this does not satisfy the issue request (#3 ) of using an image from the gallery.

    invalid 
    opened by freshteapot 5
  • A value of type 'Future<Image>' can't be assigned to a variable of type 'Image'.

    A value of type 'Future' can't be assigned to a variable of type 'Image'.

    I have this error when download the project A value of type 'Future' can't be assigned to a variable of type 'Image'. in the method of class painter.

    In the line 166 to 168:

    Image toImage(){ return picture.toImage(width, height); // here! }

    opened by sebasval 4
  • How can I store the location of a path as a list of offsets?

    How can I store the location of a path as a list of offsets?

    I would like to save the drawing as a list of lists. More specifically, a list of paths that each has a list of offset points in (x and y). Is this possible using the PainterController in this package?

    opened by PeterTF656 2
  • operation failed - throws when toImage() is called

    operation failed - throws when toImage() is called

    Hi When we try to convert the painter to image/png it throws error saying "operation failed" works in most of devices but facing issue in some iOS and some android devices[ tested in samsung s10 and honor devices]

    any workaround or solution to get it fixed.

    my logic is simple, pasting here....

    try{
      var imgToSendBack =await _controller.finish().toPNG();
    }catch(e){
    print('save image catch error ${e.toString()}');
    }
    
    opened by aravindhkumar23 2
  • Set background image for canvas.

    Set background image for canvas.

    Add a background image to canvas via controller

    Example updated with FAB to set background image (if Background image set the background colour is not taken into account.)

    I hope this helps setting background image

    opened by aravindhkumar23 2
  • Feature: thickness size based on speed

    Feature: thickness size based on speed

    It would be cool have an option to enable the thickness of the pencil based on the speed of the cursor. I tried to draw something in native iOS and it seems to behave like that! What do you think?

    enhancement 
    opened by tapeo 2
  • Erase support (transparent background only)

    Erase support (transparent background only)

    Here is PR with code change that allows user to set erase mode. Set controller.eraseMode = true for erase mode.

    Note: This works only for transparent background. If You want this to work with colored background, further code changes are needed. My suggestion is moving background to another canvas, by simply using Stack and inserting simple box view below painter layer.

    opened by tmarzeion 2
  • Don't get the full image (PNG) on mobile

    Don't get the full image (PNG) on mobile

    When i run the app on Web (Chrome) works like a charm (i make a signature, goes to the next step and at the end i made a base64 String with the data of the PNG (.toPNG()), but when i change to mobile the image don't render correctly (only do like 24 pixels of height) it does all the width (like 323 pixels).

    Container with a button to generate the PNG and storage in a variable. image

    Button to print the base64 string image

    And this is the only result when i run the app in a mobile device (It's missing a lot of lines) image

    How it looks (the image have the correct dimensions but the content is missing): image

    opened by Juanitocancino 1
  • Support - Adding New custom shape using Custom paint on canvas.

    Support - Adding New custom shape using Custom paint on canvas.

    Guys, is there any way we can add our custom drawing shape to cavas ??

    Or any way we can get instance of canvas which can help to get painted over it ? Just like any circle on canvas as shown in image.

    image

    opened by anujraghuvanshi 1
  • Please provide the support for starting and ending point while user is drawing on the screen

    Please provide the support for starting and ending point while user is drawing on the screen

    Right now, we don't have any callback to check from where the user is started drawing on the screen. We are not getting any coordinates on the screen. Need help with this!

    opened by darshitArkay 1
  • Optimized the process by applying flutter_lints.

    Optimized the process by applying flutter_lints.

    Hi amazing developer,

    This library does not have flutter_lints applied, so I added it as a dependency. Also, the warning that was generated when adding flutter_lints to the dependency has been optimized here so that it does not affect the existing behavior. Please check this PR and merge it if there is no problem.

    Thank you.

    opened by myConsciousness 0
  • Erasing crashes app on mobile web

    Erasing crashes app on mobile web

    I noticed a crash when attempting to erase in my Flutter web application only on mobile web browsers. I then tested it with the example code from pub.dev and experienced the same behavior.

    It appears that paint.blendMode = BlendMode.clear; is the culprit.

    One quick workaround I found is to just simulate an erase stroke by painting using the backgroundColor.

    if (_eraseMode) {
      paint.blendMode = BlendMode.srcOver;
      paint.color = backgroundColor;
    }
    

    However, in my app, my PainterController has backgroundColor = Colors.transparent.

    I am not that familiar with different blend modes and if there is another way to achieve my desired result.

    opened by theandrewmack 1
A mobile image uploader in which you can upload image to your personal gallery from either your camera or mobile gallery and it can detect your current geographic location and address using firebase firestore and storage.

Image Uploader In Flutter About It is an Image Uploader gallery which tracks your address from which you're uploading using Flutter and Image picker.

Prahen parija 6 Dec 20, 2022
A simple easy to use Flutter DApp , which keeps a track of all your day to day transactions by using Ethereum blockchain in the background which in turn increases your credit score.

Sahayog A simple easy to use Flutter DApp , which keeps a track of all your day to day transactions by using Ethereum blockchain in the background whi

Utkarsh Agarwal 15 May 21, 2022
Page Turn Widget - Add a page turn effect to widgets in your app. Maintainer: @rodydavis

Page Turn Widget Add a page turn effect to widgets in your app. Created by Simon Lightfoot @slightfoot Screenshots Example import 'package:flutter/mat

Flutter Community 177 Dec 29, 2022
Run asynchronous code before building your widget

Loader Sometimes you need to load some data before building your widget. Because initState doesn't support asynchronous loading you need to find anoth

Ali Ghanbari 4 Apr 17, 2022
About This is Personal Expenses Planner. You can add your expenses in to the app and manage your transaction. and you can see How much did you spend on which day. I developed this project using flutter.

expense_planner A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started

Darshit Rudani 5 Jul 6, 2022
A multi-plateform (Flutter) application for reading your emails, with your favorite devices, using the JMAP protocol!

A multi-plateform (Flutter) application for reading your emails, with your favorite devices, using the JMAP protocol!

LINAGORA 119 Jan 2, 2023
A task manager app made with flutter where you can mark your tasks for specific days and keep your life organized!

task_manager_app A task manager app made with flutter where you can mark your tasks for specific days and keep your life organized! Getting Started Th

null 2 Sep 1, 2021
Movie Lib is a mobile application where you can find the movies of your interest. This app provides a collection of movies of different languages according to your interest.

Movie Lib Movie Lib is a mobile application where you can find the movies of your interest. This app provides a collection of movies of different lang

Abhijith Kp 6 Sep 28, 2021
Your grades across all your devices.

Gradely 2 A Grade Calculator App, that syncs all your Grades across all your devices, built with Flutter and with the amazing backend Appwrite. Screen

Elias Schneider 16 Dec 8, 2022
A web dashboard that allows you to monitor your Chia farm and sends notifications when blocks are found and new plots are completed through a discord bot. It can link multiple farmers/harvesters to your account.

farmr A web dashboard that allows you to monitor your Chia farm and sends notifications when blocks are found and new plots are completed through a di

Gil Nobrega 261 Jan 2, 2023
This app is a minimal TodoList app that functions like a whiteboard. You can add new tasks, keep track of your tasks to make your day more productive, and then delete it after it is done.

My First Mobile App _ Minimal TodoList Flutter A new Flutter project. Getting Started This project is a starting point for a Flutter application. A fe

null 0 Nov 23, 2021
Quickly generate a personalized WhatsApp link with a predefined message and share it with your audience on your Social Networks!

Quickly generate a personalized WhatsApp link with a predefined message and share it with your audience on your Social Networks!

Sanskar Tiwari 11 Aug 28, 2021
BankGit helps you manage your account and transactions more efficiently by breaking your account into branches for various purposes and then making transactions directly from them.

Bank Git Web Hosted Here : https://bank-management-45848.web.app/ Bank Git is an application built with Flutter and Firebase to help you manage your b

Yash Johri 27 Dec 26, 2022
Get your users to know your app with ease

nice_intro Get your users to know your app with ease Getting Started Onboarding is a great way to introduce your app to newcomers, to help them quickl

Ethiel ADIASSA 20 Nov 7, 2022
App to seamlessly share files/images from your phone to your pc

Self-Share App to seamlessly share files/images from your phone to your pc Image

Wahbi 1 May 28, 2022
QR.Flutter is a Flutter library for simple and fast QR code rendering via a Widget or custom painter.

QR.Flutter is a Flutter library for simple and fast QR code rendering via a Widget or custom painter. Need help? Please do not submit an issue for a "

Yakka 612 Jan 4, 2023
This App Currently is a Simple Budget Manager Show Analytics Based on Your Past Transactions

Budgex [In Progress] This App Currently is a Simple Budget Manager Show Analytics Based on Your Past Transactions Features Localization Persistant Sto

Mohammad Javad Hossieni 8 Nov 14, 2022
Learn Flutter on Flutter! A widget directory with implementation samples!

Fludget Browse through a variety of widgets used in flutter This application is developed to learn Flutter using Flutter. Different widgets used in fl

ACM VIT 29 Nov 23, 2022
FileManager is a wonderful widget that allows you to manage files and folders, pick files and folders, and do a lot more. Designed to feel like part of the Flutter framework.

File Manager FileManager is a wonderful widget that allows you to manage files and folders, pick files and folders, and do a lot more. Designed to fee

Devs On Flutter 52 Dec 30, 2022