Open Camera #
Open Camera is a flutter plugin, very light, nice and intuitive, which adds to your application the ability to take photos and record videos.
Get started #
It is very easy to use the plugin Open Camera in your project, it was thought to be like this ;)
For Android systems the minimum version of SDK is 24 and IOS minimum version is 10.0.
Installing the plugin in your application is very simple, add in your file pubspec.yaml the plugin reference OpenCamera.
dependencies: open_camera: ^0.0.1 flutter: sdk: flutter
In the AndroidManifest.xml file add the following permissions.
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.CAMERA" android:required="true" /> <uses-permission android:name="android.permission.RECORD_AUDIO" android:required="true" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:required="true" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:required="true" />
In IOS it is necessary to edit the following files.
Change the line by uncommenting and changing the minimum version in the ios/PodFile.
platform :ios, '10.0'
In the Info.plist file add the following permissions.
<key>NSCameraUsageDescription</key> <string>Can I use the camera please?</string> <key>NSMicrophoneUsageDescription</key> <string>Can I use the mic please?</string> <key>NSPhotoLibraryAddUsageDescription</key> <string>Camera App would like to save photos from the app to your gallery</string> <key>NSPhotoLibraryUsageDescription</key> <string>Camera App would like to access your photo gallery for uploading images to the app</string> <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> </dict>
How to use #
var settings = CameraSettings( limitRecord: 15, useCompression: true, resolutionPreset: ResolutionPreset.ultraHigh );
|limitRecord||int||Recording time limit in seconds.|
|useCompression||bool||Whether the plugin should compress the photo or video before returning|
|resolutionPreset||enum||Camera resolution quality|
Taking a picture #
File file = await openCamera( context, CameraMode.Photo, cameraSettings: CameraSettings( useCompression: true, resolutionPreset: ResolutionPreset.ultraHigh, ), );
Recording a video #
File file = await openCamera(context, CameraMode.Video, cameraSettings: CameraSettings( limitRecord: 15, useCompression: true, resolutionPreset: ResolutionPreset.ultraHigh, ), );
Diogo Luiz Ponce (firstname.lastname@example.org) / Joelson Santos Cunha (email@example.com)
- TODO: Describe initial release.
Demonstrates how to use the open_camera plugin.
Getting Started #
This project is a starting point for a Flutter application.
A few resources to get you started if this is your first Flutter project:
For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.
Use this package as a library
1. Depend on it
Add this to your package's pubspec.yaml file:
dependencies: open_camera: ^0.0.2
2. Install it
You can install packages from the command line:
$ flutter pub get
Alternatively, your editor might support
flutter pub get.
Check the docs for your editor to learn more.
3. Import it
Now in your Dart code, you can use:
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
We analyzed this package on Oct 21, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
- Dart: 2.5.1
- pana: 0.12.21
- Flutter: 1.9.1+hotfix.4
Detected platforms: Flutter
References Flutter, and has no conflicting libraries.
lib/src/preview_video.dart. (-1.99 points)
lib/src/preview_video.dart reported 4 hints:
line 352 col 23: The member 'notifyListeners' can only be used within instance members of subclasses of 'package:flutter/src/foundation/change_notifier.dart'.
line 352 col 23: The member 'notifyListeners' can only be used within 'package:flutter/src/foundation/change_notifier.dart' or a test.
line 391 col 17: The member 'notifyListeners' can only be used within instance members of subclasses of 'package:flutter/src/foundation/change_notifier.dart'.
line 391 col 17: The member 'notifyListeners' can only be used within 'package:flutter/src/foundation/change_notifier.dart' or a test.
lib/src/open_camera_widget.dart. (-0.50 points)
lib/src/open_camera_widget.dart reported 1 hint:
line 642 col 18: The declaration '_invalidOrientation' isn't referenced.
Maintenance issues and suggestions
Support latest dependencies. (-10 points)
The version constraint in
pubspec.yaml does not support the latest published versions for 1 dependency (
Package is pre-v0.1 release. (-10 points)
While nothing is inherently wrong with versions of
0.0.*, it might mean that the author is still experimenting with the general direction of the API.
|Dart SDK||>=2.1.0 <3.0.0|