FLUTTER ECOSYSTEM

fontsource/fontsource-flutter

Flutter 앱에 Fontsource 글꼴을 쉽게 추가하세요. Fontsource API용 Dart 인터페이스도 포함되어 있습니다.

fontsource-flutter 프로젝트 이미지
Stars
8
Forks
1
최근 푸시(UTC)
2022. 11. 2.
프로젝트 상태
활성
fontsource GitHub avatar
GITHUB Organization

fontsource ↗

Self-host Open Source fonts in neatly bundled NPM packages.

언어Dart

기술 주제

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 9 개

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

README 펼치기 / 접기

Fontsource for Flutter

Easily add Fontsource fonts to your flutter app. Includes a dart interface for the Fontsource API.

Getting started

To start, create a config in either your pubspec.yaml file under the fontsource key or in the fontsource.yaml file.

include: [my-package] # Defaults to all
fonts:
  alex-brush: # This can be any font id
    version: 4.5.3 # Defaults to latest
    subsets: [latin, latin-ext] # Defaults to all
    weights: [400] # Defaults to all
    styles: [normal] # Defaults to all

The config will tell fontsource what to download and bundle into your flutter app. To ensure everything is downloaded, execute dart run fontsource after your config is modified. Also, make sure to run it whenever your repository is cloned. This will generate a local package in the .fontsource directory.

You can then import the fontsource package:

import 'package:fontsource/fontsource.dart';

Use the FontsourceTextStyle class to use a Fontsource font:

const Text(
  'Hello world!',
  style: FontsourceTextStyle(fontFamily: 'Alex Brush', fontSize: 30),
),

FontsourceTextStyle extends the TextStyle class, so any styling properties can be used to change the way the text looks.

Use With Packages

To use this in a package, add a configuration like normal, but don't run the fontsource cli.

Packages with a fontsource configuration will automatically be included. To manually specify what packages should be scanned, provide an include key with a list of package names to scan.

Fontsource API

The Fontsource API also has a dart interface that can be accessed through fontsource/api.dart.