mirror of
https://github.com/Iconica-Development/flutter_media_picker.git
synced 2025-05-18 16:33:45 +02:00
feat: add image picker
This commit is contained in:
parent
39c41efc0c
commit
cd44468067
7 changed files with 61 additions and 24 deletions
|
@ -1,22 +1,23 @@
|
|||
# This is a generated file; do not edit or check into version control.
|
||||
flutter_plugin_android_lifecycle=/Users/nielsgorter/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-2.0.7/
|
||||
flutter_sound=/Users/nielsgorter/.pub-cache/hosted/pub.dartlang.org/flutter_sound-9.2.13/
|
||||
flutter_sound_web=/Users/nielsgorter/.pub-cache/hosted/pub.dartlang.org/flutter_sound_web-9.2.13/
|
||||
image_picker=/Users/nielsgorter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.8.6/
|
||||
image_picker_android=/Users/nielsgorter/.pub-cache/hosted/pub.dartlang.org/image_picker_android-0.8.5+3/
|
||||
image_picker_for_web=/Users/nielsgorter/.pub-cache/hosted/pub.dartlang.org/image_picker_for_web-2.1.10/
|
||||
image_picker_ios=/Users/nielsgorter/.pub-cache/hosted/pub.dartlang.org/image_picker_ios-0.8.6+1/
|
||||
path_provider=/Users/nielsgorter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.11/
|
||||
path_provider_android=/Users/nielsgorter/.pub-cache/hosted/pub.dartlang.org/path_provider_android-2.0.20/
|
||||
path_provider_ios=/Users/nielsgorter/.pub-cache/hosted/pub.dartlang.org/path_provider_ios-2.0.11/
|
||||
path_provider_linux=/Users/nielsgorter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-2.1.7/
|
||||
path_provider_macos=/Users/nielsgorter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-2.0.6/
|
||||
path_provider_windows=/Users/nielsgorter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.1.3/
|
||||
permission_handler=/Users/nielsgorter/.pub-cache/hosted/pub.dartlang.org/permission_handler-10.2.0/
|
||||
permission_handler_android=/Users/nielsgorter/.pub-cache/hosted/pub.dartlang.org/permission_handler_android-10.2.0/
|
||||
permission_handler_apple=/Users/nielsgorter/.pub-cache/hosted/pub.dartlang.org/permission_handler_apple-9.0.7/
|
||||
permission_handler_windows=/Users/nielsgorter/.pub-cache/hosted/pub.dartlang.org/permission_handler_windows-0.1.2/
|
||||
video_player=/Users/nielsgorter/.pub-cache/hosted/pub.dartlang.org/video_player-2.4.7/
|
||||
video_player_android=/Users/nielsgorter/.pub-cache/hosted/pub.dartlang.org/video_player_android-2.3.9/
|
||||
video_player_avfoundation=/Users/nielsgorter/.pub-cache/hosted/pub.dartlang.org/video_player_avfoundation-2.3.7/
|
||||
video_player_web=/Users/nielsgorter/.pub-cache/hosted/pub.dartlang.org/video_player_web-2.0.12/
|
||||
file_picker=C:\\src\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\file_picker-5.2.4\\
|
||||
flutter_plugin_android_lifecycle=C:\\src\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\flutter_plugin_android_lifecycle-2.0.7\\
|
||||
flutter_sound=C:\\src\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\flutter_sound-9.2.13\\
|
||||
flutter_sound_web=C:\\src\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\flutter_sound_web-9.2.13\\
|
||||
image_picker=C:\\src\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\image_picker-0.8.6\\
|
||||
image_picker_android=C:\\src\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\image_picker_android-0.8.5+4\\
|
||||
image_picker_for_web=C:\\src\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\image_picker_for_web-2.1.10\\
|
||||
image_picker_ios=C:\\src\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\image_picker_ios-0.8.6+2\\
|
||||
path_provider=C:\\src\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\path_provider-2.0.11\\
|
||||
path_provider_android=C:\\src\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\path_provider_android-2.0.22\\
|
||||
path_provider_ios=C:\\src\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\path_provider_ios-2.0.11\\
|
||||
path_provider_linux=C:\\src\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\path_provider_linux-2.1.7\\
|
||||
path_provider_macos=C:\\src\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\path_provider_macos-2.0.6\\
|
||||
path_provider_windows=C:\\src\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\path_provider_windows-2.1.3\\
|
||||
permission_handler=C:\\src\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\permission_handler-10.2.0\\
|
||||
permission_handler_android=C:\\src\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\permission_handler_android-10.2.0\\
|
||||
permission_handler_apple=C:\\src\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\permission_handler_apple-9.0.7\\
|
||||
permission_handler_windows=C:\\src\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\permission_handler_windows-0.1.2\\
|
||||
video_player=C:\\src\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\video_player-2.4.10\\
|
||||
video_player_android=C:\\src\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\video_player_android-2.3.10\\
|
||||
video_player_avfoundation=C:\\src\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\video_player_avfoundation-2.3.8\\
|
||||
video_player_web=C:\\src\\flutter\\.pub-cache\\hosted\\pub.dartlang.org\\video_player_web-2.0.13\\
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -85,6 +85,13 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "6.1.4"
|
||||
file_picker:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: file_picker
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "5.2.4"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
|
@ -106,6 +113,15 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.18.5+1"
|
||||
flutter_image_picker:
|
||||
dependency: transitive
|
||||
description:
|
||||
path: "."
|
||||
ref: "1.0.3"
|
||||
resolved-ref: "20814755cca74296600a0ae3e016e46979e66a7e"
|
||||
url: "https://github.com/Iconica-Development/flutter_image_picker"
|
||||
source: git
|
||||
version: "1.0.3"
|
||||
flutter_lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
|
|
|
@ -10,4 +10,7 @@ abstract class MediaPickerService {
|
|||
|
||||
/// Returns [Uint8List] based on given [VideoSource].
|
||||
Future<Uint8List?> pickVideoFile();
|
||||
|
||||
/// Returns [Uint8List] based on given [File].
|
||||
Future<Uint8List?> pickFile();
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_image_picker/flutter_image_picker.dart';
|
||||
import 'package:flutter_media_picker/src/abstracts/media_picker_input.dart';
|
||||
|
||||
import 'package:flutter_media_picker/src/media_result.dart';
|
||||
|
@ -25,7 +26,13 @@ class MediaPickerInputPhoto implements MediaPickerInput {
|
|||
|
||||
@override
|
||||
Future<MediaResult> onPressed(BuildContext context) async {
|
||||
var image = await pickFile?.call();
|
||||
var image = await showModalBottomSheet<Uint8List?>(
|
||||
context: context,
|
||||
backgroundColor: Colors.white,
|
||||
builder: (BuildContext context) => const ImagePicker(
|
||||
imagePickerConfig: ImagePickerConfig(
|
||||
maxHeight: 300, maxWidth: 200, imageQuality: 40),
|
||||
));
|
||||
|
||||
if (image != null && image.isNotEmpty) {
|
||||
return MediaResult(
|
||||
|
|
|
@ -17,6 +17,7 @@ class MediaPickerFileService implements MediaPickerService {
|
|||
|
||||
@override
|
||||
Future<Uint8List?> pickImageFile() async {
|
||||
|
||||
var image = await ImagePicker().pickImage(source: ImageSource.camera);
|
||||
|
||||
if (image != null) {
|
||||
|
@ -47,4 +48,9 @@ class MediaPickerFileService implements MediaPickerService {
|
|||
await controller.setLooping(true);
|
||||
await controller.play();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Uint8List?> pickFile() async {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,11 @@ dependencies:
|
|||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
image_picker: any
|
||||
flutter_image_picker:
|
||||
git:
|
||||
url: https://github.com/Iconica-Development/flutter_image_picker
|
||||
ref: 1.0.3
|
||||
file_picker: any
|
||||
video_player: any
|
||||
path_provider: any
|
||||
hooks_riverpod: any
|
||||
|
|
Loading…
Reference in a new issue