mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-24 00:10:47 +00:00
Renamed EquipmentProfileData
-> EquipmentProfile
This commit is contained in:
parent
b13acedebd
commit
dbf1f09eb6
10 changed files with 25 additions and 25 deletions
|
@ -1,4 +1,4 @@
|
||||||
enum SupportedLocale { en, fr, ru }
|
enum SupportedLocale { en, fr, ru, cn }
|
||||||
|
|
||||||
extension SupportedLocaleExtension on SupportedLocale {
|
extension SupportedLocaleExtension on SupportedLocale {
|
||||||
String get intlName => toString().replaceAll("SupportedLocale.", "");
|
String get intlName => toString().replaceAll("SupportedLocale.", "");
|
||||||
|
@ -11,6 +11,8 @@ extension SupportedLocaleExtension on SupportedLocale {
|
||||||
return 'Français';
|
return 'Français';
|
||||||
case SupportedLocale.ru:
|
case SupportedLocale.ru:
|
||||||
return 'Русский';
|
return 'Русский';
|
||||||
|
case SupportedLocale.cn:
|
||||||
|
return '<--->';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,6 +150,6 @@ class UserPreferencesService {
|
||||||
String get selectedEquipmentProfileId => ''; // coverage:ignore-line
|
String get selectedEquipmentProfileId => ''; // coverage:ignore-line
|
||||||
set selectedEquipmentProfileId(String id) {} // coverage:ignore-line
|
set selectedEquipmentProfileId(String id) {} // coverage:ignore-line
|
||||||
|
|
||||||
List<EquipmentProfileData> get equipmentProfiles => []; // coverage:ignore-line
|
List<EquipmentProfile> get equipmentProfiles => []; // coverage:ignore-line
|
||||||
set equipmentProfiles(List<EquipmentProfileData> profiles) {} // coverage:ignore-line
|
set equipmentProfiles(List<EquipmentProfile> profiles) {} // coverage:ignore-line
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,7 @@ import 'package:lightmeter/utils/inherited_generics.dart';
|
||||||
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
||||||
import 'package:uuid/uuid.dart';
|
import 'package:uuid/uuid.dart';
|
||||||
|
|
||||||
typedef EquipmentProfiles = List<EquipmentProfileData>;
|
typedef EquipmentProfiles = List<EquipmentProfile>;
|
||||||
typedef EquipmentProfile = EquipmentProfileData;
|
|
||||||
|
|
||||||
class EquipmentProfileProvider extends StatefulWidget {
|
class EquipmentProfileProvider extends StatefulWidget {
|
||||||
final Widget child;
|
final Widget child;
|
||||||
|
@ -21,7 +20,7 @@ class EquipmentProfileProvider extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class EquipmentProfileProviderState extends State<EquipmentProfileProvider> {
|
class EquipmentProfileProviderState extends State<EquipmentProfileProvider> {
|
||||||
static const EquipmentProfileData _defaultProfile = EquipmentProfileData(
|
static const EquipmentProfile _defaultProfile = EquipmentProfile(
|
||||||
id: '',
|
id: '',
|
||||||
name: '',
|
name: '',
|
||||||
apertureValues: ApertureValue.values,
|
apertureValues: ApertureValue.values,
|
||||||
|
@ -30,10 +29,10 @@ class EquipmentProfileProviderState extends State<EquipmentProfileProvider> {
|
||||||
isoValues: IsoValue.values,
|
isoValues: IsoValue.values,
|
||||||
);
|
);
|
||||||
|
|
||||||
List<EquipmentProfileData> _customProfiles = [];
|
List<EquipmentProfile> _customProfiles = [];
|
||||||
String _selectedId = '';
|
String _selectedId = '';
|
||||||
|
|
||||||
EquipmentProfileData get _selectedProfile => _customProfiles.firstWhere(
|
EquipmentProfile get _selectedProfile => _customProfiles.firstWhere(
|
||||||
(e) => e.id == _selectedId,
|
(e) => e.id == _selectedId,
|
||||||
orElse: () {
|
orElse: () {
|
||||||
context.get<UserPreferencesService>().selectedEquipmentProfileId = _defaultProfile.id;
|
context.get<UserPreferencesService>().selectedEquipmentProfileId = _defaultProfile.id;
|
||||||
|
@ -50,16 +49,16 @@ class EquipmentProfileProviderState extends State<EquipmentProfileProvider> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return InheritedWidgetBase<List<EquipmentProfileData>>(
|
return InheritedWidgetBase<List<EquipmentProfile>>(
|
||||||
data: [_defaultProfile] + _customProfiles,
|
data: [_defaultProfile] + _customProfiles,
|
||||||
child: InheritedWidgetBase<EquipmentProfileData>(
|
child: InheritedWidgetBase<EquipmentProfile>(
|
||||||
data: _selectedProfile,
|
data: _selectedProfile,
|
||||||
child: widget.child,
|
child: widget.child,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setProfile(EquipmentProfileData data) {
|
void setProfile(EquipmentProfile data) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_selectedId = data.id;
|
_selectedId = data.id;
|
||||||
});
|
});
|
||||||
|
@ -69,7 +68,7 @@ class EquipmentProfileProviderState extends State<EquipmentProfileProvider> {
|
||||||
/// Creates a default equipment profile
|
/// Creates a default equipment profile
|
||||||
void addProfile(String name) {
|
void addProfile(String name) {
|
||||||
_customProfiles.add(
|
_customProfiles.add(
|
||||||
EquipmentProfileData(
|
EquipmentProfile(
|
||||||
id: const Uuid().v1(),
|
id: const Uuid().v1(),
|
||||||
name: name,
|
name: name,
|
||||||
apertureValues: ApertureValue.values,
|
apertureValues: ApertureValue.values,
|
||||||
|
@ -81,7 +80,7 @@ class EquipmentProfileProviderState extends State<EquipmentProfileProvider> {
|
||||||
_refreshSavedProfiles();
|
_refreshSavedProfiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateProdile(EquipmentProfileData data) {
|
void updateProdile(EquipmentProfile data) {
|
||||||
final indexToUpdate = _customProfiles.indexWhere((element) => element.id == data.id);
|
final indexToUpdate = _customProfiles.indexWhere((element) => element.id == data.id);
|
||||||
if (indexToUpdate >= 0) {
|
if (indexToUpdate >= 0) {
|
||||||
_customProfiles[indexToUpdate] = data;
|
_customProfiles[indexToUpdate] = data;
|
||||||
|
@ -89,7 +88,7 @@ class EquipmentProfileProviderState extends State<EquipmentProfileProvider> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void deleteProfile(EquipmentProfileData data) {
|
void deleteProfile(EquipmentProfile data) {
|
||||||
_customProfiles.remove(data);
|
_customProfiles.remove(data);
|
||||||
_refreshSavedProfiles();
|
_refreshSavedProfiles();
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,7 @@ class _EquipmentProfilePicker extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return AnimatedDialogPicker<EquipmentProfileData>(
|
return AnimatedDialogPicker<EquipmentProfile>(
|
||||||
icon: Icons.camera,
|
icon: Icons.camera,
|
||||||
title: S.of(context).equipmentProfile,
|
title: S.of(context).equipmentProfile,
|
||||||
selectedValue: context.listen<EquipmentProfile>(),
|
selectedValue: context.listen<EquipmentProfile>(),
|
||||||
|
|
|
@ -6,7 +6,7 @@ sealed class MeteringEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
class EquipmentProfileChangedEvent extends MeteringEvent {
|
class EquipmentProfileChangedEvent extends MeteringEvent {
|
||||||
final EquipmentProfileData equipmentProfileData;
|
final EquipmentProfile equipmentProfileData;
|
||||||
|
|
||||||
const EquipmentProfileChangedEvent(this.equipmentProfileData);
|
const EquipmentProfileChangedEvent(this.equipmentProfileData);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ import 'package:lightmeter/data/models/exposure_pair.dart';
|
||||||
import 'package:lightmeter/data/models/film.dart';
|
import 'package:lightmeter/data/models/film.dart';
|
||||||
import 'package:lightmeter/data/models/metering_screen_layout_config.dart';
|
import 'package:lightmeter/data/models/metering_screen_layout_config.dart';
|
||||||
import 'package:lightmeter/environment.dart';
|
import 'package:lightmeter/environment.dart';
|
||||||
import 'package:lightmeter/providers/equipment_profile_provider.dart';
|
|
||||||
import 'package:lightmeter/providers/ev_source_type_provider.dart';
|
import 'package:lightmeter/providers/ev_source_type_provider.dart';
|
||||||
import 'package:lightmeter/screens/metering/bloc_metering.dart';
|
import 'package:lightmeter/screens/metering/bloc_metering.dart';
|
||||||
import 'package:lightmeter/screens/metering/components/bottom_controls/provider_bottom_controls.dart';
|
import 'package:lightmeter/screens/metering/components/bottom_controls/provider_bottom_controls.dart';
|
||||||
|
|
|
@ -8,8 +8,8 @@ import 'package:lightmeter/screens/settings/components/metering/components/equip
|
||||||
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
||||||
|
|
||||||
class EquipmentProfileContainer extends StatefulWidget {
|
class EquipmentProfileContainer extends StatefulWidget {
|
||||||
final EquipmentProfileData data;
|
final EquipmentProfile data;
|
||||||
final ValueChanged<EquipmentProfileData> onUpdate;
|
final ValueChanged<EquipmentProfile> onUpdate;
|
||||||
final VoidCallback onDelete;
|
final VoidCallback onDelete;
|
||||||
final VoidCallback onExpand;
|
final VoidCallback onExpand;
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ class EquipmentProfileContainer extends StatefulWidget {
|
||||||
|
|
||||||
class EquipmentProfileContainerState extends State<EquipmentProfileContainer>
|
class EquipmentProfileContainerState extends State<EquipmentProfileContainer>
|
||||||
with TickerProviderStateMixin {
|
with TickerProviderStateMixin {
|
||||||
late EquipmentProfileData _equipmentData = EquipmentProfileData(
|
late EquipmentProfile _equipmentData = EquipmentProfile(
|
||||||
id: widget.data.id,
|
id: widget.data.id,
|
||||||
name: widget.data.name,
|
name: widget.data.name,
|
||||||
apertureValues: widget.data.apertureValues,
|
apertureValues: widget.data.apertureValues,
|
||||||
|
@ -45,7 +45,7 @@ class EquipmentProfileContainerState extends State<EquipmentProfileContainer>
|
||||||
@override
|
@override
|
||||||
void didUpdateWidget(EquipmentProfileContainer oldWidget) {
|
void didUpdateWidget(EquipmentProfileContainer oldWidget) {
|
||||||
super.didUpdateWidget(oldWidget);
|
super.didUpdateWidget(oldWidget);
|
||||||
_equipmentData = EquipmentProfileData(
|
_equipmentData = EquipmentProfile(
|
||||||
id: widget.data.id,
|
id: widget.data.id,
|
||||||
name: widget.data.name,
|
name: widget.data.name,
|
||||||
apertureValues: widget.data.apertureValues,
|
apertureValues: widget.data.apertureValues,
|
||||||
|
@ -195,7 +195,7 @@ class _AnimatedArrowButton extends AnimatedWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _AnimatedEquipmentListTiles extends AnimatedWidget {
|
class _AnimatedEquipmentListTiles extends AnimatedWidget {
|
||||||
final EquipmentProfileData equipmentData;
|
final EquipmentProfile equipmentData;
|
||||||
final ValueChanged<List<ApertureValue>> onApertureValuesSelected;
|
final ValueChanged<List<ApertureValue>> onApertureValuesSelected;
|
||||||
final ValueChanged<List<IsoValue>> onIsoValuesSelecred;
|
final ValueChanged<List<IsoValue>> onIsoValuesSelecred;
|
||||||
final ValueChanged<List<NdValue>> onNdValuesSelected;
|
final ValueChanged<List<NdValue>> onNdValuesSelected;
|
||||||
|
|
|
@ -84,7 +84,7 @@ class _EquipmentProfilesScreenState extends State<EquipmentProfilesScreen> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _updateProfileAt(EquipmentProfileData data, int index) {
|
void _updateProfileAt(EquipmentProfile data, int index) {
|
||||||
EquipmentProfileProvider.of(context).updateProdile(data);
|
EquipmentProfileProvider.of(context).updateProdile(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ class EquipmentProfilesListTile extends StatelessWidget {
|
||||||
leading: const Icon(Icons.camera),
|
leading: const Icon(Icons.camera),
|
||||||
title: Text(S.of(context).equipmentProfiles),
|
title: Text(S.of(context).equipmentProfiles),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.of(context).push<EquipmentProfileData>(
|
Navigator.of(context).push<EquipmentProfile>(
|
||||||
MaterialPageRoute(builder: (_) => const EquipmentProfilesScreen()),
|
MaterialPageRoute(builder: (_) => const EquipmentProfilesScreen()),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -495,7 +495,7 @@ void main() {
|
||||||
group(
|
group(
|
||||||
'`EquipmentProfileChangedEvent`',
|
'`EquipmentProfileChangedEvent`',
|
||||||
() {
|
() {
|
||||||
final reducedProfile = EquipmentProfileData(
|
final reducedProfile = EquipmentProfile(
|
||||||
id: '0',
|
id: '0',
|
||||||
name: 'Reduced',
|
name: 'Reduced',
|
||||||
apertureValues: ApertureValue.values,
|
apertureValues: ApertureValue.values,
|
||||||
|
|
Loading…
Reference in a new issue