icon_font_generator 4.0.0 copy "icon_font_generator: ^4.0.0" to clipboard
icon_font_generator: ^4.0.0 copied to clipboard

Converts SVG icons to OTF font and generates Flutter-compatible class. Provides an API and a CLI tool.

example/README.md

Usage in flutter app #

Located here: example/flutter_usage/

Generate from cli #

import 'dart:io';

import 'package:icon_font_generator/icon_font_generator.dart';

void main() {
  const fontFileName = 'my_icons.otf';
  const classFileName = 'my_icons.dart';

  // Input data
  final svgMap = {
    'account_icon': '''<svg viewBox="0 0 0 0"></svg>'''
  };

  // Generating font
  final svgToOtfResult = svgToOtf(
    svgMap: svgMap,
    fontName: 'My Icons',
  );

  // Writing font to a file
  writeToFile(fontFileName, svgToOtfResult.font);

  // Generating Flutter class
  final generatedClass = generateFlutterClass(
    glyphList: svgToOtfResult.glyphList,
    familyName: svgToOtfResult.font.familyName,
    className: 'MyIcons',
    fontFileName: fontFileName,
  );

  // Writing class content to a file
  File(classFileName).writeAsStringSync(generatedClass);
}
119
likes
140
points
17.1k
downloads

Publisher

verified publisherserge.software

Weekly Downloads

Converts SVG icons to OTF font and generates Flutter-compatible class. Provides an API and a CLI tool.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

args, collection, dart_style, logger, meta, path, path_parsing, recase, vector_math, xml, yaml

More

Packages that depend on icon_font_generator