fbmobile/lib/ui/widgets/my_appbar.dart

31 lines
775 B
Dart
Raw Permalink Normal View History

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 = [];
2023-01-16 00:44:34 +00:00
MyAppBar(
{super.key,
2023-01-16 00:44:34 +00:00
required Widget title,
List<Widget>? actionWidgets,
bool enableAbout = true})
: super(
title: Row(children: <Widget>[title]),
actions: _renderIconButtons(actionWidgets, enableAbout));
2021-02-02 14:33:23 +00:00
2023-01-16 00:44:34 +00:00
static List<Widget> _renderIconButtons(
List<Widget>? actionWidgets, bool aboutEnabled) {
2023-01-04 20:17:54 +00:00
actionWidgets ??= [];
2021-02-02 14:33:23 +00:00
List<Widget> widgets = [...actionWidgets];
if (aboutEnabled) {
widgets.add(AboutIconButton());
}
return widgets;
}
}