vintage / scratcher

Scratch card widget which temporarily hides content from user.
https://pub.dev/packages/scratcher
MIT License
575 stars 67 forks source link

Allow cover image to be loaded from network instead of local asset #7

Closed stehag closed 4 years ago

stehag commented 4 years ago

Can imagePath be changed from String to Image so we can load the cover image from network instead of a local asset?

vintage commented 4 years ago

Hey @stehag!

That should be definitely possible to implement it that way so both local and network image can be used as the cover. Need to dig a bit on how to solve the issue of getting list of bytes from external source, or how to universally get bytes from Image object.

vintage commented 4 years ago

Kapture 2019-12-11 at 21 02 09

That's the demo which uses image from network https://images.unsplash.com/photo-1571339617057-6761e8428fe0?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=750&q=80 so it's implementable. I've got some dirty solution locally, need to put some time into polishing it, but it would happen this year 👍

vintage commented 4 years ago

Good news @stehag - the feature has landed in 1.3.0 release https://pub.dev/packages/scratcher :) From now on instead of providing imagePath as string, the consumer needs to pass the image parameter which would be typical Flutter image like:

Scratcher(
  image: Image.network("MY_URL"),
  # image: Image.asset("LOCAL_PATH"),
),

That's a breaking change in the API, so the minor version been bumped. Let me know if got any issues 💙