camera_camera 1.0.31

  • Readme
  • Changelog
  • Example
  • Installing
  • 93

Camera_Camera #

That is plugin contains native access camera your device, Android and iOS. You can take a photo or record video. Return file.

Android #

You need add in AndroidManifest.xml

<activity
android:name="com.yalantis.ucrop.UCropActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>

You need add in app/build.gradle

minSdkVersion 21

IOS #

You need add in info.plist

    	<key>NSCameraUsageDescription</key>
      <string>Can I use the camera please?</string>
      <key>NSMicrophoneUsageDescription</key>
      <string>Can I use the mic please?</string>

Mode Photo #

Enable Photo #


Camera(
 orientationEnablePhoto: CameraOrientation.landscape,)

Camera(
 orientationEnablePhoto: CameraOrientation.portrait,)

Camera(
 orientationEnablePhoto: CameraOrientation.all,) // isDefault

Mask Camera #

You can add widget top stack camera, Container, Images.png.


Camera(
 imageMask: Widget
)

Screen Mode #


Camera(
 
 mode: CameraMode.normal or CameraMode.fullscreen
)

Mode Focus #

You can add Rectangle , Circle or Square Focus

Camera(
       mode: CameraMode.normal,
      imageMask: CameraFocus.rectangle(
                color: Colors.black.withOpacity(0.5),
                ),
     )

You can take a photo and edit.


yourFunction () async {

File file = await  Navigator.push(context, MaterialPageRoute(builder: (context) => Camera()));

})

Other mode getFile #


Camera(
  onFile: (File file) => file;
)

Mode Video #

You cand record video and preview.


yourFunction () async {

File file = await  Navigator.push(context, MaterialPageRoute(builder: (context) => Video()));

})

Installation #

Add package in pubspec.yaml


camera_camera: current_version

Usage #

Import this in your page


import  'package:camera_camera/camera_camera.dart';

Contributing #

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License #

MIT

1.0.31 #

  • Add site

1.0.30 #

  • Fix Error when using CameraMode.normal

1.0.29 #

  • Format Files.

1.0.28 #

  • Migrate to AndroidX.

1.0.26 #

  • Migrate from screen to wakelock.

1.0.24 #

  • Update interval for use path_provider

example/lib/main.dart

import 'dart:io';

import 'package:flutter/material.dart';
import 'package:camera_camera/camera_camera.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: HomeScreen(),
    );
  }
}

class HomeScreen extends StatefulWidget {
  @override
  _HomeScreenState createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {
  File val;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(title: Text("Rully")),
        floatingActionButton: FloatingActionButton(
            child: Icon(Icons.camera_alt),
            onPressed: () async {
              val = await showDialog(
                  context: context,
                  builder: (context) => Camera(
                        mode: CameraMode.normal,
                        orientationEnablePhoto: CameraOrientation.landscape,
                        /*
                        imageMask: CameraFocus.square(
                          color: Colors.black.withOpacity(0.5),
                        ),
                        */
                      ));
              setState(() {});
            }),
        body: Center(
            child: Container(
                height: MediaQuery.of(context).size.height * 0.7,
                width: MediaQuery.of(context).size.width * 0.8,
                child: val != null
                    ? Image.file(
                        val,
                        fit: BoxFit.contain,
                      )
                    : Text("Tire a foto"))));
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  camera_camera: ^1.0.31

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:camera_camera/camera_camera.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
86
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
93
Learn more about scoring.

We analyzed this package on Mar 27, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.2 <3.0.0
camera ^0.5.7+2 0.5.7+4
flutter 0.0.0
native_device_orientation ^0.3.0 0.3.0
path_provider ^1.5.1 1.6.5
rxdart ^0.23.1 0.23.1 0.24.0-dev.1
video_player ^0.10.5 0.10.8+1
wakelock ^0.1.3+3 0.1.4+1
Transitive dependencies
collection 1.14.11 1.14.12
flutter_web_plugins 0.0.0
meta 1.1.8
path_provider_macos 0.0.4
path_provider_platform_interface 1.0.1
platform 2.2.1
plugin_platform_interface 1.0.2
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
video_player_platform_interface 1.0.5
video_player_web 0.1.2+1
Dev dependencies
flutter_test