Apparence-io / CamerAwesome

📸 Embedding a camera experience within your own app shouldn't be that hard. A flutter plugin to integrate awesome Android / iOS camera experience.
https://ApparenceKit.dev
MIT License
977 stars 259 forks source link

Exception: "type 'int' is not a subtype of type 'double?' in type cast" in awesome_zoom_selector #534

Open Umair-Syed opened 2 days ago

Umair-Syed commented 2 days ago

Steps to Reproduce

In iPhone 15 (iOS 18.1) open CameraAwesomeBuilder.awesome with AwesomeZoomSelector

Expected results

Camera should work without any crash

Actual results

Exception: type 'int' is not a subtype of type 'double?' in type cast. This leads to line minZoom = await CamerawesomePlugin.getMinZoom(); in awesome_zoom_selector.dart

About your device

Brand Model OS
Apple iPhone 15 18.1

Your flutter version

flutter --version Flutter 3.24.4 • channel stable • https://github.com/flutter/flutter.git Framework • revision 603104015d (3 weeks ago) • 2024-10-24 08:01:25 -0700 Engine • revision db49896cf2 Tools • Dart 3.5.4 • DevTools 2.37.3

Umair-Syed commented 2 days ago

Here is my implementation of awesomeCamera

@override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Take a Picture')),
      body: CameraAwesomeBuilder.awesome(
        saveConfig: SaveConfig.photo(),
        topActionsBuilder: (state) {
          return AwesomeFlashButton(
            state: state,
          );
        },
        middleContentBuilder: (state) {
          return Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              const Spacer(),
              AwesomeZoomSelector(state: state),
              const SizedBox(height: 16)
            ],
          );
        },
        bottomActionsBuilder: (state) {
          state.captureState$.listen((mediaCapture) async {
            if (MediaCaptureStatus.success == mediaCapture?.status) {
              try {
                final croppedImageFuture = _cropImage(
                  mediaCapture!.captureRequest.path!,
                  context,
                );
                if (context.mounted) {
                  context.pop(croppedImageFuture);
                }
              } catch (e) {
                logError('Error taking picture: $e');
              }
            }
          });

          return Padding(
            padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
            child: TripleRail(
              leading: AwesomeCameraSwitchButton(state: state),
              middle: AwesomeCaptureButton(state: state),
            ),
          );
        },
      ),
    );
  }