t_overlay_notification 1.1.0 copy "t_overlay_notification: ^1.1.0" to clipboard
t_overlay_notification: ^1.1.0 copied to clipboard

A reusable Flutter notification overlay for success, error, warning, and info messages.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:t_overlay_notification/t_overlay_notification.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Builder(
        builder: (context) => Scaffold(
          appBar: AppBar(title: Text('Notification Overlay Example')),
          body: Center(
            child: Column(
              children: [
                ElevatedButton(
                  onPressed: () {
                    TNotificationOverlay.success(
                      context: context,
                      title: 'Success Notification',
                      subTitle:
                          'This is a success notification. \n Expanding to line two.',
                    );
                  },
                  child: Text('Success Notification'),
                ),
                const SizedBox(height: 30),
                ElevatedButton(
                  onPressed: () {
                    TNotificationOverlay.warning(
                      context: context,
                      title: ('Warning Notification'),
                      subTitle:
                          ('This is a Warning notification. \n Expanding to line two.'),
                    );
                  },
                  child: Text('Warning Notification'),
                ),
                const SizedBox(height: 30),
                ElevatedButton(
                  onPressed: () {
                    TNotificationOverlay.error(
                      context: context,
                      title: ('Error Notification'),
                      subTitle:
                          ('This is a Error notification. \n Expanding to line two.'),
                    );
                  },
                  child: Text('Error Notification'),
                ),
                const SizedBox(height: 30),
                ElevatedButton(
                  onPressed: () {
                    TNotificationOverlay.info(
                      context: context,
                      title: ('Info Notification'),
                      subTitle:
                          ('This is a Info notification. \n Expanding to line two.'),
                    );
                  },
                  child: Text('Info Notification'),
                ),
                const SizedBox(height: 30),
                ElevatedButton(
                  onPressed: () {
                    TNotificationOverlay.info(
                      sticky: true,
                      context: context,
                      title: ('Info Notification'),
                    );
                  },
                  child: Text('Info Single Line Notification'),
                ),
                const SizedBox(height: 30),
                ElevatedButton(
                  onPressed: () {
                    TNotificationOverlay.show(
                      context: context,
                      title: ('Bottom Left Notification'),
                      subTitle: ('This is a Bottom Left notification.'),
                      type: NotificationType.info,
                      position: NotificationPosition.bottomLeft,
                      slideInDirection: SlideDirection.leftToRight,
                      slideOutDirection: SlideDirection.leftToRight,
                    );
                  },
                  child: Text('Bottom Left Notification'),
                ),
                const SizedBox(height: 30),
                ElevatedButton(
                  onPressed: () {
                    TNotificationOverlay.show(
                      context: context,
                      title: ('Bottom Right Notification'),
                      subTitle: ('This is a Bottom Right notification.'),
                      type: NotificationType.info,
                      position: NotificationPosition.bottomRight,
                      slideInDirection: SlideDirection.rightToLeft,
                      slideOutDirection: SlideDirection.rightToLeft,
                    );
                  },
                  child: Text('Bottom Right Notification'),
                ),
                const SizedBox(height: 30),
                ElevatedButton(
                  onPressed: () {
                    TNotificationOverlay.show(
                      context: context,
                      width: 350,
                      spacing: 30,
                      title: 'Custom Notification',
                      subTitle: 'This is a custom notification',
                      action: Row(
                        children: [
                          TextButton(
                              onPressed: () {},
                              child: Text(
                                'Dismiss',
                                style: TextStyle(color: Colors.white),
                              )),
                          const SizedBox(width: 8),
                          TextButton(
                              onPressed: () {},
                              child: Text('Undo',
                                  style: TextStyle(color: Colors.white)))
                        ],
                      ),
                      type: NotificationType.info,
                      duration: Duration(seconds: 3),
                      position: NotificationPosition.bottomLeft,
                      slideInDirection: SlideDirection.leftToRight,
                      slideOutDirection: SlideDirection.leftToRight,
                    );
                  },
                  child: Text('Custom Notification with Buttons'),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
4
likes
160
points
104
downloads

Publisher

verified publishercodingwitht.com

Weekly Downloads

A reusable Flutter notification overlay for success, error, warning, and info messages.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, iconsax

More

Packages that depend on t_overlay_notification