separated android & ios features

This commit is contained in:
Vadim 2024-07-23 20:57:20 +02:00
parent 44fc91cc16
commit cac6118aec
3 changed files with 12 additions and 6 deletions

View file

@ -45,7 +45,7 @@ class Application extends StatelessWidget {
routes: { routes: {
"metering": (_) => const ReleaseNotesFlow(child: MeteringFlow()), "metering": (_) => const ReleaseNotesFlow(child: MeteringFlow()),
"settings": (_) => const SettingsFlow(), "settings": (_) => const SettingsFlow(),
"proFeatures": (_) => const ProFeaturesScreen(), "proFeatures": (_) => ProFeaturesScreen(),
"timer": (context) => TimerFlow(args: ModalRoute.of(context)!.settings.arguments! as TimerFlowArgs), "timer": (context) => TimerFlow(args: ModalRoute.of(context)!.settings.arguments! as TimerFlowArgs),
}, },
), ),

View file

@ -13,6 +13,10 @@ enum AppFeature {
timer, timer,
mainScreenCustomization; mainScreenCustomization;
static List<AppFeature> get androidFeatures => values;
static List<AppFeature> get iosFeatures => values.where((f) => f != AppFeature.incidedntLightMetering).toList();
String name(BuildContext context) { String name(BuildContext context) {
switch (this) { switch (this) {
case AppFeature.reflectedLightMetering: case AppFeature.reflectedLightMetering:

View file

@ -1,3 +1,5 @@
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:lightmeter/data/models/app_feature.dart'; import 'package:lightmeter/data/models/app_feature.dart';
import 'package:lightmeter/generated/l10n.dart'; import 'package:lightmeter/generated/l10n.dart';
@ -9,7 +11,9 @@ import 'package:lightmeter/utils/text_height.dart';
import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart'; import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart';
class ProFeaturesScreen extends StatelessWidget { class ProFeaturesScreen extends StatelessWidget {
const ProFeaturesScreen({super.key}); final features = Platform.isAndroid ? AppFeature.androidFeatures : AppFeature.iosFeatures;
ProFeaturesScreen({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -47,10 +51,8 @@ class ProFeaturesScreen extends StatelessWidget {
), ),
const SliverToBoxAdapter(child: _FeaturesHeader()), const SliverToBoxAdapter(child: _FeaturesHeader()),
SliverList.separated( SliverList.separated(
itemCount: AppFeature.values.length, itemCount: features.length,
itemBuilder: (context, index) { itemBuilder: (_, index) => _FeatureItem(feature: features[index]),
return _FeatureItem(feature: AppFeature.values[index]);
},
separatorBuilder: (_, __) => const Padding( separatorBuilder: (_, __) => const Padding(
padding: EdgeInsets.symmetric(horizontal: Dimens.paddingM), padding: EdgeInsets.symmetric(horizontal: Dimens.paddingM),
child: Divider(), child: Divider(),