Giter Site home page Giter Site logo

flutter_camera's Introduction

flutter_camera

Inspired from camera plugin from flutter team, but making support for minSdkVersion 16 (Android)

The plugin still in development

Installing

The lib has not been published to pub.dev

Add to your pubspec.yaml

    dependencies:
        - flutter_camera
            git: "git_url_here"

Android

For android 10 support you must add android:requestLegacyExternalStorage="true" on AndroidManifest.xml

Example:

<application
        ...
        android:requestLegacyExternalStorage="true">

iOS

Not Implemented yet

Hot to Use

import 'package:flutter_camera/flutter_camera.dart';
CameraController _controller;
Future<void> _initializeCompleterFuture;

@override
void initState() {
    _controller = CameraController(
        cameraLens: CameraLens.back,
    );

    _initializeCompleterFuture = _controller.initialize();
    super.initState();
}

@override
void dispose() {
    _controller.dispose();
    super.dispose();
}

@override
Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(title: Text("Camera")),
        body: FutureBuilder<void>(
            future: _initializeCompleterFuture,
            builder: (context, snap) {
                if (snap.connectionState == ConnectionState.done) {
                return CameraPreview(_controller);
                } else {
                return Center(child: CircularProgressIndicator());
                }
            },
        ),
        floatingActionButton: FloatingActionButton(
          onPressed: () async {
            // Take picture
            String path = await _controller.takePickture();
          },
          child: Icon(Icons.camera_alt),
        ),
    );
}

Controller Property

property description default
cameraLens CameraLens.front or CameraLens.rear (optional) CameraLens.back

Todo

  • Add iOS Support
  • Fixing camera not found after closing activity
  • Optimization
  • Android camera rotating to 90deg image flipped
  • ... Later added

flutter_camera's People

Contributors

bigbangfuzion avatar

Stargazers

 avatar

Watchers

Agus Widhiyasa avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.