2021-02-02 14:33:23 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
import '../widgets/about_iconbutton.dart';
|
|
|
|
|
|
|
|
class MyAppBar extends AppBar {
|
|
|
|
static final List<Widget> aboutEnabledWidgets = [AboutIconButton()];
|
|
|
|
static final List<Widget> aboutDisabledWidgets = [];
|
|
|
|
|
2022-06-22 22:42:37 +00:00
|
|
|
MyAppBar({Key? key, required Widget title, List<Widget>? actionWidgets, bool enableAbout = true})
|
2022-12-16 13:40:55 +00:00
|
|
|
: super(key: key, title: Row(children: <Widget>[title]), actions: _renderIconButtons(actionWidgets, enableAbout));
|
2021-02-02 14:33:23 +00:00
|
|
|
|
2022-06-22 22:42:37 +00:00
|
|
|
static List<Widget> _renderIconButtons(List<Widget>? actionWidgets, bool aboutEnabled) {
|
2021-02-02 14:33:23 +00:00
|
|
|
if (actionWidgets == null) {
|
|
|
|
actionWidgets = [];
|
|
|
|
}
|
|
|
|
|
|
|
|
List<Widget> widgets = [...actionWidgets];
|
|
|
|
|
|
|
|
if (aboutEnabled) {
|
|
|
|
widgets.add(AboutIconButton());
|
|
|
|
}
|
|
|
|
|
|
|
|
return widgets;
|
|
|
|
}
|
|
|
|
}
|