MenuBar constructor Null safety

const MenuBar(
  1. {Key? key,
  2. required Widget child,
  3. required List<BarButton> barButtons,
  4. BarStyle barStyle = const BarStyle(),
  5. BarButtonStyle barButtonStyle = const BarButtonStyle(),
  6. MenuStyle menuStyle = const MenuStyle(),
  7. MenuButtonStyle menuButtonStyle = const MenuButtonStyle(),
  8. bool enabled = true}
)

Hover over each field for more details.

Create the MenuBar:

The following 2 fields are necessary: child and barButtons.

The MenuBar is wrapped around a child, i.e. your application under the MenuBar. For the barButtons field, implement a List of BarButton. The buttons in this List are displayed as the buttons on the bar.

Style the MenuBar:

The bar itself: Implement your custom barStyle.

Bar buttons: Implement your custom barButtonStyle.

The menu and submenu itself: Implement your custom menuStyle.

Menu and submenu buttons: Implement your custom menuButtonStyle.

Implementation

const MenuBar({
  super.key,
  required this.child,
  required this.barButtons,
  this.barStyle = const BarStyle(),
  this.barButtonStyle = const BarButtonStyle(),
  this.menuStyle = const MenuStyle(),
  this.menuButtonStyle = const MenuButtonStyle(),
  this.enabled = true,
});