hide CameraHistogram & CameraSpotDetector if purchasable

This commit is contained in:
Vadim 2023-11-08 15:09:33 +01:00
parent 17cd99e8a9
commit 1bd0fe577e

View file

@ -9,6 +9,7 @@ import 'package:lightmeter/screens/metering/components/camera_container/componen
import 'package:lightmeter/screens/metering/components/camera_container/components/camera_preview/components/camera_view_placeholder/widget_placeholder_camera_view.dart'; import 'package:lightmeter/screens/metering/components/camera_container/components/camera_preview/components/camera_view_placeholder/widget_placeholder_camera_view.dart';
import 'package:lightmeter/screens/metering/components/camera_container/components/camera_preview/components/histogram/widget_histogram.dart'; import 'package:lightmeter/screens/metering/components/camera_container/components/camera_preview/components/histogram/widget_histogram.dart';
import 'package:lightmeter/screens/metering/components/camera_container/models/camera_error_type.dart'; import 'package:lightmeter/screens/metering/components/camera_container/models/camera_error_type.dart';
import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart';
class CameraPreview extends StatefulWidget { class CameraPreview extends StatefulWidget {
final CameraController? controller; final CameraController? controller;
@ -92,21 +93,23 @@ class _CameraPreviewBuilderState extends State<_CameraPreviewBuilder> {
alignment: Alignment.bottomCenter, alignment: Alignment.bottomCenter,
children: [ children: [
CameraView(controller: widget.controller), CameraView(controller: widget.controller),
if (UserPreferencesProvider.cameraFeatureOf( if (IAPProducts.isPurchased(context, IAPProductType.paidFeatures)) ...[
context, if (UserPreferencesProvider.cameraFeatureOf(
CameraFeature.histogram, context,
)) CameraFeature.histogram,
Positioned( ))
left: Dimens.grid8, Positioned(
right: Dimens.grid8, left: Dimens.grid8,
bottom: Dimens.grid16, right: Dimens.grid8,
child: CameraHistogram(controller: widget.controller), bottom: Dimens.grid16,
), child: CameraHistogram(controller: widget.controller),
if (UserPreferencesProvider.cameraFeatureOf( ),
context, if (UserPreferencesProvider.cameraFeatureOf(
CameraFeature.spotMetering, context,
)) CameraFeature.spotMetering,
CameraSpotDetector(onSpotTap: widget.onSpotTap) ))
CameraSpotDetector(onSpotTap: widget.onSpotTap)
],
], ],
) )
: const SizedBox.shrink(), : const SizedBox.shrink(),