marginTop property

double get marginTop

获取当前view距离顶部的高度

Implementation

double get marginTop {
  final RenderBox? renderBox = currentContext?.findRenderObject() as RenderBox?;
  final Offset? offset = renderBox?.localToGlobal(Offset(0.0, renderBox.hasSize ? renderBox.size.height : 0.0));
  return offset?.dy ?? 0.0;
}