gmo_camera_picker

A camera picker which is an extension

install

Add to pubspec

dependencies:
  gmo_camera_picker: 0.0.1

Android

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

minSdkVersion 21

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>

Usage 📖

ParameterTypeDescriptionDefault
enableRecordingboolWhether the picker can record video.false
onlyEnableRecordingboolWhether the picker can only record video. Only available when enableRecording is true.false
enableTapRecordingboolWhether allow the record can start with single tap. Only available when enableRecording is true.false
enableAudioboolWhether Whether the picker should record audio. Only available with recording.true
enableSetExposureboolWhether users can set the exposure point by tapping.true
enableExposureControlboolWhether users can adjust exposure according to the set point.true
isAutoPreviewVideoboolWhether the video should be played instantly in the preview.false
maximumRecordingDurationDurationThe maximum duration of the video recording process.const Duration(seconds: 15)
textDelegateTextDelegate?Text delegate that controls text in widgets.DefaultTextDelegate
resolutionPresetResolutionPresetPresent resolution for the camera.ResolutionPreset.max
cameraQuarterTurnsintThe number of clockwise quarter turns the camera view should be rotated.0
themeThemeData?Theme data for the picker.GmoCameraPicker.themeData(ColorConstant.themeColor)

Simple usage

final File? file = await GmoCameraPicker.pickFromCamera(context);

Example

import 'package:gmo_camera_picker/gmo_camera_picker.dart';

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  File? _image;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: _image == null ? const SizedBox() : Image.file(_image!),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: pickerCamera,
        tooltip: 'Camera Picker',
        child: const Icon(Icons.add),
      ),
    );
  }

  Future<void> pickerCamera() async {
    _image = await GmoCameraPicker.pickFromCamera(context);
    setState(() {});
  }
}


Libraries

camera_picker_text_delegate
circular_progress_bar
constants
enums
exposure_point_widget
extensions
gmo_camera_picker
methods
screens
styles