customtoastflutter 0.0.1 copy "customtoastflutter: ^0.0.1" to clipboard
customtoastflutter: ^0.0.1 copied to clipboard

A new Custom Toast for flutter.

CustomToastFlutter A custom Flutter package to show beautiful and animated toast messages with ease. Customize background colors, text style, duration, and animations to suit your application's look and feel.

πŸ“¦ Installation Add the following dependency to your pubspec.yaml:

yaml Copy code dependencies: customtoastflutter: ^1.0.0 Then, run:

bash Copy code flutter pub get πŸš€ Usage Import the package in your Dart file:

dart Copy code import 'package:flutter/material.dart'; import 'package:customtoastflutter/customtoast.dart'; Show a Toast Call the showToast method to display a custom toast:

dart Copy code FlutterCustomToast.showToast( context: context, message: 'This is a custom toast!', backgroundColor: Colors.deepPurple, textStyle: TextStyle(color: Colors.white, fontWeight: FontWeight.bold), duration: Duration(seconds: 3), animationDuration: Duration(milliseconds: 500), ); Parameters: context: Required. The BuildContext to show the toast. message: Required. The message text to display in the toast. backgroundColor: (Optional) Background color of the toast. Default: Color(0xFF002147). textStyle: (Optional) Style for the text in the toast message. duration: (Optional) How long the toast is visible. Default: Duration(seconds: 3). animationDuration: (Optional) Duration of the toast's entrance and exit animations. Default: Duration(milliseconds: 500). πŸ“˜ Example Here's a simple example to demonstrate how to use CustomToastFlutter in a basic Flutter project.

Step 1: Create a New Flutter Project If you haven’t already, create a new Flutter project:

bash Copy code flutter create my_flutter_app Step 2: Add customtoastflutter Dependency Add the following to your pubspec.yaml:

yaml Copy code dependencies: customtoastflutter: ^1.0.0 Run:

bash Copy code flutter pub get Step 3: Modify main.dart Update your lib/main.dart file to include the following code:

dart Copy code import 'package:flutter/material.dart'; import 'package:customtoastflutter/customtoast.dart';

void main() { runApp(MyApp()); }

class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( appBar: AppBar(title: Text('CustomToastFlutter Example')), body: Center( child: ElevatedButton( onPressed: () { FlutterCustomToast.showToast( context: context, message: 'Hello from CustomToast!', backgroundColor: Colors.orange, textStyle: TextStyle(fontWeight: FontWeight.bold, fontSize: 16), duration: Duration(seconds: 3), animationDuration: Duration(milliseconds: 500), ); }, child: Text('Show Toast'), ), ), ), ); } } πŸ”— Resources Flutter Documentation Flutter Cookbook: Useful Samples πŸ“œ License This project is licensed under the MIT License.

For more information, feel free to contribute to the CustomToastFlutter repository.

0
likes
130
points
31
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A new Custom Toast for flutter.

Homepage

License

MIT (license)

Dependencies

flutter

More

Packages that depend on customtoastflutter