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

icofont_flutter 封面
插件详情v1.5.0

icofont_flutter

IcoFont 图标包现已作为 Flutter 图标包提供。我们致力于通过数千个免费图标和智能技术,为您提升设计体验,让使用更加流畅。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
368
喜欢数
34
Pub 分数
160

安装插件

flutter pub add icofont_flutter

插件介绍

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

IcoFont Flutter 是一个将数千个免费高质量图标引入 Flutter 应用程序的包。专为无缝集成而设计,它利用智能技术确保跨平台的流畅渲染。该包支持 Android、iOS、Web、macOS、Windows 和 Linux,具有高度的通用性。通过简单的 API 即可轻松访问图标,提升 UI 设计效率。非常适合希望在不增加额外开销的情况下获得丰富图标库的开发者。

适合场景

  • 通过可缩放图标增强应用界面
  • 在用户界面中添加视觉提示
  • 在各个平台上创建一致的图标设计
  • 设计仪表板和导航菜单
  • 构建响应式网页和移动应用

主要特点

  • 成千上万的免费图标
  • 跨平台支持
  • 与 Flutter 的轻松集成
  • 针对性能进行了优化
  • 可缩放矢量图标

适合对象

  • 使用 Flutter 的 UI/UX 设计师
  • 移动和Web应用开发者
  • 需要大量图标库的项目
  • 专注于设计一致性的团队
  • 希望快速实现图标功能的开发者

使用建议

  • 初始设置需要互联网连接(如果未缓存)
  • 超出标准样式的自定义选项有限
  • 依赖外部源进行图标更新
  • 对于图标较少的极简项目来说并不理想
  • 大型项目中未使用图标可能导致潜在的膨胀

原始 README

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

icofont_flutter

pub package CI license: MIT

The IcoFont icon pack as a Flutter icon pack — 2,105 icons exposed as IconData constants, usable anywhere Flutter takes an icon.

No dependencies beyond Flutter itself. The font ships with the package, so there is nothing to declare in your own pubspec.yaml beyond the package.

Installation

flutter pub add icofont_flutter

Or add it to the dependencies: section of your pubspec.yaml:

dependencies:
  icofont_flutter: ^1.5.0

Usage

Every icon is a static const IconData on IcoFontIcons, so it works with any widget that accepts an IconData:

import 'package:flutter/material.dart';
import 'package:icofont_flutter/icofont_flutter.dart';

class MyWidget extends StatelessWidget {
  const MyWidget({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return IconButton(
      icon: const Icon(IcoFontIcons.brandIcofont),
      onPressed: () => debugPrint('Pressed'),
    );
  }
}

Size and color come from the usual Icon properties:

const Icon(IcoFontIcons.rocket, size: 48, color: Colors.indigo)
Finding an icon

Browse the pack at icofont.com/icons. An icon's name there maps to a constant by camel casing it:

IcoFont name Constant
angry-monster IcoFontIcons.angryMonster
brand-icofont IcoFontIcons.brandIcofont
ui-calculator IcoFontIcons.uiCalculator
500px IcoFontIcons.fiveHundredpx

Names that would start with a digit are spelled out, since Dart identifiers cannot. lib/icofont_flutter.dart lists every constant with its IcoFont name in a comment above it.

The 324 duotone icons are not currently available — they are drawn as pairs of stacked glyphs, which the single-IconData API here cannot express.

Requirements

Dart >=2.12.0 <4.0.0, Flutter >=1.17.0. Works on Dart 2 and Dart 3.

Example

See example/ for a small app that renders icons from the pack:

cd example
flutter run

Updating the icons

lib/icofont_flutter.dart is generated from lib/fonts/icofont.ttf — do not edit it by hand. After replacing the font, regenerate:

dart run tool/generate_icons.dart

The generator reads glyph names from the font's post table and code points from its cmap table. It refuses to guess a name it cannot derive, so if it reports a problem, add the icon to nameOverrides in the script rather than editing the output. CI runs dart run tool/generate_icons.dart --check to verify the committed file still matches the font.

Credits

Icons by the IcoFont team, who made this wonderful pack free for everyone. This package only wraps their work for Flutter.

License

MIT — see LICENSE.

所属分类

源码仓库

使用此插件的项目