tooltip method

List<Figure> tooltip(
  1. Offset anchor,
  2. List<Tuple> selectedTuples
)

Implementation

List<Figure> tooltip(Offset anchor, List<Tuple> selectedTuples) {
  String textContent = '';
  if (selectedTuples.length == 1) {
    final original = selectedTuples.single;
    if (original['price'] > 0) {
      textContent = 'Ngày: ' + Util.strDateToString(original['created_at'], pattern: 'dd/MM/yyyy HH:mm') + '\n';
      textContent += 'SP: ' + original['title'] + '\n';
      textContent += 'Giá: ' + Util.doubleToString(original['price']) + ' đ';
    } else {
      return [];
    }
  }

  return _renderFigure(anchor, textContent);
}