parseCssCurve function
Parses a CSS easing function to a Flutter Curve.
Handles cubic-bezier(a, b, c, d), linear, and the four ease*
keywords. Returns null for steps() and anything unrecognised — no Astryx
token uses them.
Implementation
Curve? parseCssCurve(String value) {
final trimmed = value.trim().toLowerCase();
if (trimmed == 'linear') return Curves.linear;
final keyword = _easingKeywords[trimmed];
if (keyword != null) return keyword;
if (!trimmed.startsWith('cubic-bezier(') || !trimmed.endsWith(')')) {
return null;
}
final body = trimmed.substring('cubic-bezier('.length, trimmed.length - 1);
final parts = splitTopLevelCommas(body);
if (parts.length != 4) return null;
final values = parts.map((p) => double.tryParse(p.trim())).toList();
if (values.any((v) => v == null)) return null;
return Cubic(values[0]!, values[1]!, values[2]!, values[3]!);
}