Search code examples
flutterwidgetandroid-banner

Is it possible to use Material Banner Widget without Actions?


I'm trying to use the material banner widget but a list of actions is required. The list of actions is causing the banner to look weird even when I place an empty container inside of the list.

Should I not be using the material banner widget since it requires a list when my design doesn't need a list of actions available? I want to use the widget since I can use these methods easily.

ScaffoldMessenger.of(context).showMaterialBanner & ScaffoldMessenger.of(context).clearMaterialBanners();

If I shouldn't be using the widget, does anyone else have a good replacement for it? Thank You.

Edit: I've added an image for reference. https://i.sstatic.net/Cw3hR.jpg I want to get rid of the red area on the right side of the banner. I've tried setting the material banner's padding to padding: EdgeInsets.zero


Solution

  • I think I found a way but it's dirty: open the MaterialBanner widget and change everything you don't like in the code.

    Below are the changes I made. After that, I'm passing any List of widgets as actions to the MaterialBanner, which is simply ignored.

    Changes to MaterialBanner