mchome / flutter_advanced_networkimage

flutter advanced network image provider
https://pub.dev/packages/flutter_advanced_networkimage
MIT License
285 stars 180 forks source link

Function to call when clicked on refresh #117

Closed ghost closed 4 years ago

ghost commented 5 years ago

This is a feature request. I want to call a function when the refresh button is pressed.

What works now is when clicked on refresh button, it simply tries to reload the URL.

Thoughts?

AlaaEldeenYsr commented 5 years ago

No need to to fetch the image url manually because you can keep fetching it automatically without stoping just set the retryLimit to the biggest number as possible AdvancedNetworkImage(imgUrl, retryLimit: Duration.secondsPerDay) also set the retryDurationFactor to zero and the retryDuration is set to Duration(milliseconds: 500) by default no need to be changed.

ghost commented 5 years ago

@AlaaEldeenYsr , Good to have that feature... But it doesn't fit my usecase...

I have uploaded image to AWS S3 and to get image from there, I need to generate a pre signed url that expires in maximum 7 days... So if the url returns error, I want to generate a new url and use it to fetch the image, again it will last for 7 days, but after that I will need to regenerate it...

So if there is a function available that has to return a url, it will be easier...

If you have any other alternatives to achieve this, please suggest... One thing to note, I cannot make the bucket public, so that's not an option...

AlaaEldeenYsr commented 5 years ago

I think you can use this package in your case this https://pub.dev/packages/flutter_image#-readme-tab-

And here is an example of how you can handle you customization. [image: image.png]

Or you can create your own fetch strategy like this. [image: image.png]

Or you can handle it in a raw way like this. [image: image.png]

On Fri, Sep 13, 2019 at 5:45 PM Sulay Sumaria notifications@github.com wrote:

@AlaaEldeenYsr https://github.com/AlaaEldeenYsr , Good to have that feature... But it doesn't fit my usecase...

I have uploaded image to AWS S3 and to get image from there, I need to generate a pre signed url that expires in maximum 7 days... So if the url returns error, I want to generate a new url and use it to fetch the image, again it will last for 7 days, but after that I will need to regenerate it...

So if there is a function available that has to return a url, it will be easier...

If you have any other alternatives to achieve this, please suggest... One thing to note, I cannot make the bucket public, so that's not an option...

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mchome/flutter_advanced_networkimage/issues/117?email_source=notifications&email_token=AMOIPMDUWW3VJ7JFJIILDDDQJOYQPA5CNFSM4ICWZRG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6VNKBQ#issuecomment-531289350, or mute the thread https://github.com/notifications/unsubscribe-auth/AMOIPMA2RBD7Z6SBAD7VOA3QJOYQPANCNFSM4ICWZRGQ .

ghost commented 5 years ago

I think it does not provide caching...

I found another workaround though, setting the cacheTimeOut to a larger timespan did the trick...

So the URL is expired, but still it is in cache so image loads fine.