Back to Flutter Boost

pushContainer method

doc/api/flutter_boost_app/FlutterBoostAppState/pushContainer.html

5.0.21.4 KB
Original Source

pushContainer method

voidpushContainer(

  1. String pageName,
  2. {String uniqueId,
  3. Map<String, dynamic> arguments}

)

Implementation

void pushContainer(String pageName,
    {String uniqueId, Map<String, dynamic> arguments}) {
  _cancelActivePointers();
  final existed = _findContainerByUniqueId(uniqueId);
  if (existed != null) {
    if (topContainer?.pageInfo?.uniqueId != uniqueId) {
      containers.remove(existed);
      containers.add(existed);

      //move the overlayEntry which matches this existing container to the top
      refreshOnMoveToTop(existed);
    }
  } else {
    final pageInfo = PageInfo(
        pageName: pageName,
        uniqueId: uniqueId ?? _createUniqueId(pageName),
        arguments: arguments,
        withContainer: true);
    final container = _createContainer(pageInfo);
    final previousContainer = topContainer;
    containers.add(container);
    BoostLifecycleBinding.instance
        .containerDidPush(container, previousContainer);

    // Add a new overlay entry with this container
    refreshOnPush(container);
  }
  Logger.log('pushContainer, uniqueId=$uniqueId, existed=$existed,'
      ' arguments:$arguments, $containers');
}