Plugin to cut a portion of a picture from the camera

Overview

mask_for_camera_view

Plugin to cut a portion of a picture from the camera.

Getting Started

This plugin works on Android & iOS. Used to crop an image from the camera section. Without any hassle, just use the BoxInCamera class to get a picture from its onTake(Uint8List) function.

Example App
example app

How to use dotted border
example app

MaskForCameraView(
  visiblePopButton: false,
  onTake: (Uint8List imageBytes) {
    // imageBytes is croped image, you can use it.
  }
);

How to use solid border
example app

MaskForCameraView(
  visiblePopButton: false,
  appBarColor: Colors.red,
  bottomBarColor: Colors.red,
  takeButtonActionColor: Colors.red,
  borderType: MaskForCameraViewBorderType.solid,
  boxBorderWidth: 3.8,
  boxBorderRadius: 3.2,
  onTake: (Uint8List imageBytes) {
    // imageBytes is croped image, you can use it.
  }
);

How to use Navigator.pop() button
example app

MaskForCameraView(
  visiblePopButton: true,
  appBarColor: Colors.white,
  bottomBarColor: Colors.white,
  takeButtonActionColor: Colors.white,
  takeButtonColor: Colors.black,
  boxBorderColor: Colors.red,
  iconsColor: Colors.black,
  titleStyle: const TextStyle(
    color: Colors.black,
    fontSize: 18.0,
    fontWeight: FontWeight.w800,
  ),
  boxBorderWidth: 2.8,
  onTake: (Uint8List imageBytes) {
    // imageBytes is croped image, you can use it.
  }
);

Create your own style
example app

MaskForCameraView(
  visiblePopButton: false,
  appBarColor: Colors.yellow,
  bottomBarColor: Colors.yellow,
  takeButtonActionColor: Colors.green,
  takeButtonColor: Colors.white,
  boxBorderColor: Colors.green,
  iconsColor: Colors.white,
  titleStyle: const TextStyle(
    color: Colors.white,
    fontSize: 18.0,
    fontWeight: FontWeight.w800,
  ),
  boxBorderWidth: 3.8,
  onTake: (Uint8List imageBytes) {
    // imageBytes is croped image, you can use it.
  }
);

Usege in Android

In the android/app/build.gradle file, change

minSdkVersion 16

to

minSdkVersion 21

In the android/app/src/main/AndroidManifest.xml file, add this

<uses-permission android:name="android.permission.CAMERA" />

Usage in IOS

In the ios/Runner/Info.plist file, add this

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

For information

If you want to cut a picture yourself.

cropImage(
    File("...").path,
    cropHeight,
    cropWidth,
    screenHeight,
    screenWidth,
  );

This function cuts the image only from the center of the image

Usage

Initialize camera

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await MaskForCameraView.initialize();
  runApp(MyApp());
}

Get image Uint8List

MaskForCameraView(
  visiblePopButton: false,
  onTake: (Uint8List imageBytes) {
    // imageBytes is croped image, you can use it.
});

Acceptable parameters

MaskForCameraView(
    title: "Crop image from camera",
    boxWidth: 300.0,
    boxHeight: 168.0,
    boxBorderWidth: 1.8,
    boxBorderRadius: 3.2,
    onTake: (Uint8List imageBytes) {},
    borderType: MaskForCameraViewBorderType.dotted,
    visiblePopButton: true,
    appBarColor: Colors.black,
    titleStyle: const TextStyle(
      color: Colors.white,
      fontSize: 18.0,
      fontWeight: FontWeight.w600,
    ),
    boxBorderColor: Colors.white,
    bottomBarColor: Colors.black,
    takeButtonColor: Colors.white,
    takeButtonActionColor: Colors.black,
    iconsColor: Colors.white,
)

Example

Full example to use.

import 'dart:async';
import 'dart:typed_data';

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

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await MaskForCameraView.initialize();
  runApp(const MyApp());
}

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

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

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
        debugShowCheckedModeBanner: false, home: HomePage());
  }
}

class HomePage extends StatelessWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaskForCameraView(
      visiblePopButton: false,
      onTake: (Uint8List imageBytes) {
        // imageBytes is croped image, you can use it.
      }
    );
  }
}
You might also like...

An app to pick, upload and display images from camera and gallery with size and extension constraints.

image_uploader A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started i

Mar 7, 2022

Custom Camera, Barcode Scanner etc

in_app_camera A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if

Dec 30, 2021

its just take image from gallery or camera and save to file (in flutter)

flutter_img_pdf A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started

Dec 28, 2021

Multi-Camera-Dashboard - Flutter App to View RTSP Streams

Multi-Camera-Dashboard - Flutter App to View RTSP Streams

9.9.2021 update I have updated the firebase db to be read only due to abuse. The save operation works if you import your own firebase and modify proje

Jan 1, 2023

Camera and Microphone streaming library via RTMP for Flutter.

HaishinKit Plugin A Flutter plugin for iOS, Android. Camera and Microphone streaming library via RTMP. Android iOS Support SDK 21+ iOS 9.0+ ๐ŸŒ Depende

Nov 18, 2022

Face Mask Detection mobile application built with Flutter and TensorFlow lite in order to detect face masks using images and live camera.

Face Mask Detection mobile application built with Flutter and TensorFlow lite in order to detect face masks using images and live camera.

Face Mask Detector App Face Mask Detection mobile application built with Flutter and TensorFlow lite in order to detect face masks using images and li

Aug 15, 2022

WebRTC wifi Camera - Flutter - iOS/Android/Mac

WebRTC wifi Camera  - Flutter - iOS/Android/Mac

Flutter WebRTC Camera ์Šค๋งˆํŠธํฐ(iOS /Android)์นด๋ฉ”๋ผ๋ฅผ Wifi๋ฅผ ํ†ตํ•˜์—ฌ ์›น์บ ์ฒ˜๋Ÿผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ์•„์ดํฐ/์•ˆ๋“œ๋กœ์ด๋“œ/๋งฅ์šฉ ์•ฑ์ž…๋‹ˆ๋‹ค. ๋งฅ์•ฑ์„ ๋จผ์ € ๋นŒ๋“œํ•ด์„œ ์‹คํ–‰ํ•œ ํ›„ ์•„์ดํฐ, ์•ˆ๋“œ๋กœ์ด๋“œ ์•ฑ์„ ๋นŒ๋“œํ•ด์„œ ๋™์ผํ•œ Wifi ๋„คํŠธ์›์—์„œ ์‹คํ–‰ํ•˜๋ฉด ์ž๋™์œผ๋กœ

Nov 14, 2022

Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions.

Flutter permission_handler plugin The Flutter permission_handler plugin is build following the federated plugin architecture. A detailed explanation o

Dec 31, 2022

Unloc customizations of the Permission plugin for Flutter. This plugin provides an API to request and check permissions.

Flutter Permission handler Plugin A permissions plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check perm

Nov 26, 2020
Owner
Firdavs
I'm working as a Mobile programmer with Flutter & Dart
Firdavs
A full-fledged camera app built with Flutter using the camera package.

Flutter Camera Demo A full-fledged camera app built with Flutter using the camera package. You can even add custom features to this app and customize

NguyenHoangDuc 5 Nov 23, 2022
Automatically generate profile picture with random first name and background color. But you can still provide pictures if you have them. As the default color, based on the name of the first letter. :fire: :fire: :fire:

FLUTTER PROFILE PICTURE Automatically generate profile picture with random first name and background color. But you can still provide pictures if you

Aditya Dharmawan Saputra 10 Dec 20, 2022
A widget based on Flutter's new Interactive Viewer that makes picture pinch zoom, and return to its initial size and position when released.

pinch_zoom A widget based on Flutter's new Interactive Viewer that makes picture pinch zoom, and return to its initial size and position when released

Teun Kortekaas 36 Dec 30, 2022
Picture upload widget for Flutter which helps selecting and uploading one or multiple images to firebase storage.

Flutter Firebase Picture Uploader This library offers a Picture Upload widget which can be used to upload one or multiple images to your Firebase Stor

Christoph Rothermel 12 Oct 21, 2022
An Android app that allows you to scan Japanese words from a picture and search for its meaning from a dictionary.

Jisho Lens is an app that allows you to scan Japanese words from a picture and search for its meaning from a dictionary. In a nutshell, think of it as

elianiva 12 Sep 22, 2022
Flutter plugin for selecting images from the Android and iOS image library, taking new pictures with the camera, and edit them before using such as rotation, cropping, adding sticker/text/filters.

advance_image_picker Flutter plugin for selecting multiple images from the Android and iOS image library, taking new pictures with the camera, and edi

Weta Vietnam 91 Dec 19, 2022
Real-time object detection in Flutter using camera and tflite plugin

For details: https://medium.com/@shaqian629/real-time-object-detection-in-flutter-b31c7ff9ef96 flutter_realtime_detection Real-time object detection i

Post_Swift 6 Oct 12, 2022
Flutterbodydetection - A flutter plugin that uses MLKit on iOS/Android platforms to enable body pose and mask detection using Pose Detection and Selfie Segmentation APIs for both static images and live camera stream.

body_detection A flutter plugin that uses MLKit on iOS/Android platforms to enable body pose and mask detection using Pose Detection and Selfie Segmen

null 18 Dec 5, 2022
A flutter plugin about qr code or bar code scan , it can scan from fileใ€urlใ€memory and camera qr code or bar code .Welcome to feedback your issue.

r_scan A flutter plugin about qr code or bar code scan , it can scan from fileใ€urlใ€memory and camera qr code or bar code .Welcome to feedback your iss

PengHui Li 112 Nov 11, 2022
This is a simple app that is used to record video using Camera Plugin.

videorecorder A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if

Moideen Rafih P A 5 Nov 28, 2022