diff --git a/lib/screens/settings/components/equipment/components/equipment_profiles/widget_list_tile_equipment_profiles.dart b/lib/screens/settings/components/equipment/components/equipment_profiles/widget_list_tile_equipment_profiles.dart index 0cb5631..c48b685 100644 --- a/lib/screens/settings/components/equipment/components/equipment_profiles/widget_list_tile_equipment_profiles.dart +++ b/lib/screens/settings/components/equipment/components/equipment_profiles/widget_list_tile_equipment_profiles.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:lightmeter/generated/l10n.dart'; import 'package:lightmeter/screens/settings/components/equipment/components/equipment_profiles/components/equipment_profile_screen/screen_equipment_profile.dart'; -import 'package:lightmeter/screens/settings/components/shared/iap_list_tile/widget_list_tile_iap.dart'; import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; class EquipmentProfilesListTile extends StatelessWidget { @@ -9,7 +8,7 @@ class EquipmentProfilesListTile extends StatelessWidget { @override Widget build(BuildContext context) { - return IAPListTile( + return ListTile( leading: const Icon(Icons.camera), title: Text(S.of(context).equipmentProfiles), onTap: () { diff --git a/lib/screens/settings/components/equipment/components/films/widget_list_tile_films.dart b/lib/screens/settings/components/equipment/components/films/widget_list_tile_films.dart index c343e2b..2ae40e9 100644 --- a/lib/screens/settings/components/equipment/components/films/widget_list_tile_films.dart +++ b/lib/screens/settings/components/equipment/components/films/widget_list_tile_films.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:lightmeter/generated/l10n.dart'; import 'package:lightmeter/screens/settings/components/shared/dialog_filter/widget_dialog_filter.dart'; -import 'package:lightmeter/screens/settings/components/shared/iap_list_tile/widget_list_tile_iap.dart'; import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart'; import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; @@ -10,7 +9,7 @@ class FilmsListTile extends StatelessWidget { @override Widget build(BuildContext context) { - return IAPListTile( + return ListTile( leading: const Icon(Icons.camera_roll), title: Text(S.of(context).filmsInUse), onTap: () { diff --git a/lib/screens/settings/components/equipment/widget_settings_section_equipment.dart b/lib/screens/settings/components/equipment/widget_settings_section_equipment.dart index ba3b975..2c1a03f 100644 --- a/lib/screens/settings/components/equipment/widget_settings_section_equipment.dart +++ b/lib/screens/settings/components/equipment/widget_settings_section_equipment.dart @@ -3,6 +3,7 @@ import 'package:lightmeter/generated/l10n.dart'; import 'package:lightmeter/screens/settings/components/equipment/components/equipment_profiles/widget_list_tile_equipment_profiles.dart'; import 'package:lightmeter/screens/settings/components/equipment/components/films/widget_list_tile_films.dart'; import 'package:lightmeter/screens/settings/components/shared/settings_section/widget_settings_section.dart'; +import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart'; class EquipmentSettingsSection extends StatelessWidget { const EquipmentSettingsSection({super.key}); @@ -11,6 +12,7 @@ class EquipmentSettingsSection extends StatelessWidget { Widget build(BuildContext context) { return SettingsSection( title: S.of(context).equipment, + enabled: IAPProducts.isPurchased(context, IAPProductType.paidFeatures), children: const [ EquipmentProfilesListTile(), FilmsListTile(), diff --git a/lib/screens/settings/components/shared/iap_list_tile/widget_list_tile_iap.dart b/lib/screens/settings/components/shared/iap_list_tile/widget_list_tile_iap.dart deleted file mode 100644 index 8c79f37..0000000 --- a/lib/screens/settings/components/shared/iap_list_tile/widget_list_tile_iap.dart +++ /dev/null @@ -1,33 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart'; - -/// Depends on the product status and replaces [onTap] with purchase callback -/// if the product is purchasable. -class IAPListTile extends StatelessWidget { - final IAPProductType product; - final Icon leading; - final Text title; - final VoidCallback onTap; - - const IAPListTile({ - this.product = IAPProductType.paidFeatures, - required this.leading, - required this.title, - required this.onTap, - super.key, - }); - - @override - Widget build(BuildContext context) { - return ListTile( - leading: leading, - title: title, - onTap: switch (IAPProducts.productOf(context, product)?.status) { - IAPProductStatus.purchasable => () => IAPProductsProvider.of(context).buy(product), - IAPProductStatus.pending => null, - IAPProductStatus.purchased => onTap, - null => null, - }, - ); - } -} diff --git a/lib/screens/settings/screen_settings.dart b/lib/screens/settings/screen_settings.dart index 85da4a1..3f1c0a6 100644 --- a/lib/screens/settings/screen_settings.dart +++ b/lib/screens/settings/screen_settings.dart @@ -1,13 +1,14 @@ import 'package:flutter/material.dart'; import 'package:lightmeter/generated/l10n.dart'; import 'package:lightmeter/screens/settings/components/about/widget_settings_section_about.dart'; -import 'package:lightmeter/screens/settings/components/lightmeter_pro/widget_settings_section_lightmeter_pro.dart'; import 'package:lightmeter/screens/settings/components/equipment/widget_settings_section_equipment.dart'; import 'package:lightmeter/screens/settings/components/general/widget_settings_section_general.dart'; +import 'package:lightmeter/screens/settings/components/lightmeter_pro/widget_settings_section_lightmeter_pro.dart'; import 'package:lightmeter/screens/settings/components/metering/widget_settings_section_metering.dart'; import 'package:lightmeter/screens/settings/components/theme/widget_settings_section_theme.dart'; import 'package:lightmeter/screens/settings/flow_settings.dart'; import 'package:lightmeter/screens/shared/sliver_screen/screen_sliver.dart'; +import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart'; class SettingsScreen extends StatefulWidget { const SettingsScreen({super.key}); @@ -44,7 +45,8 @@ class _SettingsScreenState extends State { SliverList( delegate: SliverChildListDelegate( [ - const LightmeterProSettingsSection(), + if (!IAPProducts.isPurchased(context, IAPProductType.paidFeatures)) + const LightmeterProSettingsSection(), const MeteringSettingsSection(), const EquipmentSettingsSection(), const GeneralSettingsSection(),