PatchbayFlutterBridge constructor

PatchbayFlutterBridge({
  1. required PatchbayGateEvaluator gates,
  2. PatchbayUiRegistry? registry,
  3. PatchbaySemanticsActionPolicy? semanticsActionPolicy,
  4. PatchbayGesturePolicy? gesturePolicy,
  5. PatchbayPointerEventDispatcher? gesturePointerDispatcher,
  6. PatchbayGestureDelay? gestureDelay,
  7. PatchbayRevealPolicy? revealPolicy,
  8. PatchbayNavigationAdapter? navigationAdapter,
  9. PatchbayInspectPolicy? inspectPolicy,
  10. PatchbayInspectorSurface? inspectorSurface,
  11. PatchbayArtifactService? artifacts,
  12. Set<String> captureGates = const <String>{},
  13. PatchbayKeepAwakeDelegate? keepAwakeDelegate,
  14. Set<String> keepAwakeGates = const <String>{},
  15. PatchbayRootController? rootController,
  16. PatchbayCaptureEncoder? captureEncoder,
  17. PatchbayCaptureDecoder? captureDecoder,
  18. bool isAppResumed()?,
  19. PatchbayLifecycleStateReader? lifecycleState,
  20. String newRequestId()?,
})

Implementation

PatchbayFlutterBridge({
  required PatchbayGateEvaluator gates,
  PatchbayUiRegistry? registry,
  PatchbaySemanticsActionPolicy? semanticsActionPolicy,
  PatchbayGesturePolicy? gesturePolicy,
  PatchbayPointerEventDispatcher? gesturePointerDispatcher,
  PatchbayGestureDelay? gestureDelay,
  PatchbayRevealPolicy? revealPolicy,
  PatchbayNavigationAdapter? navigationAdapter,
  PatchbayInspectPolicy? inspectPolicy,
  PatchbayInspectorSurface? inspectorSurface,
  this.artifacts,
  Set<String> captureGates = const <String>{},
  PatchbayKeepAwakeDelegate? keepAwakeDelegate,
  Set<String> keepAwakeGates = const <String>{},
  PatchbayRootController? rootController,
  PatchbayCaptureEncoder? captureEncoder,
  PatchbayCaptureDecoder? captureDecoder,
  bool Function()? isAppResumed,
  PatchbayLifecycleStateReader? lifecycleState,
  String Function()? newRequestId,
}) : _gates = gates,
     _registry = registry ?? PatchbayUiRegistry.instance,
     _newRequestId = newRequestId ?? _defaultRequestId,
     _isAppResumed = isAppResumed ?? _defaultIsAppResumed,
     _lifecycleState = patchbayLifecycleReaderFor(
       isAppResumed: isAppResumed,
       lifecycleState: lifecycleState,
     ),
     _frames = PatchbayFrameObserver() {
  keepAwake = PatchbayKeepAwakeBridge(
    gates: gates,
    delegate: keepAwakeDelegate,
    gateIds: keepAwakeGates,
    isAppResumed: _isAppResumed,
    lifecycleState: _lifecycleState,
    newRequestId: newRequestId,
  );
  semantics = PatchbaySemanticsBridge(
    gates: gates,
    actionPolicy: semanticsActionPolicy,
    // PB-050-07:owner 恢复帧与 `ui.wait` / reveal / navigation 共用一个计数器,
    // 所以「实际驱动的帧」与 `frameRevision` 报告的帧是同一个集合。
    frames: _frames,
    isAppResumed: _isAppResumed,
    lifecycleState: _lifecycleState,
    newRequestId: newRequestId,
  );
  gesture = PatchbayGestureBridge(
    gates: gates,
    semantics: semantics,
    policy: gesturePolicy,
    pointerDispatcher: gesturePointerDispatcher,
    delay: gestureDelay,
    isAppResumed: _isAppResumed,
    lifecycleState: _lifecycleState,
    newRequestId: newRequestId,
  );
  reveal = PatchbayRevealBridge(
    gates: gates,
    semantics: semantics,
    frames: _frames,
    policy: revealPolicy,
    isAppResumed: _isAppResumed,
    lifecycleState: _lifecycleState,
    newRequestId: newRequestId,
  );
  navigation = navigationAdapter == null
      ? null
      : PatchbayNavigationBridge(
          gates: gates,
          adapter: navigationAdapter,
          frames: _frames,
          isAppResumed: _isAppResumed,
          lifecycleState: _lifecycleState,
          newRequestId: newRequestId,
        );
  wait = PatchbayUiWaitBridge(
    gates: gates,
    semantics: semantics,
    frames: _frames,
    isAppResumed: _isAppResumed,
    lifecycleState: _lifecycleState,
    navigation: navigation,
    newRequestId: newRequestId,
  );
  inspect = inspectPolicy == null
      ? null
      : PatchbayInspectBridge(
          gates: gates,
          policy: inspectPolicy,
          surface: inspectorSurface,
        );
  capture = artifacts == null
      ? null
      : PatchbayCaptureBridge(
          gates: gates,
          registry: _registry,
          frames: _frames,
          artifacts: artifacts!,
          gateIds: captureGates,
          root: rootController,
          isAppResumed: _isAppResumed,
          lifecycleState: _lifecycleState,
          encoder: captureEncoder,
          decoder: captureDecoder,
        );
}