direction property

SlideDirection get direction

the direction of the sliding if ratio is 0, it will be SlideDirection.idle, indicating not sliding (this panel is closed)

if ratio > 0, it will be SlideDirection.leftToRight or SlideDirection.topToBottom indicating sliding to see the pre actions (this panel is opened and at ActionPosition.pre)

if ratio < 0, it will be SlideDirection.rightToLeft or SlideDirection.bottomToTop indicating sliding to see the post actions (this panel is opened and at ActionPosition.post)

Implementation

SlideDirection get direction {
  assert(layoutSize != null);

  if (ratio == 0) {
    return SlideDirection.idle;
  }

  if (ratio > 0) {
    return switch (layoutSize!.axis) {
      Axis.horizontal => SlideDirection.leftToRight,
      Axis.vertical => SlideDirection.topToBottom,
    };
  } else {
    return switch (layoutSize!.axis) {
      Axis.horizontal => SlideDirection.rightToLeft,
      Axis.vertical => SlideDirection.bottomToTop,
    };
  }
}