buildByMaterial method
build on material mode
Implementation
@override
Widget buildByMaterial(BuildContext context) {
// Build Material-style toolbar
final bgColor = valueOf('backgroundColor', backgroundColor) ??
Theme.of(context).appBarTheme.backgroundColor ??
Theme.of(context).primaryColor;
final tintColor = valueOf('tint', tint) ?? Colors.white;
final toolbarHeight = valueOf('height', height) ?? 56.0;
// Check if this is a search toolbar
final searchConf = valueOf('searchConfig', searchConfig);
if (searchConf != null) {
return _buildMaterialSearchToolbar(context, bgColor, tintColor, toolbarHeight, searchConf);
}
return Container(
height: toolbarHeight,
color: valueOf('transparent', transparent)
? Colors.transparent
: bgColor,
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: Row(
children: [
// Leading actions
if (valueOf('leading', leading) != null) ...[
..._buildMaterialActions(
valueOf('leading', leading)!,
tintColor,
),
const SizedBox(width: 8),
],
// Title or middle actions
if (valueOf('title', title) != null)
Expanded(
child: Text(
valueOf('title', title)!,
style: TextStyle(
color: tintColor,
fontSize: 20,
fontWeight: FontWeight.w500,
),
textAlign: TextAlign.center,
),
)
else if (valueOf('middle', middle) != null)
Expanded(
child: Row(
mainAxisAlignment: _getMainAxisAlignment(
valueOf('middleAlignment', middleAlignment),
),
children: _buildMaterialActions(
valueOf('middle', middle)!,
tintColor,
),
),
)
else
const Spacer(),
// Trailing actions
if (valueOf('trailing', trailing) != null) ...[
const SizedBox(width: 8),
..._buildMaterialActions(
valueOf('trailing', trailing)!,
tintColor,
),
],
],
),
);
}