搜尋套件、儲存庫與 APP 分類

套件詳情v0.4.0

fontsource

輕鬆將 Fontsource 字體新增至您的 Flutter 應用程式。包含 Fontsource API 的 Dart 界面。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
59
喜歡數
12
Pub 分數
140

安裝套件

flutter pub add fontsource

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

Fontsource 是一個 Flutter/Dart 套件,可簡化將 Fontsource 字型整合至您的應用程式中的過程。它提供對 Fontsource API 的 Dart 界面,讓開發者能輕鬆地在所有支援的平台中加入高品質的開源字型。該套件簡化了字型載入與管理,確保以最少設定實現一致的排版。支援 Android、iOS、Web、macOS、Windows 與 Linux,非常適合需要可自訂且高效能字型呈現的跨平台應用。

適用情境

  • 向Flutter應用添加自定義開源字體
  • 跨平台字體一致性
  • 優化字型載入效能
  • 透過 Fontsource 集成 Google 字體
  • 網頁和移動應用中的自定義字型

主要特色

  • Dart 界面用於 Fontsource API
  • 支援多個平台
  • 透過 pub add 輕鬆整合
  • 預優化的字體檔案
  • 自動字型族處理
  • 輕量且快速

適合對象

  • 尋求開源字體的Flutter開發者
  • 需要在跨平台保持一致排版的應用程式
  • 優先考慮效能和最小設定的專案
  • 設計師使用自定字型
  • 具有品牌導向字體的網頁和行動應用程式

使用建議

  • 需要互聯網存取以取得初始字型
  • 僅限 Fontsource 主機的字型系列
  • 使用大型字體集可能會增加應用程式封裝大小
  • 不適用於僅離線的應用程式
  • 最佳搭配字型預載入策略使用

原始 README

以下為關聯原始碼儲存庫的 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.

所屬分類

依賴

依賴清單 6 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。