How to create a button on top toolbar in mobile for **Flutter**

Hi PDFTron,
I wanna create a button on top toolbar in mobile. How to make it in ((Flutter))*** ?

i will create button for export annotations ((Flutter))
Thank you!

Hi there,

Unfortunately in order to change the menu options in the toolbar you will have to do implement this using native code.
Please see this guide on how to customise the menu options in the Android toolbar.

Please let us know if this works for you.

Best Regards,

Hi Eamon,
I’ve never used kotlin, I thought I had to do it via methodchanel in flutter, do you have an example code (kotlin) create button on githup?
thank you


We have a Custom UI Sample in Java which you can reference here.

You will need to create a custom menu xml file inside your android projects menu folder.

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android=""
        android:title="YOUR MENU OPTION 1"
        app:showAsAction="never" />
        android:title="YOUR MENU OPTION 2"
        app:showAsAction="always" />

Then add that custom menu to the ViewerBuilder in your project with the usingCustomToolbar API

mPdfViewCtrlTabHostFragment = ViewerBuilder2.withUri("YOUR FILE URI")
                .usingCustomToolbar(new int[]{})

After you have added your custom menu you can add this to handle your menu item clicks.