flyerhq / flutter_link_previewer

Customizable link and URL preview extracted from the provided text with the ability to render from the cache. Ideal for chat applications.
MIT License
72 stars 75 forks source link

Complete customization #23

Closed wer-mathurin closed 3 years ago

wer-mathurin commented 3 years ago

Very good library and very useful.

I would like to understand If you would be open to provide this feature.

Add another Widget call: LinkPreviewerBuilder({this.url, required Widget Function(PreviewData) builder});

Basically, this widget is giving the user full control about how to display the preview. As a first step all logic of retrieving the data can be moved to the LinkPreviewerBuilder class and the LinkPreview can use the LinkPreviewerBuilder to display and animate it as of today.

demchenkoalex commented 3 years ago

Thanks for the suggestion, but I had to remove the custom builder, because it was used only after preview data was fetched, that resulted in a nothing -> then preview. Normally, this package renders the text provided by the user and it becomes a full preview after a fetch. I tried to move the builder inside the "data fetched check", so the package would render the text provided by the user instead of nothing, but it resulted in a mix of our implementation and a custom builder, which is again, not good. What I did is just exported the getPreviewData method, so you can now use it whenever you want to get the preview data and you could render whatever before and after you get it. Released in v2.2.2.