toast_plus 1.0.6 copy "toast_plus: ^1.0.6" to clipboard
toast_plus: ^1.0.6 copied to clipboard

A customizable toast notification package for Flutter with advanced features and great design.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:toast_plus/toast_plus.dart'; // Import your toast_plus package

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'ToastPlus Demo',
      home: HomePage(),
    );
  }
}

class HomePage extends StatelessWidget {
  void _showToast(BuildContext context, ToastType type) {
    ToastPlus.show(
      context,
      message:
          "Hello im ${type.toString().split('.').last} and this must be long text to test that",
      type: type,
      duration: const Duration(seconds: 12),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('ToastPlus Demo'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            ElevatedButton(
              onPressed: () => _showToast(context, ToastType.success),
              child: Text('Show Success Toast'),
            ),
            ElevatedButton(
              onPressed: () => _showToast(context, ToastType.danger),
              child: Text('Show Danger Toast'),
            ),
            ElevatedButton(
              onPressed: () => _showToast(context, ToastType.info),
              child: Text('Show Info Toast'),
            ),
            ElevatedButton(
              onPressed: () => _showToast(context, ToastType.warning),
              child: Text('Show Warning Toast'),
            ),
          ],
        ),
      ),
    );
  }
}
3
likes
0
points
48
downloads

Publisher

unverified uploader

Weekly Downloads

A customizable toast notification package for Flutter with advanced features and great design.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, flutter_web_plugins

More

Packages that depend on toast_plus