setDropdownPosition method
Offset
setDropdownPosition(
{ - required bool isTop,
- required double sidePadding,
- required dynamic inputBox,
- required Offset inputPosition,
- required double actualBoxHeight,
})
Implementation
Offset setDropdownPosition(
{required bool isTop,
required double sidePadding,
required dynamic inputBox,
required Offset inputPosition,
required double actualBoxHeight}) {
double value = 0;
switch (widget.dropdownAlign.toLowerCase()) {
case 'left':
value = 0;
break;
case 'right':
value = inputBox.size.width -
(widget.dropdownWidth! + sidePadding) -
widget.triangleBorder.width * 2;
break;
case 'center':
value = (inputBox.size.width - (widget.dropdownWidth! + sidePadding)) *
0.5 -
widget.triangleBorder.width;
break;
default:
throw 'type of dropdownAlign has to be String.(right, left, center)';
}
return Offset(
inputPosition.dx + value,
isTop
? inputPosition.dy + inputBox.size.height + widget.gap
: inputPosition.dy - (widget.gap + actualBoxHeight));
}