buildExposureDetector method
The GestureDetector widget for setting exposure point manually. 用于手动设置曝光点的 GestureDetector
Implementation
Widget buildExposureDetector(
BuildContext context,
BoxConstraints constraints,
) {
void focus(TapUpDetails d) {
// Only call exposure point updates when the controller is initialized.
if (innerController?.value.isInitialized ?? false) {
Feedback.forTap(context);
setExposureAndFocusPoint(d.localPosition, constraints);
}
}
return Positioned.fill(
child: Semantics(
label: textDelegate.sCameraPreviewLabel(
innerController?.description.lensDirection,
),
image: true,
onTap: () {
// Focus on the center point when using semantics tap.
final Size size = MediaQuery.of(context).size;
final TapUpDetails details = TapUpDetails(
kind: PointerDeviceKind.touch,
globalPosition: Offset(size.width / 2, size.height / 2),
);
focus(details);
},
onTapHint: textDelegate.sActionManuallyFocusHint,
sortKey: const OrdinalSortKey(1),
hidden: innerController == null,
excludeSemantics: true,
child: GestureDetector(
onTapUp: focus,
behavior: HitTestBehavior.translucent,
child: const SizedBox.expand(),
),
),
);
}