available for pro

This commit is contained in:
Vadim 2024-01-15 14:29:31 +01:00
parent abd33ed963
commit d2383d2685
2 changed files with 13 additions and 7 deletions

View file

@ -3,6 +3,7 @@ import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/providers/user_preferences_provider.dart'; import 'package:lightmeter/providers/user_preferences_provider.dart';
import 'package:lightmeter/res/dimens.dart'; import 'package:lightmeter/res/dimens.dart';
import 'package:lightmeter/screens/shared/filled_circle/widget_circle_filled.dart'; import 'package:lightmeter/screens/shared/filled_circle/widget_circle_filled.dart';
import 'package:lightmeter/utils/context_utils.dart';
const String _subscript100 = '\u2081\u2080\u2080'; const String _subscript100 = '\u2081\u2080\u2080';
@ -106,7 +107,7 @@ class _EvValueText extends StatelessWidget {
} }
String _text(BuildContext context) { String _text(BuildContext context) {
final bool showEv100 = UserPreferencesProvider.showEv100Of(context); final bool showEv100 = context.isPro && UserPreferencesProvider.showEv100Of(context);
final StringBuffer buffer = StringBuffer() final StringBuffer buffer = StringBuffer()
..writeAll([ ..writeAll([
(showEv100 ? ev100 : ev).toStringAsFixed(1), (showEv100 ? ev100 : ev).toStringAsFixed(1),

View file

@ -2,18 +2,23 @@ import 'package:flutter/material.dart';
import 'package:lightmeter/generated/l10n.dart'; import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/providers/user_preferences_provider.dart'; import 'package:lightmeter/providers/user_preferences_provider.dart';
import 'package:lightmeter/res/dimens.dart'; import 'package:lightmeter/res/dimens.dart';
import 'package:lightmeter/screens/settings/components/shared/disable/widget_disable.dart';
import 'package:lightmeter/utils/context_utils.dart';
class ShowEv100ListTile extends StatelessWidget { class ShowEv100ListTile extends StatelessWidget {
const ShowEv100ListTile({super.key}); const ShowEv100ListTile({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SwitchListTile( return Disable(
secondary: const Icon(Icons.adjust), disable: !context.isPro,
title: Text(S.of(context).showEv100), child: SwitchListTile(
value: UserPreferencesProvider.showEv100Of(context), secondary: const Icon(Icons.adjust),
onChanged: (_) => UserPreferencesProvider.of(context).toggleShowEV100(), title: Text(S.of(context).showEv100),
contentPadding: const EdgeInsets.symmetric(horizontal: Dimens.paddingM), value: context.isPro && UserPreferencesProvider.showEv100Of(context),
onChanged: (_) => UserPreferencesProvider.of(context).toggleShowEV100(),
contentPadding: const EdgeInsets.symmetric(horizontal: Dimens.paddingM),
),
); );
} }
} }