fromJson method
Implementation
@override
MaterialStateProperty<double?>? fromJson(Map<String, dynamic>? json) {
if (json == null) return null;
return MaterialStateProperty.resolveWith((states) {
if (states.contains(MaterialState.disabled)) {
return (json['disabled'] as num?)?.toDouble();
} else if (states.contains(MaterialState.dragged)) {
return (json['dragged'] as num?)?.toDouble();
} else if (states.contains(MaterialState.error)) {
return (json['error'] as num?)?.toDouble();
} else if (states.contains(MaterialState.focused)) {
return (json['focused'] as num?)?.toDouble();
} else if (states.contains(MaterialState.hovered)) {
return (json['hovered'] as num?)?.toDouble();
} else if (states.contains(MaterialState.pressed)) {
return (json['pressed'] as num?)?.toDouble();
} else if (states.contains(MaterialState.selected)) {
return (json['selected'] as num?)?.toDouble();
} else {
return (json['empty'] as num?)?.toDouble();
}
});
}