mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-25 17:00:39 +00:00
Improved EquipmentProfilesListTile
statuses visualization
This commit is contained in:
parent
88ec733596
commit
99eebff9a4
1 changed files with 18 additions and 11 deletions
|
@ -1,8 +1,8 @@
|
||||||
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:lightmeter/environment.dart';
|
|
||||||
import 'package:lightmeter/generated/l10n.dart';
|
import 'package:lightmeter/generated/l10n.dart';
|
||||||
import 'package:lightmeter/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/screen_equipment_profile.dart';
|
import 'package:lightmeter/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/screen_equipment_profile.dart';
|
||||||
import 'package:lightmeter/utils/inherited_generics.dart';
|
|
||||||
import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart';
|
import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart';
|
||||||
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
||||||
|
|
||||||
|
@ -11,18 +11,25 @@ class EquipmentProfilesListTile extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final paidStatus = IAPProducts.productOf(context, IAPProductType.paidFeatures)?.status;
|
||||||
|
log(paidStatus.toString());
|
||||||
return ListTile(
|
return ListTile(
|
||||||
leading: const Icon(Icons.camera),
|
leading: const Icon(Icons.camera),
|
||||||
title: Text(S.of(context).equipmentProfiles),
|
title: Text(S.of(context).equipmentProfiles),
|
||||||
onTap: () {
|
onTap: switch (paidStatus) {
|
||||||
if (context.get<Environment>().buildType == BuildType.dev ||
|
IAPProductStatus.purchased => () {
|
||||||
IAPProducts.isPurchased(context, IAPProductType.paidFeatures)) {
|
|
||||||
Navigator.of(context).push<EquipmentProfile>(
|
Navigator.of(context).push<EquipmentProfile>(
|
||||||
MaterialPageRoute(builder: (_) => const EquipmentProfilesScreen()),
|
MaterialPageRoute(builder: (_) => const EquipmentProfilesScreen()),
|
||||||
);
|
);
|
||||||
} else {
|
},
|
||||||
|
IAPProductStatus.purchasable => () {
|
||||||
IAPProductsProvider.of(context).buy(IAPProductType.paidFeatures);
|
IAPProductsProvider.of(context).buy(IAPProductType.paidFeatures);
|
||||||
}
|
},
|
||||||
|
_ => null,
|
||||||
|
},
|
||||||
|
trailing: switch (paidStatus) {
|
||||||
|
IAPProductStatus.purchasable => const Icon(Icons.lock),
|
||||||
|
_ => null,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue