mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-22 07:20:39 +00:00
Fixed EquipmentProfileListener
This commit is contained in:
parent
154fd9c56d
commit
88ec733596
4 changed files with 34 additions and 2 deletions
|
@ -48,6 +48,8 @@ m3_lightmeter_iap:
|
|||
```
|
||||
After that run `flutter pub get` as usual.
|
||||
|
||||
For the first run it will be necessary to open _iap/_ folder and run `flutter pub get` from there.
|
||||
|
||||
# Contribution
|
||||
|
||||
To report a bug or suggest a new feature open a new [issue](https://github.com/vodemn/m3_lightmeter/issues).
|
||||
|
|
|
@ -23,4 +23,3 @@ dev_dependencies:
|
|||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import 'package:lightmeter/screens/metering/components/camera_container/provider
|
|||
import 'package:lightmeter/screens/metering/components/light_sensor_container/provider_container_light_sensor.dart';
|
||||
import 'package:lightmeter/screens/metering/event_metering.dart';
|
||||
import 'package:lightmeter/screens/metering/state_metering.dart';
|
||||
import 'package:lightmeter/screens/metering/utils/equipment_profile_listener.dart';
|
||||
import 'package:lightmeter/utils/inherited_generics.dart';
|
||||
import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart';
|
||||
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
||||
|
@ -73,7 +74,7 @@ class _InheritedListeners extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InheritedWidgetListener<EquipmentProfile>(
|
||||
return EquipmentProfileListener(
|
||||
onDidChangeDependencies: (value) {
|
||||
context.read<MeteringBloc>().add(EquipmentProfileChangedEvent(value));
|
||||
},
|
||||
|
|
30
lib/screens/metering/utils/equipment_profile_listener.dart
Normal file
30
lib/screens/metering/utils/equipment_profile_listener.dart
Normal file
|
@ -0,0 +1,30 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart';
|
||||
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
||||
|
||||
class EquipmentProfileListener extends StatefulWidget {
|
||||
final ValueChanged<EquipmentProfile> onDidChangeDependencies;
|
||||
final Widget child;
|
||||
|
||||
const EquipmentProfileListener({
|
||||
required this.onDidChangeDependencies,
|
||||
required this.child,
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
State<EquipmentProfileListener> createState() => _EquipmentProfileListenerState();
|
||||
}
|
||||
|
||||
class _EquipmentProfileListenerState extends State<EquipmentProfileListener> {
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
widget.onDidChangeDependencies(EquipmentProfiles.selectedOf(context));
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return widget.child;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue