encodeAlignment static method
Encodes the given value
to an String representation of the Alignment.
Supported values are:
bottomCenter
bottomLeft
bottomRight
center
centerLeft
centerRight
topCenter
topLeft
topRight
All other values, including null
, will result in null
.
Implementation
static String? encodeAlignment(Alignment? value) {
String? result;
if (value != null) {
if (value.x == Alignment.bottomCenter.x &&
value.y == Alignment.bottomCenter.y) {
result = 'bottomCenter';
}
if (value.x == Alignment.bottomLeft.x &&
value.y == Alignment.bottomLeft.y) {
result = 'bottomLeft';
}
if (value.x == Alignment.bottomRight.x &&
value.y == Alignment.bottomRight.y) {
result = 'bottomRight';
}
if (value.x == Alignment.center.x && value.y == Alignment.center.y) {
result = 'center';
}
if (value.x == Alignment.centerLeft.x &&
value.y == Alignment.centerLeft.y) {
result = 'centerLeft';
}
if (value.x == Alignment.centerRight.x &&
value.y == Alignment.centerRight.y) {
result = 'centerRight';
}
if (value.x == Alignment.topCenter.x &&
value.y == Alignment.topCenter.y) {
result = 'topCenter';
}
if (value.x == Alignment.topLeft.x && value.y == Alignment.topLeft.y) {
result = 'topLeft';
}
if (value.x == Alignment.topRight.x && value.y == Alignment.topRight.y) {
result = 'topRight';
}
}
return result;
}