EP-u-NW / painter

A simple flutter widget to paint with your fingers
https://pub.dev/packages/painter
Other
137 stars 66 forks source link

Adding a decoration option to add an image as a background #10

Closed freshteapot closed 4 years ago

freshteapot commented 5 years ago

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.

gedw99 commented 5 years ago

Is this likely to be merged ? I also need this functionality.

EP-u-NW commented 4 years ago

Hi, after reviewing your code, I don't understand, how the decoration is actually applied. You declare it, but where do you use it?

tmarzeion commented 4 years ago

Actually what this PR do is adding Decoration field with proper setter/getter, but that's all. There are 2 things that should be done to make it proper PR:

  1. Do something with _decorationForPainter in painter.dart, because its unused ATM.
  2. IMHO its much better to make some method that would take image as parameter (as asset path, as byte array or something like that) instead of Decorator so that logic is on library side.
aravindhkumar23 commented 4 years ago

@gedw99

Here is my pull request for work around to set the background.

Hope this helps some one to achieve it.

freshteapot commented 4 years ago

No problem for closing it, it was mostly to show a way to do it. I am still far too new, to know how best to do it in flutter.