搜索插件、代码仓与 APP 分类

插件详情v2.0.0

flutter_sficon

SF Symbols 27 作为可摇动的矢量图标,在所有平台上提供所有字重。不捆绑字体,因此 iOS 构建可通过 Apple 的字体检查。

AndroidiOSLinuxmacOSWebWindows
近 30 天下载
4.1万
喜欢数
12
Pub 分数
160

安装插件

flutter pub add flutter_sficon

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

flutter_sficon 提供基于 SF Symbols 27 的可摇动矢量图标,支持所有平台的完整字重。与传统图标字体不同,它使用原生矢量渲染,无需捆绑字体文件,确保 iOS 构建通过 Apple 的字体验证。专为无缝集成设计,提供清晰、可缩放的图标,开销极小且无需额外字体文件。非常适合寻求简洁、原生平台图标解决方案并兼顾尺寸和性能限制的开发者。

适合场景

  • 原生 iOS 应用设计
  • 跨平台图标一致性
  • 对性能敏感的应用程序
  • 需要符合 Apple App Store 要求的应用程序
  • 极简界面搭配可缩放图形

主要特点

  • 可摇树图标
  • 无内置字体文件
  • 完整的 SF 符号 27 覆盖
  • 支持所有字重
  • 原生矢量渲染
  • 平台无关的兼容性

适合对象

  • 针对 iOS 的 Flutter 开发人员
  • 需要轻量级图标解决方案的项目
  • 旨在通过苹果字体检查审核的应用程序
  • 重视构建大小和性能的团队
  • 希望实现一致系统图标样式的设计师

使用建议

  • 仅限 SF 符号 27 功能
  • 为获得最佳使用体验,需要 Flutter 3.0+
  • 可能需要手动更新以支持新的 SF 符号发布
  • 不适用于非 SF 符号图标集
  • 依赖上游 SF Symbols 的可用性

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Flutter SFIcon

Render SF Symbols on every platform, similar to the regular Icon widget. Supports all nine weights and SF Symbols 27. Icons are tree shakable: an app only ships the symbols it uses.

Symbols are drawn as vector paths, so no font is bundled with the app. Apps that bundle an Apple font get the ITMS-91182 "Disallowed font" warning from App Store Connect (see Apple's TN3214), and from October 1, 2027 such builds are rejected. Versions 1.x bundled one; 2.0 doesn't.

Install

flutter pub add flutter_sficon

How to use

All icons are static constants of the SFIcons class, so unused ones are tree-shaken away. Naming convention for retrieving SF symbol is as follows:

  1. SF Symbol name is prefixed with 'sf_'.
  2. Dots are replaced with underscores.

Examples:

  • SF Symbol 0.circle is named as sf_0_circle
  • SF Symbol heart.fill is named as sf_heart_fill
import 'package:flutter_sficon/flutter_sficon.dart';

// use SFIcon instead of regular Icon widget
const SFIcon(
    SFIcons.sf_heart_fill, // 'heart.fill'
    fontSize: 40, // fontSize instead of size
    fontWeight: FontWeight.bold, // fontWeight instead of weight
    color: Colors.red,
);

SFIcon lays out like text of the same fontSize: same width, height and baseline, so it lines up with text in a Row aligned by baseline, and it follows the platform text size.

It colours like an icon: color, then IconTheme color and opacity. ShaderMask and shadows work too. Symbols are monochrome; hierarchical, palette and multicolour rendering modes aren't supported.

Every weight from w100 to w900 is drawn from Apple's own weight masters, the same way the font interpolates them.

Migrating from 1.x

The API is the same, so most code needs no changes. Things to check:

  • Use SFIcon, not Icon. SFIcons constants carry vector data instead of a font, so Flutter's Icon widget can't draw them. Replace Icon(SFIcons.sf_x) with SFIcon(SFIcons.sf_x).
  • Renamed symbols. Names Apple renamed or removed still compile but are deprecated; the warning names the replacement when there is one.
  • Real weights. 1.x bundled only the Regular weight, so lighter weights looked Regular and heavier ones were synthetic bold. 2.0 draws Apple's real weights, so w100 to w300 look lighter than before and w600 to w900 look a bit different.
  • Newer artwork. Symbols come from SF Pro 22.0, so some look slightly different from 1.x.
  • New symbols. 172 symbols introduced in SF Symbols 27 aren't included yet, because Apple hasn't shipped their outlines in SF Pro.

Size

An app pays only for the symbols it uses: about 0.6 KB of path data per symbol on average. The package itself has no assets.

Updating the symbols

For maintainers. tool/symbols.tsv lists every name and code point. tool/update_symbols.py updates it from lists copied out of the SF Symbols app, and tool/generate.py regenerates lib/src/sf_icons.g.dart from Apple's variable SF-Pro.ttf. Both scripts describe their usage at the top.

IMPORTANT

All SF Symbols shall be considered to be system-provided images as defined in the Xcode and Apple SDKs license agreements and are subject to the terms and conditions set forth therein. You may not use SF Symbols or glyphs that are substantially or confusingly similar in your app icons, logos, or any other trademark-related use. Apple reserves the right to review and, in its sole discretion, require modification or discontinuance of use of any Symbol used in violation of the foregoing restrictions, and you agree to promptly comply with any such request.

Notes

This package is inspired by https://github.com/virskor/flutter_sfsymbols. Also thanks for the legal note used here.

所属分类

源码仓库

使用此插件的项目

暂无相关数据。

所在榜单