Skip to content

Support for loading platform-specific icons #7299

@HansMuller

Description

@HansMuller

Per #7297 (review)

Currently, if you want the platform-specific version of the back icon, you need to write something like this:

  IconData _backIcon() {
    switch (Theme.of(context).platform) {
      case TargetPlatform.android:
      case TargetPlatform.fuchsia:
        return Icons.arrow_back;
      case TargetPlatform.iOS:
        return Icons.arrow_back_ios;
    }
    assert(false);
    return null;
  }

Perhaps we should add a utility function to Icons, like Icons.for(TargetPlatform), so you'd write this instead:

Icons.for(Theme.of(context).platform).arrow_back

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: new featureNothing broken; request for a new capabilityf: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.platform-androidAndroid applications specificallyplatform-iosiOS applications specifically

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions