Kategorien, Pakete und Repositories suchen

GitHub-RepositoryDestiny-Ed/flutter_camera

flutter_camera

Ein Flutter-Plugin für iOS und Android, das den Zugriff auf die Gerätekameras und die Videoaufnahme ermöglicht

Projektcover von flutter_camera
Sterne
5
Forks
6
Letzter Push (UTC)
14.08.2023
Projektstatus
Aktiv

Original-README

Englischer Projektschnappschuss. Aktuelle Inhalte auf GitHub.

Flutter Camera

pub package

A Flutter plugin for iOS and Android allowing access to the device cameras and recording of videos.

Note: This plugin is still under development, and some APIs might not be available yet. We are working on a refactor which can be followed here: issue

This package fully depends on flutter camera plugin to provide access to camera.

It only supports Android and IOS for now

Features

  • Display live camera preview in a widget.
  • Snapshots can be captured and path is returned.
  • Device flash light support.
  • Record video from camera.
  • Add access to the image stream from Dart.
  • Live camera flip ( switch between rear & front camera with a click ).
  • Only 3 lines of code

Installation

First, add flutter_camera as a dependency in your pubspec.yaml file.

iOS

The camera plugin functionality works on iOS 10.0 or higher. If compiling for any version lower than 10.0, make sure to programmatically check the version of iOS running on the device before using any camera plugin features. The device_info_plus plugin, for example, can be used to check the iOS version.

Add two rows to the ios/Runner/Info.plist:

  • one with the key Privacy - Camera Usage Description and a usage description.
  • and one with the key Privacy - Microphone Usage Description and a usage description.

Or in text format add the key:

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

Change the minimum Android sdk version to 21 (or higher) in your android/app/build.gradle file.

minSdkVersion 21
Example

Here is a small example flutter app displaying a full screen camera preview with video recording.

import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_camera/flutter_camera.dart';

class CameraPage extends StatefulWidget {
  const CameraPage({Key? key}) : super(key: key);

  @override
  _CameraPageState createState() => _CameraPageState();
}

class _CameraPageState extends State<CameraPage> {
  @override
  Widget build(BuildContext context) {
    return FlutterCamera(
      color: Colors.amber,
      onImageCaptured: (value) {
        final path = value.path;
        print("::::::::::::::::::::::::::::::::: $path");
        if (path.contains('.jpg')) {
          showDialog(
              context: context,
              builder: (context) {
                return AlertDialog(
                  content: Image.file(File(path)),
                );
              });
        }
      },
      onVideoRecorded: (value) {
        final path = value.path;
        print('::::::::::::::::::::::::;; dkdkkd $path');
        ///Show video preview .mp4
      },
    );
    // return Container();
  }
}

Destiny Ed GitHub avatar
GitHub-Autor

Destiny Ed ↗

Senior Flutter Engineer • Mobile & Product Engineer

SprachenDart

Von diesem Repository veröffentlichte Pakete

Verwendete Abhängigkeiten

Abhängigkeiten 4 Einträge

  • flutter{"sdk":"flutter"}
  • camera^0.10.5+3
  • flutter_testEntwicklung{"sdk":"flutter"}
  • flutter_lintsEntwicklung^1.0.0

Wie wähle ich ein passendes Repository?

Nach Anwendungsfall filtern, Aktivität vergleichen und vor der Nutzung das Originalprojekt prüfen.

  1. Nach Name, Autor oder Beschreibung suchen und nach Thema eingrenzen.
  2. Sterne, Forks und letzte Pushes vergleichen. Sterne zeigen Interesse, garantieren aber keine Qualität.
  3. Vor der Nutzung README, Lizenz und Issues auf GitHub prüfen.

Quellen und Pflege

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗