notification_banner 0.0.3 copy "notification_banner: ^0.0.3" to clipboard
notification_banner: ^0.0.3 copied to clipboard

outdated

The package provides simple and customizable way to show notification banner.

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('Custom'),
              onPressed: () {
                NotificationBanner(context)
                  ..setBody(Container(
                      color: Colors.green,
                      child: SizedBox(
                        width: 150,
                        height: 150,
                      ),
                    )
                  )
                  ..show(Appearance.top);
              }
            ),
          ],
        ),
      ),
    );
  }
}
5
likes
30
points
26
downloads

Publisher

unverified uploader

Weekly Downloads

The package provides simple and customizable way to show notification banner.

Homepage

License

unknown (license)

Dependencies

flutter

More

Packages that depend on notification_banner