Flutter In-App Notifications

A simple Flutter package to generate instant in-app notifications.

pub package

flutter_inapp_notifications

Installing

Add this to your package's pubspec.yaml file:

dependencies:
  flutter_inapp_notifications: ^1.0.0

Import

import 'package:flutter_inapp_notifications/flutter_inapp_notifications.dart';

How to use

First, initialize InAppNotifications in your MaterialApp/CupertinoApp:

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter InAppNotifications',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter InAppNotifications'),
      builder: InAppNotifications.init(),
    );
  }
}

Then:

InAppNotifications.show(
    title: 'Welcome to InAppNotifications',
    leading: Icon(
      Icons.fact_check,
      color: Colors.green,
      size: 50,
    ),
    ending: Icon(
      Icons.arrow_right_alt,
      color: Colors.red,
    ),
    description:
        'This is a very simple notification with leading and ending widget.',
    onTap: () {
      // Do whatever you need!
    });

You can play around with leading and ending widgets, as well as not sending any of them.

Add loading status callback

InAppNotifications.addStatusCallback((status) {
  print('InAppNotifications Status $status');
});

Remove loading status callback(s)

InAppNotifications.removeCallback(statusCallback);

InAppNotifications.removeAllCallbacks();

Customize

Customization is pretty straighforward, I'm actually working on more attributes to customize. Feel free to request new customizations.

Customize it anywhere:

InAppNotifications.instance
  ..titleFontSize = 14.0
  ..descriptionFontSize = 14.0
  ..textColor = Colors.black
  ..backgroundColor = Colors.white
  ..shadow = true
  ..animationStyle = InAppNotificationsAnimationStyle.scale;

// Custom animation
InAppNotifications.instance
  ..titleFontSize = 14.0
  ..descriptionFontSize = 14.0
  ..textColor = Colors.black
  ..backgroundColor = Colors.white
  ..shadow = true
  ..customAnimation = MyCustomAnimation()
  ..animationStyle = InAppNotificationsAnimationStyle.custom;

Changelog

CHANGELOG

License

MIT License

This was possible thanks to

easy_loading ❤️ This package was an inspiration, as well as a great reference to create this kind of packages.