buildAppBar method
Implementation
@protected
Widget buildAppBar(BuildParameters params) {
var leading = builder.tryBuildWidget(params.context,
params.widgets["leading"], params.state, params.parentContext);
leading ??= params.buildProp("leadingIcon");
var title = builder.tryBuildWidget(params.context,
params.widgets["titleWidget"], params.state, params.parentContext);
if (title == null && params.props["title"] != null) {
title = Text(properties.getText(params.props["title"], "appBar"));
}
var bottom = builder.tryBuildWidget(params.context,
params.widgets["bottom"], params.state, params.parentContext);
if (bottom is! PreferredSizeWidget) {
bottom = null;
}
final actions = <Widget>[];
if (params.widgets["actions"] != null) {
for (Map actionSpec in params.widgets["actions"] as List<Map>) {
actions.add(builder.buildWidget(
params.context, actionSpec, params.state, params.parentContext));
}
}
final backgroundColor = tryParseColor(params.props["backgroundColor"]);
final systemUiOverlayStyleProp = params.props["systemUiOverlayStyle"];
final systemUiOverlayStyle = systemUiOverlayStyleProp == null
? null
: systemUiOverlayStyleProp == "dark"
? SystemUiOverlayStyle.dark
: SystemUiOverlayStyle.light;
return AppBar(
key: properties.getKey(params.id),
foregroundColor: tryParseColor(params.props["foregroundColor"]),
backgroundColor: backgroundColor,
surfaceTintColor:
tryParseColor(params.props["surfaceTintColor"]) ?? backgroundColor,
shadowColor: tryParseColor(params.props["shadowColor"]),
systemOverlayStyle: systemUiOverlayStyle,
leading: leading,
title: title,
automaticallyImplyLeading: parseBool(
params.props["automaticallyImplyLeading"],
defaultValue: true),
centerTitle: tryParseBool(params.props["centerTitle"]),
elevation: tryParseDouble(params.props["elevation"]),
scrolledUnderElevation:
tryParseDouble(params.props["scrolledUnderElevation"]),
bottom: bottom != null ? bottom as PreferredSizeWidget : null,
bottomOpacity:
parseDouble(params.props["bottomOpacity"], defaultValue: 1),
toolbarHeight: tryParseDouble(params.props["toolbarHeight"]),
toolbarOpacity:
parseDouble(params.props["toolbarOpacity"], defaultValue: 1),
actions: actions,
);
}