mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-21 23:10:40 +00:00
filter equipment profile update/delete
This commit is contained in:
parent
21c1d94af7
commit
ce4af92b4d
7 changed files with 9 additions and 24 deletions
|
@ -63,12 +63,18 @@ class EquipmentProfileProviderState extends State<EquipmentProfileProvider> {
|
|||
final indexToUpdate = _profiles.indexWhere((element) => element.id == data.id);
|
||||
if (indexToUpdate >= 0) {
|
||||
_profiles[indexToUpdate] = data;
|
||||
if (data.id == _selectedProfile.id) {
|
||||
_selectedProfile = _profiles[indexToUpdate];
|
||||
}
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
|
||||
void deleteProfile(EquipmentProfileData data) {
|
||||
_profiles.remove(data);
|
||||
if (data.id == _selectedProfile.id) {
|
||||
_selectedProfile = _profiles.first;
|
||||
}
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import 'bloc_container_camera.dart';
|
|||
import 'widget_container_camera.dart';
|
||||
|
||||
class CameraContainerProvider extends StatelessWidget {
|
||||
final ValueChanged<EquipmentProfileData> onEquipmentProfileChanged;
|
||||
final ExposurePair? fastest;
|
||||
final ExposurePair? slowest;
|
||||
final IsoValue iso;
|
||||
|
@ -20,7 +19,6 @@ class CameraContainerProvider extends StatelessWidget {
|
|||
final List<ExposurePair> exposurePairs;
|
||||
|
||||
const CameraContainerProvider({
|
||||
required this.onEquipmentProfileChanged,
|
||||
required this.fastest,
|
||||
required this.slowest,
|
||||
required this.iso,
|
||||
|
@ -40,7 +38,6 @@ class CameraContainerProvider extends StatelessWidget {
|
|||
context.read<MeteringCommunicationBloc>(),
|
||||
),
|
||||
child: CameraContainer(
|
||||
onEquipmentProfileChanged: onEquipmentProfileChanged,
|
||||
fastest: fastest,
|
||||
slowest: slowest,
|
||||
isoValues: EquipmentProfile.of(context)?.isoValues ?? isoValues,
|
||||
|
|
|
@ -19,7 +19,6 @@ import 'event_container_camera.dart';
|
|||
import 'state_container_camera.dart';
|
||||
|
||||
class CameraContainer extends StatelessWidget {
|
||||
final ValueChanged<EquipmentProfileData> onEquipmentProfileChanged;
|
||||
final ExposurePair? fastest;
|
||||
final ExposurePair? slowest;
|
||||
final List<IsoValue> isoValues;
|
||||
|
@ -31,7 +30,6 @@ class CameraContainer extends StatelessWidget {
|
|||
final List<ExposurePair> exposurePairs;
|
||||
|
||||
const CameraContainer({
|
||||
required this.onEquipmentProfileChanged,
|
||||
required this.fastest,
|
||||
required this.slowest,
|
||||
required this.isoValues,
|
||||
|
@ -60,7 +58,6 @@ class CameraContainer extends StatelessWidget {
|
|||
children: [
|
||||
MeteringTopBar(
|
||||
readingsContainer: ReadingsContainer(
|
||||
onEquipmentProfileChanged: onEquipmentProfileChanged,
|
||||
fastest: fastest,
|
||||
slowest: slowest,
|
||||
isoValues: isoValues,
|
||||
|
|
|
@ -10,7 +10,6 @@ import 'bloc_container_light_sensor.dart';
|
|||
import 'widget_container_light_sensor.dart';
|
||||
|
||||
class LightSensorContainerProvider extends StatelessWidget {
|
||||
final ValueChanged<EquipmentProfileData> onEquipmentProfileChanged;
|
||||
final ExposurePair? fastest;
|
||||
final ExposurePair? slowest;
|
||||
final IsoValue iso;
|
||||
|
@ -20,7 +19,6 @@ class LightSensorContainerProvider extends StatelessWidget {
|
|||
final List<ExposurePair> exposurePairs;
|
||||
|
||||
const LightSensorContainerProvider({
|
||||
required this.onEquipmentProfileChanged,
|
||||
required this.fastest,
|
||||
required this.slowest,
|
||||
required this.iso,
|
||||
|
@ -40,7 +38,6 @@ class LightSensorContainerProvider extends StatelessWidget {
|
|||
context.read<MeteringCommunicationBloc>(),
|
||||
),
|
||||
child: LightSensorContainer(
|
||||
onEquipmentProfileChanged: onEquipmentProfileChanged,
|
||||
fastest: fastest,
|
||||
slowest: slowest,
|
||||
isoValues: EquipmentProfile.of(context)?.isoValues ?? isoValues,
|
||||
|
|
|
@ -7,7 +7,6 @@ import 'package:lightmeter/screens/metering/components/shared/readings_container
|
|||
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
||||
|
||||
class LightSensorContainer extends StatelessWidget {
|
||||
final ValueChanged<EquipmentProfileData> onEquipmentProfileChanged;
|
||||
final ExposurePair? fastest;
|
||||
final ExposurePair? slowest;
|
||||
final List<IsoValue> isoValues;
|
||||
|
@ -19,7 +18,6 @@ class LightSensorContainer extends StatelessWidget {
|
|||
final List<ExposurePair> exposurePairs;
|
||||
|
||||
const LightSensorContainer({
|
||||
required this.onEquipmentProfileChanged,
|
||||
required this.fastest,
|
||||
required this.slowest,
|
||||
required this.isoValues,
|
||||
|
@ -38,7 +36,6 @@ class LightSensorContainer extends StatelessWidget {
|
|||
children: [
|
||||
MeteringTopBar(
|
||||
readingsContainer: ReadingsContainer(
|
||||
onEquipmentProfileChanged: onEquipmentProfileChanged,
|
||||
fastest: fastest,
|
||||
slowest: slowest,
|
||||
isoValues: isoValues,
|
||||
|
|
|
@ -10,7 +10,6 @@ import 'components/reading_value_container/widget_container_reading_value.dart';
|
|||
|
||||
/// Contains a column of fastest & slowest exposure pairs + a row of ISO and ND pickers
|
||||
class ReadingsContainer extends StatelessWidget {
|
||||
final ValueChanged<EquipmentProfileData> onEquipmentProfileChanged;
|
||||
final ExposurePair? fastest;
|
||||
final ExposurePair? slowest;
|
||||
final List<IsoValue> isoValues;
|
||||
|
@ -21,7 +20,6 @@ class ReadingsContainer extends StatelessWidget {
|
|||
final ValueChanged<NdValue> onNdChanged;
|
||||
|
||||
const ReadingsContainer({
|
||||
required this.onEquipmentProfileChanged,
|
||||
required this.fastest,
|
||||
required this.slowest,
|
||||
required this.isoValues,
|
||||
|
@ -43,10 +41,7 @@ class ReadingsContainer extends StatelessWidget {
|
|||
_EquipmentProfilePicker(
|
||||
selectedValue: EquipmentProfile.of(context)!,
|
||||
values: EquipmentProfiles.of(context)!,
|
||||
onChanged: (value) {
|
||||
EquipmentProfileProvider.of(context).setProfile(value);
|
||||
onEquipmentProfileChanged(value);
|
||||
},
|
||||
onChanged: EquipmentProfileProvider.of(context).setProfile,
|
||||
),
|
||||
const _InnerPadding(),
|
||||
],
|
||||
|
|
|
@ -3,6 +3,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
|||
import 'package:lightmeter/data/models/ev_source_type.dart';
|
||||
import 'package:lightmeter/data/models/exposure_pair.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:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
||||
|
||||
|
@ -26,6 +27,7 @@ class _MeteringScreenState extends State<MeteringScreen> {
|
|||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
_bloc.add(EquipmentProfileChangedEvent(EquipmentProfile.of(context)!));
|
||||
_bloc.add(StopTypeChangedEvent(context.watch<StopType>()));
|
||||
}
|
||||
|
||||
|
@ -40,8 +42,6 @@ class _MeteringScreenState extends State<MeteringScreen> {
|
|||
buildWhen: (_, current) => current is MeteringDataState,
|
||||
builder: (_, state) => state is MeteringDataState
|
||||
? _MeteringContainerBuidler(
|
||||
onEquipmentProfileChanged: (value) =>
|
||||
_bloc.add(EquipmentProfileChangedEvent(value)),
|
||||
fastest: state.fastest,
|
||||
slowest: state.slowest,
|
||||
iso: state.iso,
|
||||
|
@ -71,7 +71,6 @@ class _MeteringScreenState extends State<MeteringScreen> {
|
|||
}
|
||||
|
||||
class _MeteringContainerBuidler extends StatelessWidget {
|
||||
final ValueChanged<EquipmentProfileData> onEquipmentProfileChanged;
|
||||
final ExposurePair? fastest;
|
||||
final ExposurePair? slowest;
|
||||
final IsoValue iso;
|
||||
|
@ -81,7 +80,6 @@ class _MeteringContainerBuidler extends StatelessWidget {
|
|||
final List<ExposurePair> exposurePairs;
|
||||
|
||||
const _MeteringContainerBuidler({
|
||||
required this.onEquipmentProfileChanged,
|
||||
required this.fastest,
|
||||
required this.slowest,
|
||||
required this.iso,
|
||||
|
@ -95,7 +93,6 @@ class _MeteringContainerBuidler extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
return context.watch<EvSourceType>() == EvSourceType.camera
|
||||
? CameraContainerProvider(
|
||||
onEquipmentProfileChanged: onEquipmentProfileChanged,
|
||||
fastest: fastest,
|
||||
slowest: slowest,
|
||||
iso: iso,
|
||||
|
@ -105,7 +102,6 @@ class _MeteringContainerBuidler extends StatelessWidget {
|
|||
exposurePairs: exposurePairs,
|
||||
)
|
||||
: LightSensorContainerProvider(
|
||||
onEquipmentProfileChanged: onEquipmentProfileChanged,
|
||||
fastest: fastest,
|
||||
slowest: slowest,
|
||||
iso: iso,
|
||||
|
|
Loading…
Reference in a new issue