Skip to content

Commit 58b08e5

Browse files
committed
🚀 Add camera picker to the example.
1 parent 648237d commit 58b08e5

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

example/lib/pages/multi_assets_page.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import 'package:flutter/material.dart';
66
import 'package:flutter_common_exports/flutter_common_exports.dart';
77
import 'package:wechat_assets_picker/wechat_assets_picker.dart';
8+
import 'package:wechat_camera_picker/wechat_camera_picker.dart';
89

910
import '../constants/picker_model.dart';
1011
import '../main.dart';
@@ -93,7 +94,10 @@ class _MultiAssetsPageState extends State<MultiAssetsPage> {
9394
behavior: HitTestBehavior.opaque,
9495
onTap: () async {
9596
final AssetEntity result =
96-
await AssetPicker.pickFromCamera(context);
97+
await CameraPicker.pickFromCamera(
98+
context,
99+
isAllowRecording: true,
100+
);
97101
if (result != null) {
98102
Navigator.of(context)
99103
.pop(<AssetEntity>[...assets, result]);

example/lib/pages/single_assets_page.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import 'package:flutter/material.dart';
66
import 'package:flutter_common_exports/flutter_common_exports.dart';
77
import 'package:wechat_assets_picker/wechat_assets_picker.dart';
8+
import 'package:wechat_camera_picker/wechat_camera_picker.dart';
89

910
import '../constants/picker_model.dart';
1011
import '../main.dart';
@@ -92,8 +93,10 @@ class _SingleAssetPageState extends State<SingleAssetPage> {
9293
return GestureDetector(
9394
behavior: HitTestBehavior.opaque,
9495
onTap: () async {
95-
final AssetEntity result =
96-
await AssetPicker.pickFromCamera(context);
96+
final AssetEntity result = await CameraPicker.pickFromCamera(
97+
context,
98+
isAllowRecording: true,
99+
);
97100
if (result != null) {
98101
Navigator.of(context).pop(<AssetEntity>[result]);
99102
}

example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ dependencies:
1212

1313
wechat_assets_picker:
1414
path: ../
15+
wechat_camera_picker: ^1.0.0
1516

1617
dev_dependencies:
1718
flutter_asset_generator: ">=0.4.7 <2.0.0"
@@ -20,4 +21,3 @@ flutter:
2021
uses-material-design: true
2122
assets:
2223
- assets/
23-

0 commit comments

Comments
 (0)