搜索插件、代码仓与 APP 分类

likk_picker 封面
插件详情v1.1.5+1

likk_picker

相机和图库选择器,来自 Photo Manager。Facebook Messenger 的自定义视图。(图像选择器、相机、图库读取器)

近 30 天下载
44
喜欢数
60
Pub 分数
50

安装插件

flutter pub add likk_picker

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

likk_picker 是一个 Flutter 包,提供可自定义的图像选择器,支持相机和相册访问,灵感来自 Facebook Messenger 的媒体选择界面。基于 Photo Manager 库构建,它允许用户从本地存储中选择和管理图像,或直接通过设备相机拍摄新图像。该包支持自定义 UI 组件,非常适合需要精致、原生体验的媒体选择功能的应用程序。它简化了资源获取过程,同时为开发者提供了灵活的选项来定制选择器的外观和行为。

适合场景

  • 社交媒体应用照片上传
  • 聊天应用媒体共享
  • 用户个人资料图片选择
  • 内容创作工具
  • 电子商务产品图像捕获
  • 多图像选择工作流

主要特点

  • 相机和相册集成
  • 可自定义的 UI,类似于 Facebook Messenger
  • 支持多张图片选择
  • 基于 Photo Manager 库构建
  • 轻量且易于集成
  • 跨平台兼容性

适合对象

  • 开发聊天界面的开发者
  • 需要直观媒体选择器的应用程序
  • 需要自定义媒体选择UI的项目
  • 专注于用户生成内容的移动应用
  • 希望有轻量级替代方案的团队,可替代标准图像选择器

使用建议

  • 需要平台特定的相机和存储权限
  • 仅限图像资源(不支持视频)
  • 依赖外部照片管理器库
  • 可能需要额外的样式才能完全自定义
  • 无内置图像编辑功能

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Likk Picker

Platform Pub Package likes Forks

Buy Me A Coffee

A flutter package which is clone of facebook messenger gallery picker and camera, combined as single component. Gallery view and Camera view can also be use as Flutter widget. Under the hood likk picker used Photo Manager and Camera.


Table of contents


Installing

1. Add dependency

Add this to your package's pubspec.yaml file:

dependencies:
  likk_picker: ^latest_version
2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get
3. Import it

Now in your Dart code, you can use:

import 'package:likk_picker/likk_picker.dart';

Platform Setup

For more details (if needed) you can go through Photo Manager and Camera readme section as well.

Android

Change the minimum Android sdk version to 21 (or higher) in your android/app/build.gradle file.

minSdkVersion 21

Required permissions: INTERNET, READ_EXTERNAL_STORAGE, WRITE_EXTERNAL_STORAGE, ACCESS_MEDIA_LOCATION. If you don't need the ACCESS_MEDIA_LOCATION permission, see Disable ACCESS_MEDIA_LOCATION permission.

glide

Android native use glide to create image thumb bytes, version is 4.11.0.

If your other android library use the library, and version is not same, then you need edit your android project's build.gradle.

rootProject.allprojects {

    subprojects {
        project.configurations.all {
            resolutionStrategy.eachDependency { details ->
                if (details.requested.group == 'com.github.bumptech.glide'
                        && details.requested.name.contains('glide')) {
                    details.useVersion '4.11.0'
                }
            }
        }
    }
}

And, if you want to use ProGuard, you can see the ProGuard of Glide.

Remove Media Location permission

Android contains ACCESS_MEDIA_LOCATION permission by default.

This permission is introduced in Android Q. If your app doesn't need this permission, you need to add the following node to the Android manifest in your app.

<uses-permission
  android:name="android.permission.ACCESS_MEDIA_LOCATION"
  tools:node="remove"
  />

If you found some warning logs with Glide appearing, then the main project needs an implementation of AppGlideModule. See Generated API.

IOS

Add following content to info.plist.

<key>NSPhotoLibraryUsageDescription</key>
<string>Replace with your permission description..</string>
<key>NSCameraUsageDescription</key>
<string>Replace with your permission description..</string>
<key>NSMicrophoneUsageDescription</key>
<string>Replace with your permission description..</string>

Gallery

  1. Use GalleryViewWrapper to make gallery view collapsible otherwise ignore it.
class PickerDemo extends StatelessWidget {
 late final GalleryController controller;
 
 ...

 @override
 Widget build(BuildContext context) {
   return GalleryViewWrapper(
     controller: controller,
     child: Scaffold(
       body: ...
     ),
   );
 }
}
  1. GalleryController can be used for extra setting and picking media.
  • Using pick() function on controller to pick media.
class PickerDemo extends StatelessWidget {
  late final GalleryController controller;

  @override
  void initState() {
    super.initState();
    controller = GalleryController(
      gallerySetting: const GallerySetting(
        albumSubtitle: 'Collapsable',
        enableCamera: true,
        maximum: 10,
        requestType: RequestType.all,
      ),
      panelSetting: const PanelSetting(topMargin: 24.0),
    );
  }

  ...

  onPressed : () async {
    final entities = await controller.pick();
  }

  ...
}
  1. Using GalleryViewField similarly as flutter TextField to pick media.
  • onChanged – triggered every time user select/unselect media

  • onSubmitted – triggered when user done with selection

GalleryViewField(
  selectedEntities: [],
  onChanged: (entity, isRemoved) {
     ...
  },
  onSubmitted: (list) {
     ...
  }
  child: const Icon(Icons.camera),
),
  1. You can also use GalleryView as a Widget.

Camera

  1. Using pick() function on CameraView to pick media.
  ...
  onPressed : () async {
    final entity = await CameraView.pick();
  }
  ...
  1. Using CameraViewField similarly as flutter TextField to pick media.
  • onCapture – triggered when photo/video capture completed
GalleryViewField(
  onCapture: (entity) {
     ...
  },
  child: const Icon(Icons.camera),
),
  1. You can also use CameraView as a Widget.

Bugs or Requests

If you encounter any problems feel free to open an issue. If you feel the library is missing a feature, please raise a ticket on GitHub and I'll look into it. Pull request are also welcome.


Maintainers

Donate

所属分类

依赖

依赖清单 5 项

源码仓库

使用此插件的项目

暂无相关数据。