Dev-hwang / flutter_foreground_task

This plugin is used to implement a foreground service on the Android platform.
https://pub.dev/packages/flutter_foreground_task
MIT License
140 stars 105 forks source link

Dynamically change buttons #230

Closed AhsanSarwar45 closed 1 month ago

AhsanSarwar45 commented 2 months ago

Hi, is it possible to dynamically change the buttons or their text? I am trying to implement a foreground notification for a timer, and I need to change the button label to 'pause' and 'resume' depending on the state.

Dev-hwang commented 1 month ago

@AhsanSarwar45

version 7.1.0

you can change buttons while the service is running.

FlutterForegroundTask.updateService(
  notificationButtons: [
    const NotificationButton(id: 'btn_bye', text: 'bye'),
  ],
);