replaced ProFeaturesDialog with ProFeaturesScreen

This commit is contained in:
Vadim 2024-07-18 14:57:03 +02:00
parent 3a9baf42d6
commit 46d4222ac4
4 changed files with 9 additions and 74 deletions

View file

@ -6,6 +6,7 @@ import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/platform_config.dart';
import 'package:lightmeter/providers/user_preferences_provider.dart';
import 'package:lightmeter/screens/metering/flow_metering.dart';
import 'package:lightmeter/screens/pro_features/screen_pro_features.dart';
import 'package:lightmeter/screens/settings/flow_settings.dart';
import 'package:lightmeter/screens/shared/release_notes_dialog/flow_dialog_release_notes.dart';
import 'package:lightmeter/screens/timer/flow_timer.dart';
@ -44,6 +45,7 @@ class Application extends StatelessWidget {
routes: {
"metering": (_) => const ReleaseNotesFlow(child: MeteringFlow()),
"settings": (_) => const SettingsFlow(),
"proFeatures": (_) => const ProFeaturesScreen(),
"timer": (context) => TimerFlow(args: ModalRoute.of(context)!.settings.arguments! as TimerFlowArgs),
},
),

View file

@ -1,16 +1,17 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/generated/l10n.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/metering/components/shared/readings_container/components/shared/reading_value_container/widget_container_reading_value.dart';
import 'package:lightmeter/screens/shared/pro_features_dialog/widget_dialog_pro_features.dart';
class LightmeterProAnimatedDialog extends StatelessWidget {
const LightmeterProAnimatedDialog({super.key});
@override
Widget build(BuildContext context) {
return AnimatedDialog(
closedChild: ReadingValueContainer(
return GestureDetector(
onTap: () {
Navigator.of(context).pushNamed('proFeatures');
},
child: ReadingValueContainer(
color: Theme.of(context).colorScheme.errorContainer,
textColor: Theme.of(context).colorScheme.onErrorContainer,
values: [
@ -20,8 +21,6 @@ class LightmeterProAnimatedDialog extends StatelessWidget {
),
],
),
openedChild: const ProFeaturesDialog(),
openedSize: Size.fromHeight(const ProFeaturesDialog().height(context)),
);
}
}

View file

@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/res/dimens.dart';
import 'package:lightmeter/screens/shared/pro_features_dialog/widget_dialog_pro_features.dart';
import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart';
class BuyProListTile extends StatelessWidget {
@ -13,13 +12,10 @@ class BuyProListTile extends StatelessWidget {
final isPending = status == IAPProductStatus.purchased || status == null;
return ListTile(
leading: const Icon(Icons.star_outlined),
title: Text(S.of(context).proFeaturesTitle),
title: Text(S.of(context).unlock),
onTap: !isPending
? () {
showDialog(
context: context,
builder: (_) => const Dialog(child: ProFeaturesDialog()),
);
Navigator.of(context).pushNamed('proFeatures');
}
: null,
trailing: isPending

View file

@ -1,62 +0,0 @@
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();
}