2021-02-02 14:33:23 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
2021-04-04 08:44:31 +00:00
|
|
|
import '../shared/app_colors.dart';
|
2021-02-02 14:33:23 +00:00
|
|
|
import '../widgets/about_iconbutton.dart';
|
|
|
|
|
|
|
|
class MyAppBar extends AppBar {
|
|
|
|
static final List<Widget> aboutEnabledWidgets = [AboutIconButton()];
|
|
|
|
static final List<Widget> aboutDisabledWidgets = [];
|
|
|
|
|
|
|
|
MyAppBar({Key key, Widget title, List<Widget> actionWidgets, bool enableAbout = true})
|
2021-04-04 08:44:31 +00:00
|
|
|
: super(
|
|
|
|
key: key,
|
|
|
|
title: Row(children: <Widget>[title]),
|
|
|
|
actions: _renderIconButtons(actionWidgets, enableAbout),
|
2021-05-08 08:51:58 +00:00
|
|
|
brightness: appBarBrightness,
|
2021-04-04 08:44:31 +00:00
|
|
|
backgroundColor: primaryAccentColor);
|
2021-02-02 14:33:23 +00:00
|
|
|
|
|
|
|
static List<Widget> _renderIconButtons(List<Widget> actionWidgets, bool aboutEnabled) {
|
|
|
|
if (actionWidgets == null) {
|
|
|
|
actionWidgets = [];
|
|
|
|
}
|
|
|
|
|
|
|
|
List<Widget> widgets = [...actionWidgets];
|
|
|
|
|
|
|
|
if (aboutEnabled) {
|
|
|
|
widgets.add(AboutIconButton());
|
|
|
|
}
|
|
|
|
|
|
|
|
return widgets;
|
|
|
|
}
|
|
|
|
}
|