google / flutter.plugins

BSD 3-Clause "New" or "Revised" License
117 stars 55 forks source link

How to set custom notification UI in Android? #50

Open wellbranding opened 4 years ago

wellbranding commented 4 years ago

Thank you for this stable plugin for audio. However, I can't find any way to set custom UI for audio notification in Android. Is it possible to change the position of media buttons (change margin and alignment) and perhaps the height of notification? If it is not possible, what should I change to make it accessible?

monkeyswarm commented 4 years ago

No, these things are controlled by the Android OS (and differ between Android versions). The plugin code merely provides icons, and specifies a few other behavior flags, such as being expandable (which is not even supported on all Android versions). Your options for customization are described in https://developer.android.com/reference/android/app/Notification.Builder

wellbranding commented 4 years ago

@monkeyswarm I know about this, but it is actually is possible to create fully custom UI. Here is an official reference : https://developer.android.com/training/notify-user/custom-notification#create_a_fully_custom_notification_layout

monkeyswarm commented 4 years ago

Oh, yes, you can supply your own view hierarchy. I have not exposed that much functionality to the Flutter layer, however, and have no immediate plans to do so. So you may wish to fork and try yourself. I'll leave this issue open for reference.