android_system_font_weight 0.3.2 copy "android_system_font_weight: ^0.3.2" to clipboard
android_system_font_weight: ^0.3.2 copied to clipboard

启动期一次性读取安卓厂商(HyperOS/MIUI、ColorOS、OriginOS、MagicOS 等)的 系统全局可变字重设置,归一化为 wght 轴值。无监听、无刷新,读不到返回 null。

android_system_font_weight #

Read the system-wide variable font weight configured on Chinese Android OEM ROMs (HyperOS / ColorOS / OriginOS / MagicOS). These ROMs let users adjust a global font weight slider, but the setting only applies to native apps — Flutter's text stack never sees it. This plugin reads the weight actually applied by the OS and returns it as a wght axis value, so your Flutter text can match native rendering.

All APIs are synchronous (direct JNI call, built for Flutter's merged platform/UI thread). Read once at startup.

Usage #

import 'package:android_system_font_weight/android_system_font_weight.dart';

// double?, e.g. 550. null = no system setting, use the font's default.
final wght = AndroidSystemFontWeight.getWght();

Text(
  'Hello world',
  style: TextStyle(
    fontVariations: [if (wght != null) FontVariation('wght', wght)],
  ),
);

To apply globally, merge it into your app-level DefaultTextStyle / theme. A variable system font with a wght axis is required for any visual effect (MiSans VF, OPPO Sans VF, HarmonyOS Sans VF — recent Chinese OEM system fonts all qualify).

Other APIs #

  • AndroidSystemFontWeight.getAll() — raw probed key/values (device info, ink-coverage probe result, vendor settings keys, system font axes). Useful for debugging the detection on new devices.
  • AndroidSystemFontWeight.getVendor() — OEM detection (AndroidFontVendor.oppo / xiaomi / vivo / ...).
0
likes
0
points
141
downloads

Publisher

unverified uploader

Weekly Downloads

启动期一次性读取安卓厂商(HyperOS/MIUI、ColorOS、OriginOS、MagicOS 等)的 系统全局可变字重设置,归一化为 wght 轴值。无监听、无刷新,读不到返回 null。

License

unknown (license)

Dependencies

flutter, jni

More

Packages that depend on android_system_font_weight

Packages that implement android_system_font_weight