android_system_font_weight 0.4.0
android_system_font_weight: ^0.4.0 copied to clipboard
同步采集安卓系统字重原始 Map,提供 OPPO、小米、vivo、荣耀的取值参考函数。 调用方可自定义兼容策略;无法确定字重时返回 null,保留原有字体样式。
android_system_font_weight #
Read Android system font-weight data through two synchronous APIs.
import 'package:android_system_font_weight/android_system_font_weight.dart';
getRawData() #
Returns a Map<String, String> containing device information, raw font
settings and probe results. Use it to write your own device-specific logic.
Results are cached; pass refresh: true to collect again.
final data = AndroidSystemFontWeight.getRawData();
final refreshed = AndroidSystemFontWeight.getRawData(refresh: true);
Non-Android platforms or collection failures return an empty map.
getWght() #
Calls getRawData() internally and applies the built-in device policy.
Returns a double? in the wght range 100–1000, or null to keep the
existing font style. No arguments are required.
final weight = AndroidSystemFontWeight.getWght();
The policy handles OPPO, Xiaomi, vivo and Honor families. Huawei, Samsung,
Google and other unsupported devices return null. OPPO has been tested;
other supported families still need device validation.
Apply a non-null result with FontVariation('wght', weight) when the font
used by Flutter supports the wght axis.