Open hakanai opened 1 year ago
Thanks, this API issue is known, and people often stumble on it.
The current way to set icon in singleWindowApplication
exists (described in docs), but it is verbose:
icon = BitmapPainter(useResource("sample.png", ::loadImageBitmap))
We shouldn't remove icon
parameter from singleWindowApplication
or singleWindowApplication
itself. Instead, we should simplify API for loading resources outside of Composable world.
Also, one of the options is to change icon: Painter
to icon: @Composable () -> Painter
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.
In my main function, I tried to add an icon:
This fails to compile:
Fair enough, so I try to make the function
@Composable
:This fails to compile too:
So it seems impossible to call
painterResource
in order to pass the painter in as the icon. Maybe there is an alternative way to get an icon, but I wasn't able to find it and the docs don't even talk about how to get an icon. ThepainterResource
function itself is implemented using internal functions, so there doesn't seem to be anything lower level I can use that isn't composable?As a workaround, avoiding using
singleWindowApplication
works fine:But if the
icon
parameter is going to remain onsingleWindowApplication
, it would be nice if it were possible to use that.