Skip to content

rfw-v1.1.4

@iam-abhijha iam-abhijha tagged this 17 Sep 20:13
Fixes the `fontWeight` property of RFW `TextStyle` (and `StrutStyle`) not being applied in release mode for `Text` widgets.

Fixes flutter/flutter#180223

## Root cause

`ArgumentDecoders.textStyle` (and `strutStyle`) decoded `fontWeight` using `enumValue(FontWeight.values, ...)`, which matched the input string against `FontWeight.value.toString().split('.').last`. `FontWeight` is not a real Dart `enum`; it is a hand-crafted class with `static const` members. In AOT/release builds, `toString()` for such classes is not guaranteed to return the same human-readable name (tree-shaking can strip debug labels), so all matches silently fail and `null` is returned, causing Flutter to fall back to the default weight (`w400`).

## Fix

Added a new `ArgumentDecoders.fontWeight` static method that maps strings (`"w100"`–`"w900"`, `"normal"`, `"bold"`) and integers (`100`–`900`) to the correct `FontWeight` constant using an explicit `switch`, without relying on `toString()`. Updated both `textStyle` and `strutStyle` to use this new decoder.

## Pre-Review Checklist
Assets 2
Loading