Giter VIP home page Giter VIP logo

flutter_media_notification's Introduction

media_notification

Media notification for flutter, on android (IOs Not implemented)

This plugin is used in the music player app TuneIn.

please star this repository or TuneIn, i am open to comments and possible features.

Usage

Main functions

You can call the show method to show the media controls like follow :

Show Function

    ByteData dibd = await rootBundle.load("images/image.png");
    List<int> defaultImageBytes = dibd.buffer.asUint8List();

try {
      await MediaNotification.show(
        title: title, // the title of the track
        author: author, // a subtitle usually the artist
        image:"/storage/emulated/0/Pictures/Reddit/c4c7164.jpg", // an image, Must be a URI
        BitmapImage: defaultImageBytes, // an image in bytes form, can get over any permission problems 
        bgColor: Colors.deepPurple, // the background Color of the notification panel
        iconColor: Colors.blue, // The control icons colors
        subtitleColor: Colors.deepOrange, // The subtitle color
        titleColor: Colors.orange // the title color
      );
    } on PlatformException {

    }

Hide Function

You can call the hide method to hide the Media controls like follow :

MediaNotification.hide();

Extra functions and listeners

You can use the next functions and listeners n order to further polish the experience of using the plugin

Extra Functions

MediaNotification.setTo(false); must take a boolean argument, will set the play/pause button icon accordingly : 1- True means currently playing, will set the icon to Pause icon 2- False means currently on pause or stop ( no distinction between the two ), will set the icon to Play icon

MediaNotification.togglePlayPause(); takes no arguments, will automatically toggle the play/pause button icon

MediaNotification.setSubtitle(SubtitleString); must take a String argument will change the subtitle on the notification to the given string

MediaNotification.setTitle(TitleString); must take a String argument will change the title on the notification to the given string

Extra Listeners

The following listeners can be used to listen on the different control buttons when tapped

MediaNotification.setListener('play', () {
      print("playing shoud slart playin"); // will be triggered when the Play arrow button is tapped
    });

    MediaNotification.setListener('pause', () {
      print("playback should pause"); // will be triggered when the Pause Bars button is tapped
    });

    MediaNotification.setListener('next', () {
      print("playback should go to next track"); // will be triggered when the next button is tapped
    });

    MediaNotification.setListener('prev', () {
       print("playback should go to previous track"); // will be triggered when the previous button is tapped
    });

    MediaNotification.setListener('select', () {
      print("selected Notification"); // will be triggered when the notification is selected (tapped) from the notification area
    });

Screenshots

Notification Area Lock Screen Lock Screen

Getting Started With the development

For help getting started with Flutter, view our online documentation.

For help on editing plugin code, view the documentation.

Support me

You can support me by:

⭐️ this repo if you like it.

Buy me a cup of coffee ☕️:

NOT there yet

Contact me

email: [email protected]

Thank you in advance 👍

flutter_media_notification's People

Contributors

juliocbcotta avatar moda20 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.