serializeIcon function
Implementation
Map<String, dynamic>? serializeIcon(IconPickerIcon icon) {
switch (icon.pack) {
case IconPack.material:
return {
'pack': "material",
'key': icon.name,
};
case IconPack.allMaterial:
return {
'pack': "allMaterial",
'key': icon.name,
};
case IconPack.sharpMaterial:
return {
'pack': "sharpMaterial",
'key': icon.name,
};
case IconPack.roundedMaterial:
return {
'pack': "roundedMaterial",
'key': icon.name,
};
case IconPack.outlinedMaterial:
return {
'pack': "outlinedMaterial",
'key': icon.name,
};
case IconPack.cupertino:
return {
'pack': "cupertino",
'key': icon.name,
};
case IconPack.fontAwesomeIcons:
return {
'pack': "fontAwesomeIcons",
'key': icon.name,
};
case IconPack.lineAwesomeIcons:
return {
'pack': "lineAwesomeIcons",
'key': icon.name,
};
case IconPack.custom:
return {
'key': icon.name,
'pack': "custom",
'iconData': {
'codePoint': icon.data.codePoint,
'fontFamily': icon.data.fontFamily,
'fontPackage': icon.data.fontPackage,
'matchTextDirection': icon.data.matchTextDirection,
}
};
default:
return null;
}
}