giffy_dialog
giffy_dialog copied to clipboard
AssetGiffyDialog and NetworkGiffyDialogg are the same
AssetGiffyDialog
and NetworkGiffyDialog
are exactly the same.
The only difference is that NetworkGiffyDialog
accepts any Widget
as image
prop, while AssetGiffyDialog
accepts only Image
.
Perhaps it could be simplified somehow, e.g. one ImageGiffyDialog
widget that can accept both Image.asset
and Image.network
. Actually, they return same type - Image
, so it can be already done without any changes to logic.
One other option is make different constructors like ImageGiffyDialog.asset()
and ImageGiffyDialog.network()
. Although I don't think it is necessary at this point since Flutter's Image
is handling all the asset vs network logic already.
Fair point. Instead of having two different classes it is much better to have named constructors taking relevant input. IIRC Flutter's Image doesn't handle all the asset vs logic by itself, you need to pass the relevant ImageProvider to it, be it AssetImage or NetworkImage.
@ArtemKolichenkov, @astralstriker yes, this can be resolved using factory constructors.
This is my view on the solution -> We can create an internal enum for all the dialog types which then can be set in factory constructor initialization. Then we can build that gif part of the widget on the basis of this enum.
Fixed in https://github.com/xsahil03x/giffy_dialog/releases/tag/v2.0.0