getPaneItemsOffsets method

List<Offset> getPaneItemsOffsets(
  1. GlobalKey<State<StatefulWidget>> paneKey
)

Get the all the item offets in this list

Implementation

List<Offset> getPaneItemsOffsets(GlobalKey<State<StatefulWidget>> paneKey) {
  return map((e) {
    // Gets the item global position
    final itemContext = e.itemKey.currentContext;
    if (itemContext == null) return Offset.zero;
    final box = itemContext.findRenderObject()! as RenderBox;
    final globalPosition = box.localToGlobal(Offset.zero);
    // And then convert it to the local position
    final paneContext = paneKey.currentContext;
    if (paneContext == null) return Offset.zero;
    final paneBox = paneKey.currentContext!.findRenderObject() as RenderBox;
    final position = paneBox.globalToLocal(globalPosition);
    return position;
  }).toList();
}