sh_toast

Last updated:

0 purchases

sh_toast Image
sh_toast Images
Add to Cart

Description:

sh toast

sh_toast #
sh_toast is a Flutter package that provides a simple way to display toasts or Notifications without context in your app.
Usage #
To use this package, you need to include it in your pubspec.yaml file:
dependencies:
sh_toast: # Use the latest version from pub.dev
copied to clipboard
Then run flutter pub get to install the package.
Import the package in your Dart code:
import 'package:sh_toast/show_toast.dart';
copied to clipboard
add FToastBuilder() in your MaterialApp:
return MaterialApp(
builder: FToastBuilder(),
// ...
);
copied to clipboard
or Wrap your MaterialApp with ShToast widget:
return ShToast(
child: MaterialApp(
// ...

));
copied to clipboard
Now you can show a toast or Notifications:
Notifications #


parameters:

title: The title widget of the notification. (Required)
content: The content widget of the notification. (Optional)
leading: The leading widget of the notification. (Optional)
showDismiss: Flag to determine whether to display the dismiss button. (Default: true)
toastOptions: The options for customizing the appearance and behavior of the notification. (Default: NotificationOptions(borderRadius: 5, secondDuration: 4))
dismissButton: The custom dismiss button widget. (Default: DismissButton())
onTap: Callback function to be triggered when the notification is tapped. (Optional)

ShToast.showNotification(
title: Text('Notification Title'), // reqired
content: Text('Notification Content'),
showDismiss: true, // default is True
dismissButton: DismissButton(
onDismiss: () {
print('dismiss');
},
),
onTap: () {
print('Tap notification');
},
);
copied to clipboard
Toast #
parameters:

message: The message to be displayed in the toast. (Required)
toastPostion: The position where the toast should be shown. (Required)
ToastColor: The background color of the toast. (Default: Colors.black)
msgStyle: The text style for the message. (Optional)
borderRadius: The border radius of the toast. (Default: 10)
ToastPadding: The padding for the toast. (Default: EdgeInsets.symmetric(horizontal: 5, vertical: 3))
ToastDuration: The duration for which the toast should be visible. (Default: Duration(seconds: 2))
onTap: Callback function to be triggered when the toast is tapped. (Optional)


ShToast.showToast(
message: "Hello, this is a toast!",
toastPosition: ToastPostion.top, // Specify the position of the toast
);
copied to clipboard
Available Positions #

ToastPostion.top
ToastPostion.bottom
ToastPostion.topLeft
ToastPostion.topRight
ToastPostion.bottomRight
ToastPostion.bottomLeft

License #
This package is released under the MIT License. See LICENSE for details.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.