sdlAndroidShowToast function
Shows an Android toast notification.
Toasts are a sort of lightweight notification that are unique to Android.
https://developer.android.com/guide/topics/ui/notifiers/toasts
Shows toast in UI thread.
For the gravity
parameter, choose a value from here, or -1 if you don't
have a preference:
https://developer.android.com/reference/android/view/Gravity
\param message text message to be shown \param duration 0=short, 1=long \param gravity where the notification should appear on the screen. \param xoffset set this parameter only when gravity >=0 \param yoffset set this parameter only when gravity >=0 \returns 0 if success, -1 if any error occurs.
\since This function is available since SDL 2.0.16.
extern DECLSPEC int SDLCALL SDL_AndroidShowToast(const char* message, int duration, int gravity, int xoffset, int yoffset)
Implementation
int sdlAndroidShowToast(
String? message, int duration, int gravity, int xoffset, int yoffset) {
final sdlAndroidShowToastLookupFunction = libSdl2.lookupFunction<
Int32 Function(Pointer<Utf8> message, Int32 duration, Int32 gravity,
Int32 xoffset, Int32 yoffset),
int Function(Pointer<Utf8> message, int duration, int gravity,
int xoffset, int yoffset)>('SDL_AndroidShowToast');
final messagePointer = message != null ? message.toNativeUtf8() : nullptr;
final result = sdlAndroidShowToastLookupFunction(
messagePointer, duration, gravity, xoffset, yoffset);
calloc.free(messagePointer);
return result;
}