An abstraction on top of flutter camera.
- Provides the lower level handling of the camera plugin
- Handles all camera resources
- Handle camera status when app activity change
- Can be used out-of-the-box by simply calling
- Can be customized with layers
- Come with a few, pre-baked, preview layers
- Has a functional API leveraged by dartz
Version compatibility #
- Dart: 2.7.0
- Flutter: 1.12.13+hotfix.5 (stable)
See CHANGELOG.md for all breaking (and non-breaking) changes.
Getting started #
magiceye as a dependency in your project:
dependencies: magiceye: ^0.1.0
After this, you should then run
flutter packages upgrade or update your packages with your IDE/editor funcionalities.
If you want to use MagicEye default camera widget, you can do this by calling
Future<Either<MagicEyeException, String>> result = await MagicEye().push(context); result.fold( (exception) => // Handle exception case (path) => // Handle success case. [path] has the path to the file saved );
Disclaimer: MagicEye widget can be used with
Navigator.pushinstead. However, the disposal of resources won't be handled automatically. Use with caution.
You can customize some functionality of the camera passing parameters to the
MagicEye constructor. For detailed info, consult its page on the documentation.
Although MagicEye may be used as is, you can customize it's
previewLayer. Both receives the necessary context and expects to return a
You can see examples of custom layers in the source:
In the near future, more and simpler examples will be provided in the example.
Preview Layer #
The Preview Layer is, usually, used for graphical-only widgets, although it accepts any
Widget. The canvas is limited to the preview area, so if the preview aspect ratio is different from the device's aspect ratio, the canvas will not include the black area.
To make a custom preview layer,
previewLayer accepts a
Widget Function(BuildContext, PreviewLayerContext).
PreviewLayerContext provides the
allowedDirections parameter used on MagicEye instatiation. Also, a
direction stream emits info about the current device orientation.
Control Layer #
The Control Layer is used to render the controls of the camera. Its canvas is the entire device screen. The parameter
controlLayer is similar to
previewLayer, but provides a
ControlLayerContext instead, which gives you access to the camera functions like
For bugs or additional info, feel free to open an issue.
- Updated README.md
- Updated README.md
- Updated README.md
- API has reached a reasonable stability.
- README.md has been updated with enough info.
- Little update on the documentation.
- Fix [BehaviorSubject] instantiation.
- Little improvement on NaviveDeviceDirection handling.
- Fix for [DeviceDirection.difference].
- Tests for [DeviceDirection.difference].
- Adjustment on [DeviceDirection.difference] method.
- Added a method to returs the difference of directions in degrees.
- See [DeviceDirection.difference].
- Center image on default control layer confirmation
- Small update on README.md
- Deal with all warnings
- Dealing with controllers' resources release (issue present since 0.0.1)
- Fixes camera freezing by disconnection (issue present since 0.0.1)
- Small cleanup and documentation update
- Fixed error handling
- Provide direction as a BehaviorSubject instead of a Stream on contexts
- Improvements on defaultCameraControl
- Example cleanups
- Fixed PreviewLayer functions
- Some corrections on formatting
- Updated description
- Updated rxdart dependency
- This breaks the API.
- Instead of returning an [Option
- Improvements on documentation
- Make functions [toRadian] and [toDegrees] for [DeviceDirection] into extension methods ([.radian] and [.degrees] respectively).
- For this, raised Dart SDK requirement to 2.7.
- Also, reraised required path_provider version to 1.5.1
- Lowered required path_provider version to 1.5.0 so it's backward compatible with Flutter 1.9
- Lowered required rxdart version to ^0.22.5
- Lowered required Dart SDK to 2.5
- Exported DeviceCamera
- Unexported default_camera_control_layer
- Instead of [pushWithConfirmation] (not yet implemented), the confirmation screen has been implemented on the [defaultCameraControlLayer] method.
- Change on package structure
- Little change on API: instead of returning a String, now the MagicEye return an [Option
- Initial release: basic functionality
- Default preview and controls
- Allow for custom control and preview layers
Known Issues #
- Old controllers not being disposed
- Camera goes disabled by policy if the device locked
- Camera freezes if you change to another app that uses the camera
- No proper handle of black area when the device's aspect ratio is higher than camera's one
Other info #
The readme will be made later. Thanks.
The example folder is working, but its just a personal test of the package. A proper example with MREs and diverse options will be available in the future.
Demonstrates how to use the camerarm plugin.
Getting Started #
This project is a starting point for a Flutter application.
A few resources to get you started if this is your first Flutter project:
For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.
Use this package as a library
1. Depend on it
Add this to your package's pubspec.yaml file:
dependencies: magiceye: ^0.1.0+3
2. Install it
You can install packages from the command line:
$ flutter pub get
Alternatively, your editor might support
flutter pub get.
Check the docs for your editor to learn more.
3. Import it
Now in your Dart code, you can use:
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
We analyzed this package on Jan 19, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
- Dart: 2.7.0
- pana: 0.13.4
- Flutter: 1.12.13+hotfix.5
|Dart SDK||>=2.7.0 <3.0.0|