Toast-PhoneGap-Plugin
Toast-PhoneGap-Plugin copied to clipboard
Global definition for style
Hi @EddyVerbruggen,
just awesome you've added the possibility to style toasts. But as you may know me, I have always some extra wishes :p
I'm calling my toasts in different ways at many positions in my code. Is it possible to call a function on app.run (example when using angular), or even deviceready, to define default styling instead of passing the values over and over again? I would like to define a default. It should be possible to overwrite though, but would make things much more efficient.
Haha, keep 'em coming ;)
I imagine you have one place in your app where you actually call showWithOptions
, right? Or else you should create one really. You can then pass in an object and merge with your 'defaults' object. I don't really see why that should be part of the plugin.
That being said perhaps I'll make a 'setDefaultOptions' function anyway. Just not today :)
Haha, yeah, you're right. Currently, I've mixed a lot. (showLongCenter, showShortTop() etc.) at different positions in my code, depending on my layout.
But a
window.plugins.toast.setDefaultOptions({
styling: {
opacity: 0.75, // 0.0 (transparent) to 1.0 (opaque). Default 0.8
backgroundColor: '#FF0000', // make sure you use #RRGGBB. Default #333333
cornerRadius: 16, // minimum is 0 (square). iOS default 20, Android default 100
horizontalPadding: 20, // iOS default 16, Android default 50
verticalPadding: 16 // iOS default 12, Android default 30
}
});
would be awesome. Not needed today :). Actually, setDefaultLayoutOptions() should be enough.
:+1:
Guys "cannot read property 'toast' of undefined" Can anyone help me with this error?
@EddyVerbruggen
StackOverflow can
Hi @EddyVerbruggen
Didn't find any solution on StackOverflow. Maybe I missed it. Can you please share the link. It will be really helpful.
Would you please stop hijacking my issue?
huh??
Guys no intention to hijack anyone's airplane or issue.
Just as this issue https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin/issues/58 was open, and saw the author @EddyVerbruggen active here. Thought would ask for help here.
Kindly help if possible.
Thanks in advance.
Hey @abhisheknjain no worries, you're probably not aware that I get notified of ALL comments in ANY issue, so you might as well have added it to #58 (I will also add a comment there).
@Hirbod has a good point that his issue is now polluted with irrelevant comments.
Just something to consider next time :+1: