pageHeaderActions method
dynamic
pageHeaderActions(
- List<
ActionItemsRF> ? actionItems, { - List<
PopupMenuItemsRF> ? popupMenuItems, - TemplateRF? template,
Implementation
pageHeaderActions(List<ActionItemsRF>? actionItems,
{List<PopupMenuItemsRF>? popupMenuItems, TemplateRF? template}) {
template = TemplateRF.get(template!);
popupMenu(BuildContext context) {
//List<Widget> items = List(); //changed List() to []
List<Widget> items = [];
for (var item in popupMenuItems!) {
items.add(
InkWell(
onTap: () {
item.action!.call();
},
child: ListTile(
leading: IconButton(icon: Icon(item.icon, color: Colors.blue, size: 26), onPressed: () { },),
title: Text(item.label!, style: TextStyle(fontSize: 18)),
),
),
);
}
return items;
}
if (template!.name == TemplateNameRF.modern) {
// List<Widget> widgets = List();
List<Widget> widgets = [];
for (var item in actionItems!) {
if (item.actionType == ActionItemTypeRF.geo) {
widgets.addAll([
IconButton(
icon: Icon(Icons.my_location, color: Colors.black45), onPressed: item.action),
]);
}
if (item.actionType == null) {
widgets.addAll([
IconButton(icon: Icon(item.icon, color: Colors.black45), onPressed: item.action),
]);
}
}
return widgets;
}
if (template.name == TemplateNameRF.material) {
//List<Widget> widgets = List();
List<Widget> widgets = [];
for (var item in actionItems!) {
if (item.actionType == ActionItemTypeRF.geo) {
widgets.addAll([
IconButton(icon: Icon(Icons.my_location, color: Colors.white), onPressed: item.action),
]);
} else if (item.actionType == ActionItemTypeRF.sci) {
widgets.addAll([
IconButton(icon: Icon(Icons.my_location, color: Colors.white), onPressed: item.action),
PopupMenuButton(
itemBuilder: (BuildContext context) {
return [PopupMenuItem(child: Column(children: popupMenu(context)))];
},
)
]);
}
}
return widgets;
}
}