PatchbayFlutterBridge constructor
PatchbayFlutterBridge({
- required PatchbayGateEvaluator gates,
- PatchbayUiRegistry? registry,
- PatchbaySemanticsActionPolicy? semanticsActionPolicy,
- PatchbayGesturePolicy? gesturePolicy,
- PatchbayPointerEventDispatcher? gesturePointerDispatcher,
- PatchbayGestureDelay? gestureDelay,
- PatchbayRevealPolicy? revealPolicy,
- PatchbayInspectPolicy? inspectPolicy,
- PatchbayInspectorSurface? inspectorSurface,
- PatchbayArtifactService? artifacts,
- Set<
String> captureGates = const <String>{}, - PatchbayKeepAwakeDelegate? keepAwakeDelegate,
- Set<
String> keepAwakeGates = const <String>{}, - PatchbayRootController? rootController,
- PatchbayCaptureEncoder? captureEncoder,
- PatchbayCaptureDecoder? captureDecoder,
- bool isAppResumed()?,
- PatchbayLifecycleStateReader? lifecycleState,
- 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,
);
}