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: {
"metering": (_) => const ReleaseNotesFlow(child: MeteringFlow()),
"settings": (_) => const SettingsFlow(),
"proFeatures": (_) => const ProFeaturesScreen(),
"proFeatures": (_) => ProFeaturesScreen(),
"timer": (context) => TimerFlow(args: ModalRoute.of(context)!.settings.arguments! as TimerFlowArgs),
},
),

View file

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

View file

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