Pakete, Repositories und App-Kategorien suchen

Paketdetailsv1.0.1

system_fonts

Ein Flutter-Paket zum Laden von Systemfonts auf Windows-, MacOS- und Linux-Plattformen.

AndroidiOSmacOSWindowsLinux
30-Tage-Downloads
3090
Likes
29
Pub-Punkte
150

Paket installieren

flutter pub add system_fonts

Paketübersicht

Aus öffentlichen Paketdaten erstellte Orientierung.

Das system_fonts-Paket ermöglicht Flutter-Anwendungen den Zugriff auf und die Verwendung von System-Schriftarten unter Windows, macOS und Linux. Es erlaubt Entwicklern, Schriftarten dynamisch zu laden, die bereits auf dem Betriebssystem des Benutzers installiert sind, wodurch eine konsistente Typografie über Plattformen hinweg gewährleistet wird, ohne dass Schriftartdateien eingebunden werden müssen. Dies ist besonders nützlich für Anwendungen, die eine native Textdarstellung benötigen oder plattformspezifische Schriftarten nutzen möchten. Das Paket unterstützt die plattformübergreifende Entwicklung mit minimaler Konfiguration.

Anwendungsfälle

  • Systemfonts auf Desktop-Plattformen laden
  • Apps mit nativer Typografie erstellen
  • Vermeidung der Bündelung von Schriftdateien
  • Verbesserung der Konsistenz der Textrenderung
  • Unterstützung der dynamischen Schriftartauswahl

Hauptmerkmale

  • Plattformübergreifende Unterstützung (Windows, macOS, Linux)
  • Automatische Erkennung von Systemfonts
  • Minimale Einrichtung erforderlich
  • Keine Einbeziehung von Schriftart-Assets erforderlich
  • Integration mit Flutter's TextStyle

Geeignet für

  • Desktop-App-Entwickler
  • Apps, die native Schriftrendering erfordern
  • Projekte, die die Asset-Größe minimieren
  • Entwickler, die mehrere Betriebssysteme ansprechen
  • Anwendungen, die auf Typografiegenauigkeit fokussiert sind

Hinweise

  • Beschränkt auf systeminstallierte Schriften
  • Nicht verfügbar auf Android oder iOS
  • Die Verfügbarmachung der Schriftart hängt vom Host-Betriebssystem ab
  • Funktioniert möglicherweise nicht mit benutzerdefinierten oder nicht standardmäßigen Schriftarten
  • Plattformspezifische Tests erforderlich

Original-README

Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.

system_fonts

A Flutter package that allows users to easily load system fonts on Windows, MacOS, and Linux platforms.

Features

  • Load system fonts dynamically in Flutter applications.
  • Support for Windows, MacOS, and Linux platforms.
  • Supports ttf and otf font formats.
  • Simple API for loading and using system fonts in your Flutter project.

Installation

  1. Add the following line to your pubspec.yaml file in the dependencies section:
dependencies:
    system_fonts: ^VERSION

Usage

Font family names are the font file name in the system without extensions. For example to change font family of Text widget to arial(arial.ttf), use loadFont(String fontName) method with parameter arial, this function will load arial.ttf file in the system and return font family name.

class Example extends StatefulWidget {
  const Example({super.key});

  @override
  State<Example> createState() => _ExampleState();
}

class _ExampleState extends State<Example> {
  String fontFamily = '';

  @override
  void initState() {
    super.initState();
    SystemFonts().loadFont('arial').then((value) {
      setState(() {
        fontFamily = value.toString();
      });
    });
  }

  @override
  Widget build(BuildContext context) {
    return Text('this text will use arial font', style: TextStyle(fontFamily: fontFamily));
  }
}

You can load all the fonts on the system with loadAllFonts() method which returns all the available font family names and then you can use any font in any widget.

You can specify a font folder to load every font inside it and then use them in flutter with addAdditionalFontDirectory(String path) method.

You can add any font from full path with loadFontFromPath(String path) method.

You can list all available font family names to use with getFontList() method.

There is also a widget called SystemFontSelector() for list and select fonts and example app shows how to use it.

License

This package is licensed under the MIT License. See the LICENSE file for details.

Kategorien

Abhängigkeiten

Abhängigkeiten 1 Einträge

Quell-Repository

Projekte, die dieses Paket verwenden