isTopPage method

bool isTopPage(
  1. BuildContext context
)

组件当前页面当前是否栈顶

Implementation

bool isTopPage(BuildContext context) {
  final state = context.findRootAncestorStateOfType<BaseStatePage>();
  if (state != null) return state.isTopPage;
  final stateless =
      context.findAncestorWidgetOfExactType<BaseStatelessPage>();
  if (stateless != null) return stateless.isTopPage;
  return false;
}