getMenuWidget function
Return option menu widget for graph view
Implementation
Widget getMenuWidget(
{Function? onImageDownloadCallback,
Function? onPdfDownloadCallback,
String? fileName,
GlobalKey<SfCartesianChartState>? globalKey}) {
return Align(
alignment: Alignment.topRight,
child: MenuAnchor(
builder:
(BuildContext context, MenuController controller, Widget? child) {
return IconButton(
onPressed: () {
if (controller.isOpen) {
controller.close();
} else {
controller.open();
}
},
icon: const Icon(Icons.more_vert),
tooltip: WidgetBaseLanguage.toolTip,
);
},
menuChildren: List<MenuItemButton>.generate(
choices.length,
(int index) => MenuItemButton(
onPressed: () async {
if (index == 0) {
renderImage(
onDownloadImagePath: onImageDownloadCallback,
globalKey: globalKey,
fileName: fileName);
} else if (index == 1) {
renderPdf(
globalKey: globalKey,
onDownloadPdfPath: onPdfDownloadCallback,
fileName: fileName);
}
},
child: Text(
choices[index],
style: TextStyle(fontFamily: getFontFamily()),
),
),
),
),
);
}