cacheMargins method
void
cacheMargins()
Caches the marginLeft and marginTop of avatar.
Call this method again if those margins somehow changed during a drag operation.
Implementation
void cacheMargins() {
// Calculate margins.
if (avatar != null) {
var computedStyles = avatar!.getComputedStyle();
_marginLeft =
num.tryParse(computedStyles.marginLeft.replaceFirst('px', '')) ?? 0;
_marginTop =
num.tryParse(computedStyles.marginTop.replaceFirst('px', '')) ?? 0;
}
}