40 lines
1.1 KiB
Dart
40 lines
1.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
|
|
import '../shared/app_colors.dart';
|
|
import '../widgets/about_iconbutton.dart';
|
|
|
|
class MyAppBar extends AppBar {
|
|
static final List<Widget> aboutEnabledWidgets = [AboutIconButton()];
|
|
static final List<Widget> aboutDisabledWidgets = [];
|
|
|
|
MyAppBar(
|
|
{Key? key,
|
|
required Widget title,
|
|
List<Widget>? actionWidgets,
|
|
bool enableAbout = true})
|
|
: super(
|
|
key: key,
|
|
title: Row(children: <Widget>[title]),
|
|
actions: _renderIconButtons(actionWidgets, enableAbout),
|
|
systemOverlayStyle: SystemUiOverlayStyle(
|
|
systemNavigationBarColor: primaryAccentColor, // Navigation bar
|
|
statusBarColor: primaryAccentColor, // Status bar
|
|
),
|
|
backgroundColor: primaryAccentColor);
|
|
|
|
static List<Widget> _renderIconButtons(
|
|
List<Widget>? actionWidgets, bool aboutEnabled) {
|
|
if (actionWidgets == null) {
|
|
actionWidgets = [];
|
|
}
|
|
|
|
List<Widget> widgets = [...actionWidgets];
|
|
|
|
if (aboutEnabled) {
|
|
widgets.add(AboutIconButton());
|
|
}
|
|
|
|
return widgets;
|
|
}
|
|
}
|