music_control_notification 0.0.1+1 copy "music_control_notification: ^0.0.1+1" to clipboard
music_control_notification: ^0.0.1+1 copied to clipboard

Android通知栏音乐控制

music_control_notification #

Android端通知栏音乐控制

Getting Started #

music_control_notification: ^0.0.1

or

music_control_notification:
    git:
      url: "https://github.com/tianyu704/music_control_notification"
  @override
  void initState() {
    super.initState();
    initMusicNotification();
  }

  // 设置监听
  initMusicNotification() {
    MusicControlNotification.setListener('pause', () {
      print("pause");
    });

    MusicControlNotification.setListener('play', () {
      print("play");
    });

    MusicControlNotification.setListener('next', () {
      print("next");
    });

    MusicControlNotification.setListener('prev', () {
      print("prev");
    });

    MusicControlNotification.setListener('select', () {
      print("select");
    });
    MusicControlNotification.setListener('close', () {
      print("close");
    });
  }
  /// 隐藏通知
  Future<void> _hide() async {
    try {
      await MusicControlNotification.hide();
    } on PlatformException {}
  }
  /// 显示通知
  Future<void> _show(title, bool play) async {
    try {
      await MusicControlNotification.show(title: title, play: play);
    } on PlatformException {}
  }
2
likes
20
pub points
0%
popularity

Publisher

unverified uploader

Android通知栏音乐控制

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on music_control_notification