mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-21 15:00:40 +00:00
ML-113 Add ability to copy equipment profile (#120)
* Display range values instead of values count * copy equipment profile * added `IconButton` tooltips
This commit is contained in:
parent
0fbf252d9e
commit
abbc4c92de
14 changed files with 136 additions and 59 deletions
|
@ -36,7 +36,7 @@ class EquipmentProfileProviderState extends State<EquipmentProfileProvider> {
|
|||
|
||||
void setProfile(EquipmentProfile data) {}
|
||||
|
||||
void addProfile(String name) {}
|
||||
void addProfile(String name, [EquipmentProfile? copyFrom]) {}
|
||||
|
||||
void updateProdile(EquipmentProfile data) {}
|
||||
|
||||
|
|
|
@ -96,5 +96,17 @@
|
|||
"buyLightmeterPro": "Buy Lightmeter Pro",
|
||||
"lightmeterPro": "Lightmeter Pro",
|
||||
"lightmeterProDescription": "Unlocks extra features, such as equipment profiles containing filters for aperture, shutter speed, and more; and a list of films with compensation for what's known as reciprocity failure.\n\nThe source code of Lightmeter is available on GitHub. You are welcome to compile it yourself. However, if you want to support the development and receive new features and updates, consider purchasing Lightmeter Pro.",
|
||||
"buy": "Buy"
|
||||
"buy": "Buy",
|
||||
"tooltipAdd": "Add",
|
||||
"tooltipClose": "Close",
|
||||
"tooltipExpand": "Expand",
|
||||
"tooltipCollapse": "Collapse",
|
||||
"tooltipCopy": "Copy",
|
||||
"tooltipDelete": "Delete",
|
||||
"tooltipSelectAll": "Select all",
|
||||
"tooltipDesecelectAll": "Deselect all",
|
||||
"tooltipResetToZero": "Reset to zero",
|
||||
"tooltipUseLightSensor": "Use lightsensor",
|
||||
"tooltipUseCamera": "Use camera",
|
||||
"tooltipOpenSettings": "Open settings"
|
||||
}
|
|
@ -96,5 +96,17 @@
|
|||
"buyLightmeterPro": "Acheter Lightmeter Pro",
|
||||
"lightmeterPro": "Lightmeter Pro",
|
||||
"lightmeterProDescription": "Déverrouille des fonctionnalités supplémentaires, telles que des profils d'équipement contenant des filtres pour l'ouverture, la vitesse d'obturation et plus encore, ainsi qu'une liste de films avec une compensation pour ce que l'on appelle l'échec de réciprocité.\n\nLe code source du Lightmeter est disponible sur GitHub. Vous pouvez le compiler vous-même. Cependant, si vous souhaitez soutenir le développement et recevoir de nouvelles fonctionnalités et mises à jour, envisagez d'acheter Lightmeter Pro.",
|
||||
"buy": "Acheter"
|
||||
"buy": "Acheter",
|
||||
"tooltipAdd": "Ajouter",
|
||||
"tooltipClose": "Fermer",
|
||||
"tooltipExpand": "Élargir",
|
||||
"tooltipCollapse": "Effondrement",
|
||||
"tooltipCopy": "Copie",
|
||||
"tooltipDelete": "Supprimer",
|
||||
"tooltipSelectAll": "Tout sélectionner",
|
||||
"tooltipDesecelectAll": "Désélectionner tout",
|
||||
"tooltipResetToZero": "Remise à zéro",
|
||||
"tooltipUseLightSensor": "Utiliser un capteur de lumière",
|
||||
"tooltipUseCamera": "Utiliser la caméra",
|
||||
"tooltipOpenSettings": "Ouvrir les paramètres"
|
||||
}
|
|
@ -96,5 +96,17 @@
|
|||
"buyLightmeterPro": "Купить Lightmeter Pro",
|
||||
"lightmeterPro": "Lightmeter Pro",
|
||||
"lightmeterProDescription": "Даёт доступ к таким функциям как профили оборудования, содержащие фильтры для диафрагмы, выдержки и других значений, а также набору пленок с компенсацией эффекта Шварцшильда.\n\nИсходный код Lightmeter доступен на GitHub. Вы можете собрать его самостоятельно. Однако если вы хотите поддержать разработку и получать новые функции и обновления, то приобретите Lightmeter Pro.",
|
||||
"buy": "Купить"
|
||||
"buy": "Купить",
|
||||
"tooltipAdd": "Добавить",
|
||||
"tooltipClose": "Закрыть",
|
||||
"tooltipExpand": "Развернуть",
|
||||
"tooltipCollapse": "Свернуть",
|
||||
"tooltipCopy": "Скопировать",
|
||||
"tooltipDelete": "Удалить",
|
||||
"tooltipSelectAll": "Выбрать все",
|
||||
"tooltipDesecelectAll": "Отменить все",
|
||||
"tooltipResetToZero": "Сбросить до 0",
|
||||
"tooltipUseLightSensor": "Использовать датчик освещенности",
|
||||
"tooltipUseCamera": "Использовать камеру",
|
||||
"tooltipOpenSettings": "Открыть настройки"
|
||||
}
|
|
@ -96,5 +96,17 @@
|
|||
"buyLightmeterPro": "Buy Lightmeter Pro",
|
||||
"lightmeterPro": "Lightmeter Pro",
|
||||
"lightmeterProDescription": "Unlocks extra features, such as equipment profiles containing filters for aperture, shutter speed, and more; and a list of films with compensation for what's known as reciprocity failure.\n\nThe source code of Lightmeter is available on GitHub. You are welcome to compile it yourself. However, if you want to support the development and receive new features and updates, consider purchasing Lightmeter Pro.",
|
||||
"buy": "Buy"
|
||||
"buy": "Buy",
|
||||
"tooltipAdd": "Add",
|
||||
"tooltipClose": "Close",
|
||||
"tooltipExpand": "Expand",
|
||||
"tooltipCollapse": "Collapse",
|
||||
"tooltipCopy": "Copy",
|
||||
"tooltipDelete": "Delete",
|
||||
"tooltipSelectAll": "Select all",
|
||||
"tooltipDesecelectAll": "Deselect all",
|
||||
"resetToZero": "Reset to zero",
|
||||
"tooltipUseLightSensor": "Use lightsensor",
|
||||
"tooltipUseCamera": "Use camera",
|
||||
"tooltipOpenSettings": "Open settings"
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:lightmeter/data/models/ev_source_type.dart';
|
||||
import 'package:lightmeter/generated/l10n.dart';
|
||||
import 'package:lightmeter/providers/user_preferences_provider.dart';
|
||||
import 'package:lightmeter/res/dimens.dart';
|
||||
import 'package:lightmeter/screens/metering/components/bottom_controls/components/measure_button/widget_button_measure.dart';
|
||||
|
@ -46,6 +47,10 @@ class MeteringBottomControls extends StatelessWidget {
|
|||
? Icons.camera_rear
|
||||
: Icons.wb_incandescent,
|
||||
),
|
||||
tooltip:
|
||||
UserPreferencesProvider.evSourceTypeOf(context) != EvSourceType.camera
|
||||
? S.of(context).tooltipUseCamera
|
||||
: S.of(context).tooltipUseLightSensor,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
@ -61,6 +66,7 @@ class MeteringBottomControls extends StatelessWidget {
|
|||
child: IconButton(
|
||||
onPressed: onSettings,
|
||||
icon: const Icon(Icons.settings),
|
||||
tooltip: S.of(context).tooltipOpenSettings,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:lightmeter/generated/l10n.dart';
|
||||
import 'package:lightmeter/res/dimens.dart';
|
||||
import 'package:lightmeter/screens/shared/centered_slider/widget_slider_centered.dart';
|
||||
import 'package:lightmeter/utils/to_string_signed.dart';
|
||||
|
@ -22,6 +23,7 @@ class ExposureOffsetSlider extends StatelessWidget {
|
|||
IconButton(
|
||||
icon: const Icon(Icons.sync),
|
||||
onPressed: value != 0.0 ? () => onChanged(0.0) : null,
|
||||
tooltip: S.of(context).tooltipResetToZero,
|
||||
),
|
||||
Expanded(
|
||||
child: Row(
|
||||
|
|
|
@ -36,9 +36,6 @@ class EquipmentListTiles extends StatelessWidget {
|
|||
title: S.of(context).isoValues,
|
||||
description: S.of(context).isoValuesFilterDescription,
|
||||
values: IsoValue.values,
|
||||
valuesCount: selectedIsoValues.length == IsoValue.values.length
|
||||
? S.of(context).equipmentProfileAllValues
|
||||
: selectedIsoValues.length.toString(),
|
||||
selectedValues: selectedIsoValues,
|
||||
rangeSelect: false,
|
||||
onChanged: onIsoValuesSelecred,
|
||||
|
@ -48,9 +45,6 @@ class EquipmentListTiles extends StatelessWidget {
|
|||
title: S.of(context).ndFilters,
|
||||
description: S.of(context).ndFiltersFilterDescription,
|
||||
values: NdValue.values,
|
||||
valuesCount: selectedNdValues.length == NdValue.values.length
|
||||
? S.of(context).equipmentProfileAllValues
|
||||
: selectedNdValues.length.toString(),
|
||||
selectedValues: selectedNdValues,
|
||||
rangeSelect: false,
|
||||
onChanged: onNdValuesSelected,
|
||||
|
@ -60,9 +54,6 @@ class EquipmentListTiles extends StatelessWidget {
|
|||
title: S.of(context).apertureValues,
|
||||
description: S.of(context).apertureValuesFilterDescription,
|
||||
values: ApertureValue.values,
|
||||
valuesCount: selectedApertureValues.length == ApertureValue.values.length
|
||||
? S.of(context).equipmentProfileAllValues
|
||||
: selectedApertureValues.length.toString(),
|
||||
selectedValues: selectedApertureValues,
|
||||
rangeSelect: true,
|
||||
onChanged: onApertureValuesSelected,
|
||||
|
@ -72,9 +63,6 @@ class EquipmentListTiles extends StatelessWidget {
|
|||
title: S.of(context).shutterSpeedValues,
|
||||
description: S.of(context).shutterSpeedValuesFilterDescription,
|
||||
values: ShutterSpeedValue.values,
|
||||
valuesCount: selectedShutterSpeedValues.length == ShutterSpeedValue.values.length
|
||||
? S.of(context).equipmentProfileAllValues
|
||||
: selectedShutterSpeedValues.length.toString(),
|
||||
selectedValues: selectedShutterSpeedValues,
|
||||
rangeSelect: true,
|
||||
onChanged: onShutterSpeedValuesSelected,
|
||||
|
@ -87,7 +75,6 @@ class EquipmentListTiles extends StatelessWidget {
|
|||
class _EquipmentListTile<T extends PhotographyValue> extends StatelessWidget {
|
||||
final IconData icon;
|
||||
final String title;
|
||||
final String valuesCount;
|
||||
final String description;
|
||||
final List<T> selectedValues;
|
||||
final List<T> values;
|
||||
|
@ -97,7 +84,6 @@ class _EquipmentListTile<T extends PhotographyValue> extends StatelessWidget {
|
|||
const _EquipmentListTile({
|
||||
required this.icon,
|
||||
required this.title,
|
||||
required this.valuesCount,
|
||||
required this.description,
|
||||
required this.selectedValues,
|
||||
required this.values,
|
||||
|
@ -111,7 +97,13 @@ class _EquipmentListTile<T extends PhotographyValue> extends StatelessWidget {
|
|||
return ListTile(
|
||||
leading: Icon(icon),
|
||||
title: Text(title),
|
||||
trailing: Text(valuesCount),
|
||||
trailing: rangeSelect
|
||||
? Text("${selectedValues.first} - ${selectedValues.last}")
|
||||
: Text(
|
||||
values.length == selectedValues.length
|
||||
? S.of(context).equipmentProfileAllValues
|
||||
: selectedValues.length.toString(),
|
||||
),
|
||||
onTap: () {
|
||||
showDialog<List<T>>(
|
||||
context: context,
|
||||
|
|
|
@ -2,6 +2,7 @@ import 'dart:math';
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
import 'package:lightmeter/generated/l10n.dart';
|
||||
import 'package:lightmeter/res/dimens.dart';
|
||||
import 'package:lightmeter/screens/settings/components/equipment/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_container/components/equipment_list_tiles/widget_list_tiles_equipments.dart';
|
||||
import 'package:lightmeter/screens/settings/components/equipment/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_name_dialog/widget_dialog_equipment_profile_name.dart';
|
||||
|
@ -10,12 +11,14 @@ import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
|||
class EquipmentProfileContainer extends StatefulWidget {
|
||||
final EquipmentProfile data;
|
||||
final ValueChanged<EquipmentProfile> onUpdate;
|
||||
final VoidCallback onCopy;
|
||||
final VoidCallback onDelete;
|
||||
final VoidCallback onExpand;
|
||||
|
||||
const EquipmentProfileContainer({
|
||||
required this.data,
|
||||
required this.onUpdate,
|
||||
required this.onCopy,
|
||||
required this.onDelete,
|
||||
required this.onExpand,
|
||||
super.key,
|
||||
|
@ -85,19 +88,9 @@ class EquipmentProfileContainerState extends State<EquipmentProfileContainer>
|
|||
),
|
||||
],
|
||||
),
|
||||
trailing: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
_AnimatedArrowButton(
|
||||
controller: _controller,
|
||||
onPressed: () => _expanded ? collapse() : expand(),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: widget.onDelete,
|
||||
icon: const Icon(Icons.delete),
|
||||
),
|
||||
],
|
||||
trailing: _AnimatedArrowButton(
|
||||
controller: _controller,
|
||||
onPressed: () => _expanded ? collapse() : expand(),
|
||||
),
|
||||
onTap: () => _expanded ? _showNameDialog() : expand(),
|
||||
),
|
||||
|
@ -120,6 +113,8 @@ class EquipmentProfileContainerState extends State<EquipmentProfileContainer>
|
|||
_equipmentData = _equipmentData.copyWith(shutterSpeedValues: value);
|
||||
widget.onUpdate(_equipmentData);
|
||||
},
|
||||
onCopy: widget.onCopy,
|
||||
onDelete: widget.onDelete,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -194,6 +189,7 @@ class _AnimatedArrowButton extends AnimatedWidget {
|
|||
angle: _progress.value * pi,
|
||||
child: const Icon(Icons.keyboard_arrow_down),
|
||||
),
|
||||
tooltip: _progress.value == 0 ? S.of(context).tooltipExpand : S.of(context).tooltipCollapse,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -204,6 +200,8 @@ class _AnimatedEquipmentListTiles extends AnimatedWidget {
|
|||
final ValueChanged<List<IsoValue>> onIsoValuesSelecred;
|
||||
final ValueChanged<List<NdValue>> onNdValuesSelected;
|
||||
final ValueChanged<List<ShutterSpeedValue>> onShutterSpeedValuesSelected;
|
||||
final VoidCallback onCopy;
|
||||
final VoidCallback onDelete;
|
||||
|
||||
const _AnimatedEquipmentListTiles({
|
||||
required AnimationController controller,
|
||||
|
@ -212,6 +210,8 @@ class _AnimatedEquipmentListTiles extends AnimatedWidget {
|
|||
required this.onIsoValuesSelecred,
|
||||
required this.onNdValuesSelected,
|
||||
required this.onShutterSpeedValuesSelected,
|
||||
required this.onCopy,
|
||||
required this.onDelete,
|
||||
}) : super(listenable: controller);
|
||||
|
||||
Animation<double> get _progress => listenable as Animation<double>;
|
||||
|
@ -222,19 +222,43 @@ class _AnimatedEquipmentListTiles extends AnimatedWidget {
|
|||
alignment: Alignment.topCenter,
|
||||
size: Size(
|
||||
double.maxFinite,
|
||||
_progress.value * Dimens.grid56 * 4,
|
||||
_progress.value * Dimens.grid56 * 5,
|
||||
),
|
||||
// https://github.com/gskinnerTeam/flutter-folio/pull/62
|
||||
child: Opacity(
|
||||
opacity: _progress.value,
|
||||
child: EquipmentListTiles(
|
||||
selectedApertureValues: equipmentData.apertureValues,
|
||||
selectedIsoValues: equipmentData.isoValues,
|
||||
selectedNdValues: equipmentData.ndValues,
|
||||
selectedShutterSpeedValues: equipmentData.shutterSpeedValues,
|
||||
onApertureValuesSelected: onApertureValuesSelected,
|
||||
onIsoValuesSelecred: onIsoValuesSelecred,
|
||||
onNdValuesSelected: onNdValuesSelected,
|
||||
onShutterSpeedValuesSelected: onShutterSpeedValuesSelected,
|
||||
child: Column(
|
||||
children: [
|
||||
EquipmentListTiles(
|
||||
selectedApertureValues: equipmentData.apertureValues,
|
||||
selectedIsoValues: equipmentData.isoValues,
|
||||
selectedNdValues: equipmentData.ndValues,
|
||||
selectedShutterSpeedValues: equipmentData.shutterSpeedValues,
|
||||
onApertureValuesSelected: onApertureValuesSelected,
|
||||
onIsoValuesSelecred: onIsoValuesSelecred,
|
||||
onNdValuesSelected: onNdValuesSelected,
|
||||
onShutterSpeedValuesSelected: onShutterSpeedValuesSelected,
|
||||
),
|
||||
ListTile(
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: Dimens.paddingM),
|
||||
trailing: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: onCopy,
|
||||
icon: const Icon(Icons.copy),
|
||||
tooltip: S.of(context).tooltipCopy,
|
||||
),
|
||||
IconButton(
|
||||
onPressed: onDelete,
|
||||
icon: const Icon(Icons.delete),
|
||||
tooltip: S.of(context).tooltipDelete,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -34,10 +34,7 @@ class _EquipmentProfilesScreenState extends State<EquipmentProfilesScreen> {
|
|||
IconButton(
|
||||
onPressed: _addProfile,
|
||||
icon: const Icon(Icons.add),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: Navigator.of(context).pop,
|
||||
icon: const Icon(Icons.close),
|
||||
tooltip: S.of(context).tooltipAdd,
|
||||
),
|
||||
],
|
||||
slivers: profilesCount == 1
|
||||
|
@ -69,6 +66,7 @@ class _EquipmentProfilesScreenState extends State<EquipmentProfilesScreen> {
|
|||
data: profile,
|
||||
onExpand: () => _keepExpandedAt(index),
|
||||
onUpdate: _updateProfileAt,
|
||||
onCopy: () => _addProfile(profile),
|
||||
onDelete: () => _removeProfileAt(profile),
|
||||
),
|
||||
);
|
||||
|
@ -81,13 +79,13 @@ class _EquipmentProfilesScreenState extends State<EquipmentProfilesScreen> {
|
|||
);
|
||||
}
|
||||
|
||||
void _addProfile() {
|
||||
void _addProfile([EquipmentProfile? copyFrom]) {
|
||||
showDialog<String>(
|
||||
context: context,
|
||||
builder: (_) => const EquipmentProfileNameDialog(),
|
||||
).then((value) {
|
||||
if (value != null) {
|
||||
EquipmentProfileProvider.of(context).addProfile(value);
|
||||
).then((name) {
|
||||
if (name != null) {
|
||||
EquipmentProfileProvider.of(context).addProfile(name, copyFrom);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -117,6 +117,7 @@ class _CalibrationUnit extends StatelessWidget {
|
|||
IconButton(
|
||||
onPressed: onReset,
|
||||
icon: const Icon(Icons.sync),
|
||||
tooltip: S.of(context).tooltipResetToZero,
|
||||
),
|
||||
],
|
||||
)
|
||||
|
|
|
@ -85,6 +85,9 @@ class _DialogFilterState<T> extends State<DialogFilter<T>> {
|
|||
padding: EdgeInsets.zero,
|
||||
icon: Icon(_hasAnyUnselected ? Icons.select_all : Icons.deselect),
|
||||
onPressed: _toggleAll,
|
||||
tooltip: _hasAnyUnselected
|
||||
? S.of(context).tooltipSelectAll
|
||||
: S.of(context).tooltipDesecelectAll,
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
|
|
|
@ -35,12 +35,6 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|||
return ScaffoldMessenger(
|
||||
child: SliverScreen(
|
||||
title: S.of(context).settings,
|
||||
appBarActions: [
|
||||
IconButton(
|
||||
onPressed: Navigator.of(context).pop,
|
||||
icon: const Icon(Icons.close),
|
||||
),
|
||||
],
|
||||
slivers: [
|
||||
SliverList(
|
||||
delegate: SliverChildListDelegate(
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:lightmeter/generated/l10n.dart';
|
||||
import 'package:lightmeter/res/dimens.dart';
|
||||
|
||||
class SliverScreen extends StatelessWidget {
|
||||
|
@ -8,7 +9,7 @@ class SliverScreen extends StatelessWidget {
|
|||
|
||||
const SliverScreen({
|
||||
required this.title,
|
||||
required this.appBarActions,
|
||||
this.appBarActions = const [],
|
||||
required this.slivers,
|
||||
super.key,
|
||||
});
|
||||
|
@ -36,7 +37,15 @@ class SliverScreen extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
),
|
||||
actions: appBarActions,
|
||||
actions: [
|
||||
...appBarActions,
|
||||
if (Navigator.of(context).canPop())
|
||||
IconButton(
|
||||
onPressed: Navigator.of(context).pop,
|
||||
icon: const Icon(Icons.close),
|
||||
tooltip: S.of(context).tooltipClose,
|
||||
),
|
||||
],
|
||||
),
|
||||
...slivers,
|
||||
],
|
||||
|
|
Loading…
Reference in a new issue