gmo_camera_picker 0.0.1 gmo_camera_picker: ^0.0.1 copied to clipboard
A camera picker which is an extension
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 📖 #
Parameter | Type | Description | Default |
---|---|---|---|
enableRecording | bool |
Whether the picker can record video. | false |
onlyEnableRecording | bool |
Whether the picker can only record video. Only available when enableRecording is true . |
false |
enableTapRecording | bool |
Whether allow the record can start with single tap. Only available when enableRecording is true . |
false |
enableAudio | bool |
Whether Whether the picker should record audio. Only available with recording. | true |
enableSetExposure | bool |
Whether users can set the exposure point by tapping. | true |
enableExposureControl | bool |
Whether users can adjust exposure according to the set point. | true |
isAutoPreviewVideo | bool |
Whether the video should be played instantly in the preview. | false |
maximumRecordingDuration | Duration |
The maximum duration of the video recording process. | const Duration(seconds: 15) |
textDelegate | TextDelegate? |
Text delegate that controls text in widgets. | DefaultTextDelegate |
resolutionPreset | ResolutionPreset |
Present resolution for the camera. | ResolutionPreset.max |
cameraQuarterTurns | int |
The number of clockwise quarter turns the camera view should be rotated. | 0 |
theme | ThemeData? |
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(() {});
}
}