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 {
|
||||
String get intlName => toString().replaceAll("SupportedLocale.", "");
|
||||
|
@ -11,6 +11,8 @@ extension SupportedLocaleExtension on SupportedLocale {
|
|||
return 'Français';
|
||||
case SupportedLocale.ru:
|
||||
return 'Русский';
|
||||
case SupportedLocale.cn:
|
||||
return '<--->';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -150,6 +150,6 @@ class UserPreferencesService {
|
|||
String get selectedEquipmentProfileId => ''; // coverage:ignore-line
|
||||
set selectedEquipmentProfileId(String id) {} // coverage:ignore-line
|
||||
|
||||
List<EquipmentProfileData> get equipmentProfiles => []; // coverage:ignore-line
|
||||
set equipmentProfiles(List<EquipmentProfileData> profiles) {} // coverage:ignore-line
|
||||
List<EquipmentProfile> get equipmentProfiles => []; // 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:uuid/uuid.dart';
|
||||
|
||||
typedef EquipmentProfiles = List<EquipmentProfileData>;
|
||||
typedef EquipmentProfile = EquipmentProfileData;
|
||||
typedef EquipmentProfiles = List<EquipmentProfile>;
|
||||
|
||||
class EquipmentProfileProvider extends StatefulWidget {
|
||||
final Widget child;
|
||||
|
@ -21,7 +20,7 @@ class EquipmentProfileProvider extends StatefulWidget {
|
|||
}
|
||||
|
||||
class EquipmentProfileProviderState extends State<EquipmentProfileProvider> {
|
||||
static const EquipmentProfileData _defaultProfile = EquipmentProfileData(
|
||||
static const EquipmentProfile _defaultProfile = EquipmentProfile(
|
||||
id: '',
|
||||
name: '',
|
||||
apertureValues: ApertureValue.values,
|
||||
|
@ -30,10 +29,10 @@ class EquipmentProfileProviderState extends State<EquipmentProfileProvider> {
|
|||
isoValues: IsoValue.values,
|
||||
);
|
||||
|
||||
List<EquipmentProfileData> _customProfiles = [];
|
||||
List<EquipmentProfile> _customProfiles = [];
|
||||
String _selectedId = '';
|
||||
|
||||
EquipmentProfileData get _selectedProfile => _customProfiles.firstWhere(
|
||||
EquipmentProfile get _selectedProfile => _customProfiles.firstWhere(
|
||||
(e) => e.id == _selectedId,
|
||||
orElse: () {
|
||||
context.get<UserPreferencesService>().selectedEquipmentProfileId = _defaultProfile.id;
|
||||
|
@ -50,16 +49,16 @@ class EquipmentProfileProviderState extends State<EquipmentProfileProvider> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InheritedWidgetBase<List<EquipmentProfileData>>(
|
||||
return InheritedWidgetBase<List<EquipmentProfile>>(
|
||||
data: [_defaultProfile] + _customProfiles,
|
||||
child: InheritedWidgetBase<EquipmentProfileData>(
|
||||
child: InheritedWidgetBase<EquipmentProfile>(
|
||||
data: _selectedProfile,
|
||||
child: widget.child,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void setProfile(EquipmentProfileData data) {
|
||||
void setProfile(EquipmentProfile data) {
|
||||
setState(() {
|
||||
_selectedId = data.id;
|
||||
});
|
||||
|
@ -69,7 +68,7 @@ class EquipmentProfileProviderState extends State<EquipmentProfileProvider> {
|
|||
/// Creates a default equipment profile
|
||||
void addProfile(String name) {
|
||||
_customProfiles.add(
|
||||
EquipmentProfileData(
|
||||
EquipmentProfile(
|
||||
id: const Uuid().v1(),
|
||||
name: name,
|
||||
apertureValues: ApertureValue.values,
|
||||
|
@ -81,7 +80,7 @@ class EquipmentProfileProviderState extends State<EquipmentProfileProvider> {
|
|||
_refreshSavedProfiles();
|
||||
}
|
||||
|
||||
void updateProdile(EquipmentProfileData data) {
|
||||
void updateProdile(EquipmentProfile data) {
|
||||
final indexToUpdate = _customProfiles.indexWhere((element) => element.id == data.id);
|
||||
if (indexToUpdate >= 0) {
|
||||
_customProfiles[indexToUpdate] = data;
|
||||
|
@ -89,7 +88,7 @@ class EquipmentProfileProviderState extends State<EquipmentProfileProvider> {
|
|||
}
|
||||
}
|
||||
|
||||
void deleteProfile(EquipmentProfileData data) {
|
||||
void deleteProfile(EquipmentProfile data) {
|
||||
_customProfiles.remove(data);
|
||||
_refreshSavedProfiles();
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ class _EquipmentProfilePicker extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AnimatedDialogPicker<EquipmentProfileData>(
|
||||
return AnimatedDialogPicker<EquipmentProfile>(
|
||||
icon: Icons.camera,
|
||||
title: S.of(context).equipmentProfile,
|
||||
selectedValue: context.listen<EquipmentProfile>(),
|
||||
|
|
|
@ -6,7 +6,7 @@ sealed class MeteringEvent {
|
|||
}
|
||||
|
||||
class EquipmentProfileChangedEvent extends MeteringEvent {
|
||||
final EquipmentProfileData equipmentProfileData;
|
||||
final EquipmentProfile 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/metering_screen_layout_config.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/screens/metering/bloc_metering.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';
|
||||
|
||||
class EquipmentProfileContainer extends StatefulWidget {
|
||||
final EquipmentProfileData data;
|
||||
final ValueChanged<EquipmentProfileData> onUpdate;
|
||||
final EquipmentProfile data;
|
||||
final ValueChanged<EquipmentProfile> onUpdate;
|
||||
final VoidCallback onDelete;
|
||||
final VoidCallback onExpand;
|
||||
|
||||
|
@ -27,7 +27,7 @@ class EquipmentProfileContainer extends StatefulWidget {
|
|||
|
||||
class EquipmentProfileContainerState extends State<EquipmentProfileContainer>
|
||||
with TickerProviderStateMixin {
|
||||
late EquipmentProfileData _equipmentData = EquipmentProfileData(
|
||||
late EquipmentProfile _equipmentData = EquipmentProfile(
|
||||
id: widget.data.id,
|
||||
name: widget.data.name,
|
||||
apertureValues: widget.data.apertureValues,
|
||||
|
@ -45,7 +45,7 @@ class EquipmentProfileContainerState extends State<EquipmentProfileContainer>
|
|||
@override
|
||||
void didUpdateWidget(EquipmentProfileContainer oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
_equipmentData = EquipmentProfileData(
|
||||
_equipmentData = EquipmentProfile(
|
||||
id: widget.data.id,
|
||||
name: widget.data.name,
|
||||
apertureValues: widget.data.apertureValues,
|
||||
|
@ -195,7 +195,7 @@ class _AnimatedArrowButton extends AnimatedWidget {
|
|||
}
|
||||
|
||||
class _AnimatedEquipmentListTiles extends AnimatedWidget {
|
||||
final EquipmentProfileData equipmentData;
|
||||
final EquipmentProfile equipmentData;
|
||||
final ValueChanged<List<ApertureValue>> onApertureValuesSelected;
|
||||
final ValueChanged<List<IsoValue>> onIsoValuesSelecred;
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ class EquipmentProfilesListTile extends StatelessWidget {
|
|||
leading: const Icon(Icons.camera),
|
||||
title: Text(S.of(context).equipmentProfiles),
|
||||
onTap: () {
|
||||
Navigator.of(context).push<EquipmentProfileData>(
|
||||
Navigator.of(context).push<EquipmentProfile>(
|
||||
MaterialPageRoute(builder: (_) => const EquipmentProfilesScreen()),
|
||||
);
|
||||
},
|
||||
|
|
|
@ -495,7 +495,7 @@ void main() {
|
|||
group(
|
||||
'`EquipmentProfileChangedEvent`',
|
||||
() {
|
||||
final reducedProfile = EquipmentProfileData(
|
||||
final reducedProfile = EquipmentProfile(
|
||||
id: '0',
|
||||
name: 'Reduced',
|
||||
apertureValues: ApertureValue.values,
|
||||
|
|
Loading…
Reference in a new issue