mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-26 01:10:39 +00:00
added FeaturesConfig
This commit is contained in:
parent
f12fe6953e
commit
0ff9249f8f
5 changed files with 43 additions and 22 deletions
3
lib/features.dart
Normal file
3
lib/features.dart
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
class FeaturesConfig {
|
||||||
|
static const bool equipmentProfilesEnabled = false;
|
||||||
|
}
|
|
@ -32,7 +32,7 @@ class Dimens {
|
||||||
// TopBar
|
// TopBar
|
||||||
/// Probably this is a bad practice, but with text size locked, the height is always 212
|
/// Probably this is a bad practice, but with text size locked, the height is always 212
|
||||||
static const double readingContainerSingleValueHeight = 76;
|
static const double readingContainerSingleValueHeight = 76;
|
||||||
static const double readingContainerDefaultHeight = 212;
|
static const double readingContainerDefaultHeight = 288;
|
||||||
|
|
||||||
// `CenteredSlider`
|
// `CenteredSlider`
|
||||||
static const double cameraSliderTrackHeight = grid4;
|
static const double cameraSliderTrackHeight = grid4;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:lightmeter/data/models/exposure_pair.dart';
|
import 'package:lightmeter/data/models/exposure_pair.dart';
|
||||||
|
import 'package:lightmeter/features.dart';
|
||||||
import 'package:lightmeter/platform_config.dart';
|
import 'package:lightmeter/platform_config.dart';
|
||||||
import 'package:lightmeter/providers/equipment_profile_provider.dart';
|
import 'package:lightmeter/providers/equipment_profile_provider.dart';
|
||||||
import 'package:lightmeter/res/dimens.dart';
|
import 'package:lightmeter/res/dimens.dart';
|
||||||
|
@ -49,7 +50,7 @@ class CameraContainer extends StatelessWidget {
|
||||||
PlatformConfig.cameraPreviewAspectRatio;
|
PlatformConfig.cameraPreviewAspectRatio;
|
||||||
|
|
||||||
double topBarOverflow = Dimens.readingContainerDefaultHeight - cameraViewHeight;
|
double topBarOverflow = Dimens.readingContainerDefaultHeight - cameraViewHeight;
|
||||||
if (EquipmentProfiles.of(context).isNotEmpty) {
|
if (FeaturesConfig.equipmentProfilesEnabled) {
|
||||||
topBarOverflow += Dimens.readingContainerSingleValueHeight;
|
topBarOverflow += Dimens.readingContainerSingleValueHeight;
|
||||||
topBarOverflow += Dimens.paddingS;
|
topBarOverflow += Dimens.paddingS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:lightmeter/data/models/exposure_pair.dart';
|
import 'package:lightmeter/data/models/exposure_pair.dart';
|
||||||
|
import 'package:lightmeter/data/models/film.dart';
|
||||||
|
import 'package:lightmeter/features.dart';
|
||||||
import 'package:lightmeter/generated/l10n.dart';
|
import 'package:lightmeter/generated/l10n.dart';
|
||||||
import 'package:lightmeter/providers/equipment_profile_provider.dart';
|
import 'package:lightmeter/providers/equipment_profile_provider.dart';
|
||||||
|
import 'package:lightmeter/providers/film_profile.dart';
|
||||||
import 'package:lightmeter/res/dimens.dart';
|
import 'package:lightmeter/res/dimens.dart';
|
||||||
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
||||||
|
|
||||||
|
@ -36,12 +39,8 @@ class ReadingsContainer extends StatelessWidget {
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
if (EquipmentProfiles.of(context).isNotEmpty) ...[
|
if (FeaturesConfig.equipmentProfilesEnabled) ...[
|
||||||
_EquipmentProfilePicker(
|
const _EquipmentProfilePicker(),
|
||||||
selectedValue: EquipmentProfile.of(context),
|
|
||||||
values: EquipmentProfiles.of(context),
|
|
||||||
onChanged: EquipmentProfileProvider.of(context).setProfile,
|
|
||||||
),
|
|
||||||
const _InnerPadding(),
|
const _InnerPadding(),
|
||||||
],
|
],
|
||||||
ReadingValueContainer(
|
ReadingValueContainer(
|
||||||
|
@ -57,6 +56,8 @@ class ReadingsContainer extends StatelessWidget {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const _InnerPadding(),
|
const _InnerPadding(),
|
||||||
|
const _FilmPicker(),
|
||||||
|
const _InnerPadding(),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
|
@ -86,28 +87,43 @@ class _InnerPadding extends SizedBox {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _EquipmentProfilePicker extends StatelessWidget {
|
class _EquipmentProfilePicker extends StatelessWidget {
|
||||||
final List<EquipmentProfileData> values;
|
const _EquipmentProfilePicker();
|
||||||
final EquipmentProfileData selectedValue;
|
|
||||||
final ValueChanged<EquipmentProfileData> onChanged;
|
|
||||||
|
|
||||||
const _EquipmentProfilePicker({
|
|
||||||
required this.selectedValue,
|
|
||||||
required this.values,
|
|
||||||
required this.onChanged,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return AnimatedDialogPicker<EquipmentProfileData>(
|
return AnimatedDialogPicker<EquipmentProfileData>(
|
||||||
title: S.of(context).equipmentProfile,
|
title: S.of(context).equipmentProfile,
|
||||||
selectedValue: selectedValue,
|
selectedValue: EquipmentProfile.of(context),
|
||||||
values: values,
|
values: EquipmentProfiles.of(context),
|
||||||
itemTitleBuilder: (_, value) => Text(value.id.isEmpty ? S.of(context).none : value.name),
|
itemTitleBuilder: (_, value) => Text(value.id.isEmpty ? S.of(context).none : value.name),
|
||||||
onChanged: onChanged,
|
onChanged: EquipmentProfileProvider.of(context).setProfile,
|
||||||
closedChild: ReadingValueContainer.singleValue(
|
closedChild: ReadingValueContainer.singleValue(
|
||||||
value: ReadingValue(
|
value: ReadingValue(
|
||||||
label: S.of(context).equipmentProfile,
|
label: S.of(context).equipmentProfile,
|
||||||
value: selectedValue.id.isEmpty ? S.of(context).none : selectedValue.name,
|
value: EquipmentProfile.of(context).id.isEmpty
|
||||||
|
? S.of(context).none
|
||||||
|
: EquipmentProfile.of(context).name,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _FilmPicker extends StatelessWidget {
|
||||||
|
const _FilmPicker();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AnimatedDialogPicker<FilmData>(
|
||||||
|
title: S.of(context).film,
|
||||||
|
selectedValue: Film.of(context),
|
||||||
|
values: FilmData.values,
|
||||||
|
itemTitleBuilder: (_, value) => Text(value.name.isEmpty ? S.of(context).none : value.name),
|
||||||
|
onChanged: FilmProvider.of(context).setFilm,
|
||||||
|
closedChild: ReadingValueContainer.singleValue(
|
||||||
|
value: ReadingValue(
|
||||||
|
label: S.of(context).film,
|
||||||
|
value: Film.of(context).name.isEmpty ? S.of(context).none : Film.of(context).name,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:lightmeter/features.dart';
|
||||||
import 'package:lightmeter/generated/l10n.dart';
|
import 'package:lightmeter/generated/l10n.dart';
|
||||||
import 'package:lightmeter/screens/settings/components/shared/settings_section/widget_settings_section.dart';
|
import 'package:lightmeter/screens/settings/components/shared/settings_section/widget_settings_section.dart';
|
||||||
|
|
||||||
|
@ -16,7 +17,7 @@ class MeteringSettingsSection extends StatelessWidget {
|
||||||
children: const [
|
children: const [
|
||||||
StopTypeListTile(),
|
StopTypeListTile(),
|
||||||
CalibrationListTile(),
|
CalibrationListTile(),
|
||||||
EquipmentProfilesListTile(),
|
if (FeaturesConfig.equipmentProfilesEnabled) EquipmentProfilesListTile(),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue