import 'package:flutter/material.dart'; import '../widgets/about_iconbutton.dart'; class MyAppBar extends AppBar { static final List aboutEnabledWidgets = [AboutIconButton()]; static final List aboutDisabledWidgets = []; MyAppBar( {Key? key, required Widget title, List? actionWidgets, bool enableAbout = true}) : super( key: key, title: Row(children: [title]), actions: _renderIconButtons(actionWidgets, enableAbout)); static List _renderIconButtons( List? actionWidgets, bool aboutEnabled) { actionWidgets ??= []; List widgets = [...actionWidgets]; if (aboutEnabled) { widgets.add(AboutIconButton()); } return widgets; } }