Need help with camera_awesome?
Click the โ€œchatโ€ button below for chat support from the developer who created it, or find similar developers for support.

About the developer

Apparence-io
167 Stars 21 Forks MIT License 206 Commits 20 Opened issues

Description

A flutter plugin to handle Android / iOS camera

Services available

!
?

Need anything else?

Contributors list

# 366,046
Dart
C++
mobile-...
Flutter
75 commits
# 219,172
Objecti...
iOS
Dart
mobile-...
18 commits

camerawesome_logo

Awesome Flutter Star on Github Star on Github

๐Ÿš€  Overview

Flutter plugin to add Camera support inside your project.

CamerAwesome include a lot of useful features like:

  • ๐Ÿ“ฒ Live camera flip ( switch between rear & front camera without rebuild ).
  • โšก๏ธ No init needed, just add CameraAwesome widget !
  • โŒ›๏ธ Instant focus.
  • ๐Ÿ“ธ Device flash support.
  • ๐ŸŽš Zoom.
  • ๐Ÿ–ผ Fullscreen or SizedBox preview support.
  • ๐ŸŽฎ Complete example.
  • ๐ŸŽž Taking a picture ( of course ๐Ÿ˜ƒ ).
  • ๐ŸŽฅ Video recording (iOS only for now).

๐Ÿง  Live example

Taking photo ๐Ÿ“ธ & record video ๐ŸŽฅ Resolution changing ๐ŸŒ‡
camerawesome_example1
camerawesome_example2

๐Ÿ“–  Installation and usage

Set permissions

  • iOS add these on
    ios/Runner/Info.plist
    file
NSCameraUsageDescription
Your own description

NSMicrophoneUsageDescription To enable microphone access when recording video

  • Android

    • Set permissions before
      
      
    
    
    • Change the minimum SDK version to 21 (or higher) in
      android/app/build.gradle

    minSdkVersion 21
    

Import the package

import 'package:camerawesome/camerawesome_plugin.dart';

Define notifiers (if needed) & controller

ValueNotifier is a useful change notifier from Flutter framework. It fires an event on all listener when value changes. Take a look here for ValueNotifier doc

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State with TickerProviderStateMixin { // [...] // Notifiers ValueNotifier _switchFlash = ValueNotifier(CameraFlashes.NONE); ValueNotifier _sensor = ValueNotifier(Sensors.BACK); ValueNotifier _captureMode = ValueNotifier(CaptureModes.PHOTO); ValueNotifier _photoSize = ValueNotifier(null);

// Controllers PictureController _pictureController = new PictureController(); VideoController _videoController = new VideoController(); // [...] }

If you want to change a config, all you need is setting the value. CameraAwesome will handle the rest.

Examples:

dart
_switchFlash.value = CameraFlashes.AUTO;
_captureMode.value = CaptureModes.VIDEO;

Create your camera

// [...]
@override
  Widget build(BuildContext context) {
    return CameraAwesome(
      testMode: false,
      onPermissionsResult: (bool result) { },
      selectDefaultSize: (List availableSizes) => Size(1920, 1080),
      onCameraStarted: () { },
      onOrientationChanged: (CameraOrientations newOrientation) { },
      zoom: 0.64,
      sensor: _sensor,
      photoSize: _photoSize,
      switchFlashMode: _switchFlash,
      captureMode: _captureMode,
      orientation: DeviceOrientation.portraitUp,
      fitted: true,
    );
  };
// [...]
Reveal parameters list

Param Type Description Required
testMode boolean true to wrap texture
onPermissionsResult OnPermissionsResult implement this to have a callback after CameraAwesome asked for permissions
selectDefaultSize OnAvailableSizes implement this to select a default size from device available size list โœ…
onCameraStarted OnCameraStarted notify client that camera started
onOrientationChanged OnOrientationChanged notify client that orientation changed
switchFlashMode **ValueNotifier**<cameraflashes> change flash mode
zoom ValueNotifier<double> Zoom from native side. Must be between 0 and 1
sensor ValueNotifier<sensors> sensor to initiate BACK or FRONT โœ…
photoSize ValueNotifier<size> choose your photo size from the [selectDefaultSize] method
captureMode ValueNotifier<capturemodes> choose capture mode between PHOTO or VIDEO
orientation DeviceOrientation initial orientation
fitted bool whether camera preview must be as big as it needs or cropped to fill with. false by default
imagesStreamBuilder Function returns an imageStream when camera has started preview

Photo ๐ŸŽž

Take a photo ๐Ÿ“ธ

await _pictureController.takePicture('THE_IMAGE_PATH/myimage.jpg');

Video ๐ŸŽฅ

Record a video ๐Ÿ“ฝ

await _videoController.recordVideo('THE_IMAGE_PATH/myvideo.mp4');

Stop recording video ๐Ÿ“

await _videoController.stopRecordingVideo();

๐Ÿ“ก  Live image stream

The property imagesStreamBuilder allows you to get an imageStream once the camera is ready. Don't try to show all these images on Flutter UI as you won't have time to refresh UI fast enough. (there is too much images/sec).

CameraAwesome(
    ...
    imagesStreamBuilder: (imageStream) {
        /// listen for images preview stream
        /// you can use it to process AI recognition or anything else...
        print('-- init CamerAwesome images stream');
    },
)

๐Ÿ“ฑ  Tested devices

CamerAwesome was developed to support most devices on the market but some feature can't be fully functional. You can check if your device support all feature by clicking bellow.

Feel free to contribute to improve this compatibility list.

Reveal grid

Devices Flash Focus Zoom Flip
iPhone X โœ… โœ… โœ… โœ…
iPhone 7 โœ… โœ… โœ… โœ…
One Plus 6T โœ… โœ… โœ… โœ…
Xiaomi redmi โœ… โœ… โœ… โœ…
Honor 7 โœ… โœ… โœ… โœ…

๐ŸŽฏ  Our goals

Feel free to help by submitting PR !

  • [ ] ๐ŸŽฅ Record video (partially, iOS only)
  • [ ] ๐ŸŒ  Focus on specific point
  • [x] ~~๐Ÿ“ก Broadcast live image stream~~
  • [x] ~~๐ŸŒค Exposure level~~
  • [x] ~~โœ… Add e2e tests~~
  • [x] ~~๐Ÿ–ผ Fullscreen/SizedBox support~~
  • [x] ~~๐ŸŽฎ Complete example~~
  • [x] ~~๐ŸŽž Take a picture~~
  • [x] ~~๐ŸŽš Zoom level~~
  • [x] ~~๐Ÿ“ฒ Live switching camera~~
  • [x] ~~๐Ÿ“ธ Device flash support~~
  • [x] ~~โŒ›๏ธ Auto focus~~

๐Ÿ“ฃ  Sponsor


Initiated and sponsored by Apparence.io.

๐Ÿ‘ฅ  Contribution

Contributions are welcome. Contribute by creating a PR or create an issue ๐ŸŽ‰.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.