belovance / QuickAlert

An instantly ready, full-featured alerts for development on any platform with flutter. Enabling you to complete projects and deploy quickly. With QuickAlert, you can display animated alert dialogs such as success, error, warning, confirm, loading or even a custom dialog.
https://pub.dev/packages/quickalert
MIT License
46 stars 42 forks source link

Factory constructors should be provided for each event #10

Closed myConsciousness closed 1 year ago

myConsciousness commented 1 year ago

Hi @ItsAkashS22 ,

Thanks for amazing package anyway, I really love it :) I would like to suggest the following improvements to this package.

Currently, an Enum corresponding to each dialog is passed when instantiating a QuickAlert object, but this should be eliminated and a factory constructor corresponding to each dialog should be provided.

So it's currently initialized as follows:

QuickAlert.show(
 context: context,
 type: QuickAlertType.success,
 text: 'Transaction Completed Successfully!',
);
QuickAlert.show(
 context: context,
 type: QuickAlertType.error,
 title: 'Oops...',
 text: 'Sorry, something went wrong',
);

But I suggest like:

QuickAlert.success(
 context: context,
 text: 'Transaction Completed Successfully!',
);
QuickAlert.error(
 context: context,
 title: 'Oops...',
 text: 'Sorry, something went wrong',
);

There are many advantages to having a factory constructor for each event. Currently, the developer must tailor the options depending on the type of dialog used, but providing a factory constructor would eliminate the need to be actively aware of the options required for each dialog :)

Thank you.

ItsAkashS22 commented 1 year ago

Hello @myConsciousness 👋

Thank you for using the package and spending your valuable time to post this improvement. We have included this enhancement to our updates list for the next update & we'll be out with the new update with this improvement and many more features soon.

Till Then, Happy Coding ✨