Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

camera_awesome

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
<key>nscamerausagedescription</key>
<string>your own description</string>

<key>nsmicrophoneusagedescription</key>
<string>to enable microphone access when recording video</string>
  • android
    • set permissions before <application>
    <uses-permission android:name="android.permission.camera" />
    <uses-permission android:name="android.permission.write_external_storage" />
    
    • 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<myapp> with tickerproviderstatemixin {
  // [...]
  // notifiers
  valuenotifier<cameraflashes> _switchflash = valuenotifier(cameraflashes.none);
  valuenotifier<sensors> _sensor = valuenotifier(sensors.back);
  valuenotifier<capturemodes> _capturemode = valuenotifier(capturemodes.photo);
  valuenotifier<size> _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:

_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<size> availablesizes) => size(1920, 1080),
      oncamerastarted: () { },
      onorientationchanged: (cameraorientations neworientation) { },
      zoom: 0.64,
      sensor: _sensor,
      photosize: _photosize,
      switchflashmode: _switchflash,
      capturemode: _capturemode,
      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
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 5s
iphone x
iphone 7
iphone 12 pro
iphone se (2nd gen)
one plus 6t
xiaomi redmi
honor 7
sony xperia xz f8331
pixel 4
galaxy s7
lg k50s

��  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

Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Comments are closed.