manual_camera_view 0.1.1 copy "manual_camera_view: ^0.1.1" to clipboard
manual_camera_view: ^0.1.1 copied to clipboard

A lightweight Flutter plugin for embedding a native camera preview with tap focus, normalized exposure control, and JPEG capture.

manual_camera_view #

A lightweight Flutter plugin for embedding a native camera preview inside a Flutter screen.

Features #

  • Embed a native camera preview with ManualCameraView
  • Tap the preview to focus and meter exposure
  • Adjust brightness with setNormalizedExposure(-1.0 ~ 1.0)
  • Set JPEG quality with setImageQuality(1~100)
  • Capture a photo and receive JPEG bytes as Uint8List
  • Use the same Dart API on Android and iOS

Use Cases #

This plugin is a good fit when you want to:

  • place a native camera preview directly in a Flutter page
  • build custom Flutter capture buttons, sliders, and overlays
  • upload, save, compress, or display captured bytes in your own app flow

Installation #

Add the package to your Flutter project:

dependencies:
  manual_camera_view: ^0.1.0

Then run:

flutter pub get

For local development inside this repository, the example app can keep the path dependency as path: ../.

Permissions #

Android #

Add camera permission to AndroidManifest.xml:

<uses-permission android:name="android.permission.CAMERA" />

iOS #

Add a camera usage description to Info.plist:

<key>NSCameraUsageDescription</key>
<string>This app needs camera access to capture photos.</string>

Basic Usage #

Import the package:

import 'package:manual_camera_view/manual_camera.dart';

Create a ManualCameraController and pass it to ManualCameraView:

final ManualCameraController controller = ManualCameraController();

ManualCameraView(
  controller: controller,
  onViewCreated: () {
    debugPrint('camera view ready');
  },
)

Notes:

  • The controller must be owned by your Flutter widget
  • The controller is ready only after onViewCreated is called
  • Calling capture or exposure APIs too early throws a StateError

Exposure #

Slider(
  min: -1.0,
  max: 1.0,
  value: _exposure,
  onChanged: (value) {
    setState(() => _exposure = value);
    _controller.setNormalizedExposure(value);
  },
)
  • -1.0: darker
  • 0.0: default exposure
  • 1.0: brighter

Tap To Focus #

ManualCameraView supports tap to focus out of the box. You can also call:

await _controller.setFocusPoint(0.5, 0.5);

Capture #

await _controller.setImageQuality(90);
final bytes = await _controller.takePicture();
debugPrint('image bytes: ${bytes.length}');

The returned value is a JPEG Uint8List that you can upload, save, or display.

Example #

A complete runnable example is available in example/lib/main.dart.

Public API #

  • ManualCameraController.isReady
  • ManualCameraController.setNormalizedExposure()
  • ManualCameraController.setImageQuality()
  • ManualCameraController.setFocusPoint()
  • ManualCameraController.takePicture()
  • ManualCameraView

Notes #

  • Android and iOS use different native implementations, but the Dart API stays consistent
  • takePicture() returns in-memory JPEG bytes instead of a file path
  • Saving to the photo library, uploading, and post-processing are handled by your app
0
likes
135
points
9
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A lightweight Flutter plugin for embedding a native camera preview with tap focus, normalized exposure control, and JPEG capture.

Repository (GitHub)
View/report issues

Topics

#camera #flutter-plugin #platform-view

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on manual_camera_view

Packages that implement manual_camera_view