canonical / ubuntu-flutter-plugins

A collection of Flutter plugins and packages for Ubuntu applications.
46 stars 11 forks source link

feat: providing an optional render when an icon fails to resolve entirely #385

Closed mattkae closed 5 months ago

mattkae commented 5 months ago

What's new?

Motivation

We might want to show some sort of nice "Icon not found" icon when it is unavailable on a system for any reason.

Example usage

return XdgIcon(
        name: iconName,
        size: size,
        iconNotFoundBuilder: () {
          return SizedBox(
              width: size.toDouble(),
              height: size.toDouble(),
              child: Center(
                  child: Text(
                      iconName.isEmpty ? "U" : iconName[0].toUpperCase(),
                      style: Theme.of(context).textTheme.displayLarge)));
        });
mattkae commented 5 months ago

Note that the introduction of the new _iconNotFound boolean is to distinguish between the initial "loading" case and the "failure to resolve" case. Perhaps we would be better off with an initialLoading flag instead, but let me know

spydon commented 5 months ago

@mattkae all commits need to be signed before this can be merged.

mattkae commented 5 months ago

Eh hold on, I'll reopen this, since I think I did the wrong force push ;)