setImage method
Future<void>
setImage({
- TrayIconImageDelegate? delegate,
- Uri? path,
- ByteBuffer? pixels,
- String? asset,
- StockIcon? stockIcon,
- WinIcon? winIcon,
Sets the image on this icon.
If multiple arguments are passed, they are resolved in this order:
delegate
pixels
path
asset
winIcon
If no argument is passed, the image is removed.
For pixels
, you should note that
{@macro betrayal.image.pixels}
For more information on the parameters, check out TrayIconImageDelegate.
Implementation
Future<void> setImage({
TrayIconImageDelegate? delegate,
Uri? path,
ByteBuffer? pixels,
String? asset,
StockIcon? stockIcon,
WinIcon? winIcon,
}) async {
_ensureIsActive();
await _ensureIsReal();
if (delegate != null) {
} else if (pixels != null) {
delegate = TrayIconImageDelegate.fromBytes(pixels);
} else if (asset != null) {
delegate = TrayIconImageDelegate.fromAsset(asset);
} else if (path != null) {
delegate = TrayIconImageDelegate.fromPath(uri: path);
} else if (stockIcon != null) {
delegate = TrayIconImageDelegate.fromStockIcon(stockIcon);
} else if (winIcon != null) {
delegate = TrayIconImageDelegate.fromWinIcon(winIcon);
} else {
delegate = TrayIconImageDelegate.noImage();
}
await delegate.setIcon(_id, _plugin);
}