alignment static method
Decodes an AlignmentDirectional or Alignment object out of the specified map.
If the map has start and y keys, then it is interpreted as an
AlignmentDirectional with those values. Otherwise if it has x and y
it's an Alignment with those values. Otherwise it returns null.
Implementation
static Map<String, double>? alignment(AlignmentGeometry? alignment) {
if (alignment == null) {
return null;
}
if (alignment is Alignment) {
return {
'x': alignment.x,
'y': alignment.y,
};
} else if (alignment is AlignmentDirectional) {
return {
'start': alignment.start,
'y': alignment.y,
};
}
return {};
}