Closed Zazo032 closed 1 year ago
Hello, thank you for reporting this! We might make the documentation more clear about this, but what you need to do is listen to the sensorConfig as well. The stream of the current sensorConfig is accessible by appending a $ to the end of the sensorConfig (sensorConfig$). This is how the built-in Flash button works:
StreamBuilder<SensorConfig>(
stream: state.sensorConfig$,
builder: (_, sensorConfigSnapshot) {
if (!sensorConfigSnapshot.hasData) {
return SizedBox();
}
final sensorConfig = sensorConfigSnapshot.requireData;
return StreamBuilder<FlashMode>(
stream: sensorConfig.flashMode$,
builder: (context, snapshot) {
// return your icon
},
);
},
);
You should work with the sensorConfig$ if you want to get their updates.
StreamBuilder<SensorConfig>
throws an error because it seems like SensorConfig
class is not exposed
Similar thing happens to CameraPreviewFit
, seems like there are a few hidden but required APIs:
As a workaround, you can import:
import 'package:camerawesome/src/layouts/awesome/widgets/awesome_camera_preview.dart';
But the following linter gets triggered: https://dart-lang.github.io/linter/lints/implementation_imports.html
I'll make a PR to expose these, you're right.
Classes should be exposed on master
now.
I'm closing the issue, feel free to open a new one if something else is missing. 👌
Steps to Reproduce
Run this small sample:
Expected results
After tapping the
IconButton
,state.sensorConfig.switchCameraFlash
gets called and a newFlashMode
should be available instate.sensorConfig.flashMode
. Also happens withstate.sensorConfig.sensor
after callingstate.switchCameraSensor
Actual results
builder
method is not called, so Icons are not updated.About your device
Using latest version of the repo:
Using Flutter version
3.3.10
.