Skip to content

Latest commit

 

History

History
26 lines (20 loc) · 812 Bytes

README.md

File metadata and controls

26 lines (20 loc) · 812 Bytes

Flutter Android System Font

Flutter plugin for getting the Android system font. Fully works on Android 14+ by using latest API, on earlier versions it usually returns the standard font - Roboto. Gets the path of the font file by parsing system files.

Screenshot for proof

Example app on crDroid Android 14

crDroid

Getting Started

static Future<ByteData> readFileBytes(String path) async {
    var bytes = await File(path).readAsBytes();
    return ByteData.view(bytes.buffer);
}

var fontLoader = FontLoader('SystemFont');
fontFilePath = await AndroidSystemFont().getFilePath();
fontLoader.addFont(readFileBytes(fontFilePath));
fontLoader.load();

return MaterialApp(
      theme: ThemeData(
        fontFamily: "SystemFont"
      ), ...