open_camera 0.0.2

  • Readme
  • Changelog
  • Example
  • Installing
  • new53

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.

Installation #

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

Android #

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" />

IOS #

In IOS it is necessary to edit the following files.

ios/PodFile

Change the line by uncommenting and changing the minimum version in the ios/PodFile.

platform :ios, '10.0'

ios/Runner/Info.plist

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 #

Settings #

var settings = CameraSettings(
  limitRecord: 15,
  useCompression: true,
  resolutionPreset: ResolutionPreset.ultraHigh
);

ParameterTypeDescription
limitRecordintRecording time limit in seconds.
useCompressionboolWhether the plugin should compress the photo or video before returning
resolutionPresetenumCamera 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,
                              ),
                            );

Authors.

Diogo Luiz Ponce (dlponce@gmail.com) / Joelson Santos Cunha (contato@joecorp.com.br)

0.0.1 #

  • TODO: Describe initial release.

example/README.md

open_camera_example #

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:

with Flutter:


$ 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:


import 'package:open_camera/open_camera.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
16
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
53
Learn more about scoring.

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

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/src/preview_video.dart. (-1.99 points)

Analysis of 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.

Fix lib/src/open_camera_widget.dart. (-0.50 points)

Analysis of 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 (photo_view).

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.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
auto_orientation ^1.0.5 1.0.5
camera ^0.5.4+2 0.5.6+1
flutter 0.0.0
flutter_image_compress ^0.6.3 0.6.3
image_gallery_saver ^1.2.2 1.2.2
native_device_orientation ^0.2.0 0.2.0
path_provider ^1.1.2 1.4.0
permission_handler ^3.2.0 3.3.0
photo_view ^0.4.2 0.4.2 0.6.0
video_player ^0.10.2+1 0.10.2+5
Transitive dependencies
after_layout 1.0.7+2
collection 1.14.11 1.14.12
meta 1.1.7
platform 2.2.1
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test