setTrianglePosition method
Offset
setTrianglePosition(
{ - required Offset dropdownOffset,
- required double sidePadding,
})
Implementation
Offset setTrianglePosition(
{required Offset dropdownOffset, required double sidePadding}) {
double value = 0;
switch (widget.triangleAlign.toLowerCase()) {
case 'left':
value = widget.triangleBorder.width;
break;
case 'right':
value = (widget.dropdownWidth + sidePadding) -
widget.triangleWidth -
widget.triangleBorder.width;
break;
case 'center':
value =
(widget.dropdownWidth + sidePadding - widget.triangleWidth) * 0.5 +
widget.triangleBorder.width;
break;
default:
throw 'type of triangleAlign has to be String.(right, left, center)';
}
return Offset(dropdownOffset.dx + value, dropdownOffset.dy);
}