calculateSecondaryPanning method
- Offset offset
Calculates the secondaryPanningOffset based on the provided offset
.
Implementation
void calculateSecondaryPanning(Offset offset) {
Offset position =
(secondaryKey.currentContext?.findRenderObject() as RenderBox?)
?.localToGlobal(Offset.zero) ??
Offset.zero;
if (secondaryAlignment.value == Alignment.centerRight ||
secondaryAlignment.value == Alignment.centerLeft ||
secondaryAlignment.value == null) {
secondaryPanningOffset = Offset(
offset.dx - position.dx,
offset.dy - position.dy,
);
} else if (secondaryAlignment.value == Alignment.bottomCenter ||
secondaryAlignment.value == Alignment.topCenter) {
secondaryPanningOffset = Offset(
secondaryWidth.value / 2,
offset.dy - position.dy,
);
}
}