show method
void
show()
Show the tooltip.
Implementation
void show() {
if (!hasContent || !_enabled)
return;
final e = QueryEvent('show.bs.$_type');
$element.triggerEvent(e);
if (e.defaultPrevented)
return;
_setContent();
if (animation)
tip.classes.add('fade');
final placement = _placement(element) ?? _placementDefault;
tip.remove();
tip.style.top = tip.style.left = '0';
tip.style.display = 'block';
tip.classes.add(placement);
if (container != null)
$(tip).appendTo(container);
else
$element.after(tip);
final pos = _position,
actualWidth = tip.offsetWidth,
actualHeight = tip.offsetHeight;
int? top, left;
switch (placement) {
case 'bottom':
top = pos.bottom.round();
left = (pos.left + (pos.width - actualWidth) / 2).round();
break;
case 'top':
top = pos.top.round() - actualHeight;
left = (pos.left + (pos.width - actualWidth) / 2).round();
break;
case 'left':
top = (pos.top + (pos.height - actualHeight) / 2).round();
left = pos.left.round() - actualWidth;
break;
case 'right':
top = (pos.top + (pos.height - actualHeight) / 2).round();
left = pos.right.round();
break;
}
_applyPlacement(top!, left!, placement);
$element.trigger('shown.bs.$_type');
}