Skip to content

Commit

Permalink
release version 2.0.0-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabul committed Feb 24, 2021
1 parent d3c0a21 commit 5f7a4c7
Show file tree
Hide file tree
Showing 10 changed files with 87 additions and 155 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 2.0.0-beta
- Add Feature Zoom!
- Add Feature FlashMode
- Add Feature Change Camera, and seletec the CameraSide your prefer activated!
- CallBack for return File your photo, onFile(File yourFile)
- Removed return using Navigator.pop(context,file)
- Refactor in internal structure
## 1.1.1-beta

- Update camera for 0.7.0+1
Expand Down
186 changes: 56 additions & 130 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
# Camera_Camera
# Camera_Camera 2.0



That is plugin contains native access camera your device, Android and iOS. You can take a photo or record video. Return file.
## New Features!
- Add Feature Zoom!
- Add Feature FlashMode
- Add Feature Change Camera, and seletec the CameraSide your prefer activated!
- CallBack for return File your photo, onFile(File yourFile)
- Removed return using Navigator.pop(context,file)
- Refactor in internal structure

![example](https://i.imgur.com/CWbwCoH.png=200x200)

## Android
You need add in **AndroidManifest.xml**
```dart
<activity
android:name="com.yalantis.ucrop.UCropActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
```

# Guide for instalation
## Android
You need add in **app/build.gradle**
```dart
minSdkVersion 21
Expand All @@ -27,143 +28,68 @@ minSdkVersion 21
<string>Can I use the mic please?</string>
```

## Mode Photo

## Enable Photo

```dart
Camera(
orientationEnablePhoto: CameraOrientation.landscape,)

Camera(
orientationEnablePhoto: CameraOrientation.portrait,)
Camera(
orientationEnablePhoto: CameraOrientation.all,) // isDefault
```

### Mask Camera

You can add widget top stack camera, Container, Images.png.

```dart
Camera(
imageMask: Widget
)
```

### Screen Mode

```dart
Camera(
mode: CameraMode.normal or CameraMode.fullscreen
)
## Flutter
Add package in pubspec.yaml

```yaml
camera_camera: current_version
```
### Mode Focus

You can add Rectangle , Circle or Square Focus
## How to use
![](https://i.imgur.com/AhPO41p.jpg)
![](https://i.imgur.com/sGqdE3D.jpg)
![](https://i.imgur.com/6wnWAYA.jpg)
Camera_Camera is widget, you can use anywhere
```dart
Camera(
mode: CameraMode.normal,
imageMask: CameraFocus.rectangle(
color: Colors.black.withOpacity(0.5),
),
)
```

You can take a photo and edit.
Example 01
```dart
yourFunction () async {
File file = await Navigator.push(context, MaterialPageRoute(builder: (context) => Camera()));
})
```

### Other mode getFile
```dart
Camera(
onFile: (File file) => file;
)
return Scaffold(
body: CameraCamera(
onFile: (file) => print(file);
)
);
```
![](https://i.imgur.com/AupuIRm.jpg)

![](https://i.imgur.com/N7tx5SQ.jpg)





# Mode Video



You cand record video and preview.

Example 02

```dart
yourFunction () async {
File file = await Navigator.push(context, MaterialPageRoute(builder: (context) => Video()));
})
return Scaffold(
body: CameraCamera(
onFile: (file) => print(file);
),
floatingActionButton: FloatingActionButton(
onPressed: (){
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => CameraCamera(
onFile: (file) {
photos.add(file);
//When take foto you should close camera
Navigator.pop(context);
setState(() {});
},
)))
},
child: Icon(Icons.camera_alt),
),
);
```

## Roadmap 2.0

## Installation
| Feature | Progress |
| :---------------------------------------- | :------: |
| Zoom ||
| Flash ||
| CameraSide select ||
| nullsafety support | |
| Add Exposure controll | |
| Add Easy Mode Video | |
| Add Gallery | |



Add package in pubspec.yaml



```bash

camera_camera: current_version

```



## Usage



Import this in your page



```dart
import 'package:camera_camera/camera_camera.dart';
```



## Contributing

Expand Down
2 changes: 1 addition & 1 deletion example/.flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"camera","path":"/Users/gabrielsavio/Developer/Mobile/Setup/flutter/.pub-cache/hosted/pub.dartlang.org/camera-0.7.0+2/","dependencies":[]},{"name":"native_device_orientation","path":"/Users/gabrielsavio/Developer/Mobile/Setup/flutter/.pub-cache/hosted/pub.dartlang.org/native_device_orientation-0.4.3/","dependencies":[]},{"name":"path_provider","path":"/Users/gabrielsavio/Developer/Mobile/Setup/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.27/","dependencies":[]},{"name":"video_player","path":"/Users/gabrielsavio/Developer/Mobile/Setup/flutter/.pub-cache/hosted/pub.dartlang.org/video_player-1.0.1/","dependencies":[]},{"name":"wakelock","path":"/Users/gabrielsavio/Developer/Mobile/Setup/flutter/.pub-cache/hosted/pub.dartlang.org/wakelock-0.2.1+1/","dependencies":[]}],"android":[{"name":"camera","path":"/Users/gabrielsavio/Developer/Mobile/Setup/flutter/.pub-cache/hosted/pub.dartlang.org/camera-0.7.0+2/","dependencies":[]},{"name":"native_device_orientation","path":"/Users/gabrielsavio/Developer/Mobile/Setup/flutter/.pub-cache/hosted/pub.dartlang.org/native_device_orientation-0.4.3/","dependencies":[]},{"name":"path_provider","path":"/Users/gabrielsavio/Developer/Mobile/Setup/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.27/","dependencies":[]},{"name":"video_player","path":"/Users/gabrielsavio/Developer/Mobile/Setup/flutter/.pub-cache/hosted/pub.dartlang.org/video_player-1.0.1/","dependencies":[]},{"name":"wakelock","path":"/Users/gabrielsavio/Developer/Mobile/Setup/flutter/.pub-cache/hosted/pub.dartlang.org/wakelock-0.2.1+1/","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"/Users/gabrielsavio/Developer/Mobile/Setup/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-0.0.4+3/","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/gabrielsavio/Developer/Mobile/Setup/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-0.0.1+1/","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"/Users/gabrielsavio/Developer/Mobile/Setup/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-0.0.4+3/","dependencies":[]}],"web":[{"name":"import_js_library","path":"/Users/gabrielsavio/Developer/Mobile/Setup/flutter/.pub-cache/hosted/pub.dartlang.org/import_js_library-1.0.2/","dependencies":[]},{"name":"video_player_web","path":"/Users/gabrielsavio/Developer/Mobile/Setup/flutter/.pub-cache/hosted/pub.dartlang.org/video_player_web-0.1.4+1/","dependencies":[]},{"name":"wakelock_web","path":"/Users/gabrielsavio/Developer/Mobile/Setup/flutter/.pub-cache/hosted/pub.dartlang.org/wakelock_web-0.1.0+3/","dependencies":["import_js_library"]}]},"dependencyGraph":[{"name":"camera","dependencies":[]},{"name":"import_js_library","dependencies":[]},{"name":"native_device_orientation","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux","path_provider_windows"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"video_player","dependencies":["video_player_web"]},{"name":"video_player_web","dependencies":[]},{"name":"wakelock","dependencies":["wakelock_web"]},{"name":"wakelock_web","dependencies":["import_js_library"]}],"date_created":"2021-02-23 10:05:24.653305","version":"1.23.0-18.1.pre"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"camera","path":"/Users/gabrielsavio/Developer/Mobile/Setup/flutter/.pub-cache/hosted/pub.dartlang.org/camera-0.7.0+2/","dependencies":[]},{"name":"native_device_orientation","path":"/Users/gabrielsavio/Developer/Mobile/Setup/flutter/.pub-cache/hosted/pub.dartlang.org/native_device_orientation-0.4.3/","dependencies":[]},{"name":"path_provider","path":"/Users/gabrielsavio/Developer/Mobile/Setup/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.27/","dependencies":[]},{"name":"video_player","path":"/Users/gabrielsavio/Developer/Mobile/Setup/flutter/.pub-cache/hosted/pub.dartlang.org/video_player-1.0.1/","dependencies":[]},{"name":"wakelock","path":"/Users/gabrielsavio/Developer/Mobile/Setup/flutter/.pub-cache/hosted/pub.dartlang.org/wakelock-0.2.1+1/","dependencies":[]}],"android":[{"name":"camera","path":"/Users/gabrielsavio/Developer/Mobile/Setup/flutter/.pub-cache/hosted/pub.dartlang.org/camera-0.7.0+2/","dependencies":[]},{"name":"native_device_orientation","path":"/Users/gabrielsavio/Developer/Mobile/Setup/flutter/.pub-cache/hosted/pub.dartlang.org/native_device_orientation-0.4.3/","dependencies":[]},{"name":"path_provider","path":"/Users/gabrielsavio/Developer/Mobile/Setup/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.27/","dependencies":[]},{"name":"video_player","path":"/Users/gabrielsavio/Developer/Mobile/Setup/flutter/.pub-cache/hosted/pub.dartlang.org/video_player-1.0.1/","dependencies":[]},{"name":"wakelock","path":"/Users/gabrielsavio/Developer/Mobile/Setup/flutter/.pub-cache/hosted/pub.dartlang.org/wakelock-0.2.1+1/","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"/Users/gabrielsavio/Developer/Mobile/Setup/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-0.0.4+3/","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/gabrielsavio/Developer/Mobile/Setup/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-0.0.1+1/","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"/Users/gabrielsavio/Developer/Mobile/Setup/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-0.0.4+3/","dependencies":[]}],"web":[{"name":"import_js_library","path":"/Users/gabrielsavio/Developer/Mobile/Setup/flutter/.pub-cache/hosted/pub.dartlang.org/import_js_library-1.0.2/","dependencies":[]},{"name":"video_player_web","path":"/Users/gabrielsavio/Developer/Mobile/Setup/flutter/.pub-cache/hosted/pub.dartlang.org/video_player_web-0.1.4+1/","dependencies":[]},{"name":"wakelock_web","path":"/Users/gabrielsavio/Developer/Mobile/Setup/flutter/.pub-cache/hosted/pub.dartlang.org/wakelock_web-0.1.0+3/","dependencies":["import_js_library"]}]},"dependencyGraph":[{"name":"camera","dependencies":[]},{"name":"import_js_library","dependencies":[]},{"name":"native_device_orientation","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux","path_provider_windows"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"video_player","dependencies":["video_player_web"]},{"name":"video_player_web","dependencies":[]},{"name":"wakelock","dependencies":["wakelock_web"]},{"name":"wakelock_web","dependencies":["import_js_library"]}],"date_created":"2021-02-24 08:27:05.284491","version":"1.23.0-18.1.pre"}
11 changes: 5 additions & 6 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ class MyHomePage extends StatefulWidget {
class _MyHomePageState extends State<MyHomePage> {
final photos = <File>[];

void _incrementCounter() {
void openCamera() {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => CameraPage(
onFile: (path) {
photos.add(File(path));
builder: (_) => CameraCamera(
onFile: (file) {
photos.add(file);
Navigator.pop(context);
setState(() {});
},
Expand Down Expand Up @@ -68,8 +68,7 @@ class _MyHomePageState extends State<MyHomePage> {
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
onPressed: openCamera,
child: Icon(Icons.camera_alt),
),
);
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ packages:
path: ".."
relative: true
source: path
version: "1.1.1-beta"
version: "2.0.0-beta"
camera_platform_interface:
dependency: transitive
description:
Expand Down
6 changes: 3 additions & 3 deletions lib/src/core/camera_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import 'camera_status.dart';

class CameraBloc {
final CameraService service;
final void Function(String value) onFile;
final void Function(String value) onPath;
final CameraSide cameraSide;
final List<FlashMode> flashModes;
CameraCameraController _cameraController;

CameraBloc({
@required this.service,
@required this.onFile,
@required this.onPath,
@required this.cameraSide,
@required this.flashModes,
});
Expand Down Expand Up @@ -81,7 +81,7 @@ class CameraBloc {
_cameraController = CameraCameraController(
cameraDescription: cameras[indexSelected],
resolutionPreset: resolutionPreset,
onFile: onFile,
onPath: onPath,
flashModes: flashModes,
);
status = CameraStatusPreview(
Expand Down
14 changes: 7 additions & 7 deletions lib/src/presentation/camera_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import 'package:camera_camera/src/presentation/widgets/camera_preview.dart';
import 'package:camera_camera/src/shared/entities/camera_side.dart';
import 'package:flutter/material.dart';

class CameraPage extends StatefulWidget {
class CameraCamera extends StatefulWidget {
///Define your prefer resolution
final ResolutionPreset resolutionPreset;

///CallBack function returns path your photo taken
final void Function(String path) onFile;
///CallBack function returns File your photo taken
final void Function(File file) onFile;

///Define types of camera side is enabled
final CameraSide cameraSide;
Expand All @@ -25,7 +25,7 @@ class CameraPage extends StatefulWidget {
///Enable zoom camera ( default = true )
final bool enableZoom;

CameraPage({
CameraCamera({
Key key,
this.resolutionPreset = ResolutionPreset.ultraHigh,
this.onFile,
Expand All @@ -35,18 +35,18 @@ class CameraPage extends StatefulWidget {
}) : super(key: key);

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

class _CameraPageState extends State<CameraPage> {
class _CameraCameraState extends State<CameraCamera> {
CameraBloc bloc;
StreamSubscription _subscription;
@override
void initState() {
bloc = CameraBloc(
flashModes: widget.flashModes,
service: CameraServiceImpl(),
onFile: widget.onFile,
onPath: (path) => widget.onFile(File(path)),
cameraSide: widget.cameraSide,
);
bloc.init();
Expand Down
8 changes: 4 additions & 4 deletions lib/src/presentation/controller/camera_camera_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class CameraCameraController {
final ResolutionPreset resolutionPreset;
final CameraDescription cameraDescription;
final List<FlashMode> flashModes;
final void Function(String path) onFile;
final void Function(String path) onPath;

final statusNotifier = ValueNotifier<CameraCameraStatus>(CameraCameraEmpty());
CameraCameraStatus get status => statusNotifier.value;
Expand All @@ -18,7 +18,7 @@ class CameraCameraController {
@required this.resolutionPreset,
@required this.cameraDescription,
@required this.flashModes,
@required this.onFile,
@required this.onPath,
}) {
_controller = CameraController(cameraDescription, resolutionPreset);
}
Expand Down Expand Up @@ -140,8 +140,8 @@ class CameraCameraController {

void takePhoto() async {
final file = await _controller.takePicture();
if (onFile != null) {
onFile(file.path);
if (onPath != null) {
onPath(file.path);
}
}

Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: camera_camera
description: Um Flutter Plugin de câmera, que funciona tanto em iOS e Android. Na parte da câmera temos a parte editável. Para Android minSDK 21.
version: 1.1.1-beta
description: The easy plugin camera for your project, platforms Android and iOS.
version: 2.0.0-beta
repository: https://github.com/gabuldev/camera_camera
homepage: https://gabul.dev/

Expand Down
2 changes: 1 addition & 1 deletion test/camera_bloc_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void main() {
service = CameraServiceMock();
controller = CameraBloc(
service: service,
onFile: onFile,
onPath: onFile,
cameraSide: CameraSide.all,
flashModes: [FlashMode.off]);
});
Expand Down

0 comments on commit 5f7a4c7

Please sign in to comment.