mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-10-19 06:40:59 +00:00
62 lines
2.3 KiB
Dart
62 lines
2.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:lightmeter/generated/l10n.dart';
|
|
import 'package:lightmeter/providers/services_provider.dart';
|
|
import 'package:lightmeter/res/dimens.dart';
|
|
import 'package:lightmeter/screens/metering/components/shared/readings_container/components/shared/animated_dialog_picker/components/animated_dialog/widget_dialog_animated.dart';
|
|
import 'package:lightmeter/screens/shared/transparent_dialog/widget_dialog_transparent.dart';
|
|
import 'package:lightmeter/utils/text_height.dart';
|
|
import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart';
|
|
|
|
class ProFeaturesDialog extends StatelessWidget {
|
|
const ProFeaturesDialog({super.key});
|
|
|
|
double height(BuildContext context) => TransparentDialog.height(
|
|
context,
|
|
title: S.of(context).proFeaturesTitle,
|
|
contextHeight: dialogTextHeight(
|
|
context,
|
|
S.of(context).proFeaturesPromoText,
|
|
Theme.of(context).textTheme.bodyMedium,
|
|
Dimens.paddingL * 2,
|
|
),
|
|
);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return TransparentDialog(
|
|
icon: Icons.star_outlined,
|
|
title: S.of(context).proFeaturesTitle,
|
|
scrollableContent: false,
|
|
content: Flexible(
|
|
child: SingleChildScrollView(
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: Dimens.paddingL),
|
|
child: Text(
|
|
S.of(context).proFeaturesPromoText,
|
|
style: Theme.of(context).textTheme.bodyMedium,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () => _close(context),
|
|
child: Text(S.of(context).cancel),
|
|
),
|
|
FilledButton(
|
|
onPressed: () {
|
|
_close(context).then((_) {
|
|
ServicesProvider.maybeOf(context)
|
|
?.analytics
|
|
.setCustomKey('iap_product_type', IAPProductType.paidFeatures.storeId);
|
|
IAPProductsProvider.maybeOf(context)?.buy(IAPProductType.paidFeatures);
|
|
});
|
|
},
|
|
child: Text(S.of(context).unlockFor(IAPProducts.productOf(context, IAPProductType.paidFeatures)!.price)),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
Future<void> _close(BuildContext context) async => AnimatedDialog.maybeClose(context) ?? Navigator.of(context).pop();
|
|
}
|