resolveFlex static method
Resolves flex value from FlyStyle
Implementation
static int? resolveFlex(BuildContext context, FlyStyle style) {
if (style.flex == null) return null;
// Handle string values
if (style.flex is String) {
switch (style.flex) {
case 'auto':
return 1; // Flexible(flex: 1, fit: FlexFit.loose)
case 'initial':
return 0; // Flexible(flex: 0, fit: FlexFit.loose)
case 'none':
return null; // No flex wrapper (fixed size)
default:
// Try to parse as number
final parsed = int.tryParse(style.flex);
return parsed;
}
}
// Handle numeric values
if (style.flex is int) {
return style.flex;
}
return null;
}