notification_banner 0.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 79

notification_banner #

A new Flutter package project.

Getting Started #

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

[0.0.1] - 08.04.2020 #

  • Initial release.

[0.0.2] - 10.04.2020 #

  • Adding "copy-paste" DialogWidget from Flutter repo
  • Refactoring

[0.0.3] - 19.04.2020 #

  • Fixing the problem with padding

[0.1.0] - 06.05.2020 #

  • Changing background color of the banner
  • Chnaging text style
  • Canging border radius

example/lib/main.dart

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

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Banner Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Banner Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            MaterialButton(
              child: Text('Default from top'),
              onPressed: () {
                NotificationBanner(context)
                  ..setMessage('Default from top')
                  ..show(Appearance.top);
              }
            ),
            MaterialButton(
              child: Text('Default from bottom'),
              onPressed: () {
                NotificationBanner(context)
                  ..setMessage('Default from bottom')
                  ..show(Appearance.bottom);
              }
            ),
            MaterialButton(
              child: Text('Changed background color'),
              onPressed: () {
                NotificationBanner(context)
                  ..setMessage('Different color')
                  ..setBgColor(Colors.brown)
                  ..show(Appearance.top);
              }
            ),
            MaterialButton(
              child: Text('Changed text style'),
              onPressed: () {
                NotificationBanner(context)
                  ..setMessage('Changed text style')
                  ..setTextStyle(TextStyle(
                    color: Colors.purple,
                    fontSize: 20.0,
                    fontStyle: FontStyle.italic
                  ))
                  ..show(Appearance.top);
              }
            ),
            MaterialButton(
              child: Text('Changed border radius'),
              onPressed: () {
                NotificationBanner(context)
                  ..setMessage('Changed border radius')
                  ..setBorderRadius(16.0)
                  ..show(Appearance.top);
              }
            ),
            MaterialButton(
              child: Text('Custom body'),
              onPressed: () {
                NotificationBanner(context)
                  ..setBody(Container(
                      color: Colors.green,
                      child: SizedBox(
                        width: 150,
                        height: 150,
                      ),
                    )
                  )
                  ..show(Appearance.top);
              }
            ),
          ],
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  notification_banner: ^0.1.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:notification_banner/notification_banner.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
58
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
79
Learn more about scoring.

We analyzed this package on Jul 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.15
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

Because:

  • notification_banner that is a package requiring null.

Health suggestions

Format lib/notification_alert.dart.

Run flutter format to format lib/notification_alert.dart.

Format lib/notification_banner.dart.

Run flutter format to format lib/notification_banner.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test