calculateSizePosition method
bool
calculateSizePosition(
{ - required int listIndex,
- required int itemIndex,
})
Implementation
bool calculateSizePosition({
required int listIndex,
required int itemIndex,
}) {
var prov = ref.read(ProviderList.boardProvider);
var item = prov.board.lists[listIndex].items[itemIndex];
var list = prov.board.lists[listIndex];
if (item.context == null ||
list.context == null ||
!item.context!.mounted) {
return true;
}
var box = item.context!.findRenderObject();
var listBox = list.context!.findRenderObject();
if (box == null || listBox == null) return true;
box = box as RenderBox;
listBox = listBox as RenderBox;
var location = box.localToGlobal(Offset.zero);
item.x = location.dx - prov.board.displacementX!;
item.y = location.dy - prov.board.displacementY!;
item.actualSize ??= box.size;
// log("EXECUTED");
item.width = box.size.width;
item.height = box.size.height;
list.x = listBox.localToGlobal(Offset.zero).dx - prov.board.displacementX!;
list.y = listBox.localToGlobal(Offset.zero).dy - prov.board.displacementY!;
return false;
}