搜尋套件、儲存庫與 APP 分類

editable_image 封面
套件詳情v2.0.0

editable_image

用於建立完全可自訂和可編輯影像元件的 Flutter 套件。

AndroidiOSmacOS
近 30 天下載
55
喜歡數
48
Pub 分數
140

安裝套件

flutter pub add editable_image

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一個 Flutter 套件,可建立完全可自訂且可編輯的影像小部件,讓使用者能在應用程式內直接修改影像。它支援互動功能,例如裁切、調整大小與定位,非常適合用於個人檔案圖片、頭像與聊天氣泡。此套件專為 Android、iOS 與 macOS 平台的無縫整合而設計,為開發者提供 UI 設計與使用者互動上的彈性。透過乾淨的 API 與回應式行為,提升需要動態影像處理之應用程式的使用者體驗。

適用情境

  • 個人檔案圖片編輯
  • 頭像自定義
  • 聊天頭像修改
  • 使用者產生內容創作
  • 互動式圖像疊加

主要特色

  • 可自定義的圖像編輯
  • 跨平台支援(Android、iOS、macOS)
  • 互動式裁切與調整大小
  • 響應式 UI 組件
  • 與現有 Flutter 應用輕鬆整合

適合對象

  • 社群媒體應用
  • 使用者設定檔管理
  • 訊息應用程式
  • 照片編輯工具
  • 自定義 UI 組件

使用建議

  • 需要仔細處理圖像解析度
  • 可能影響大圖像的效能
  • 僅限基本編輯功能
  • 不適合進階照片編輯
  • 依賴於平台特定的渲染行為

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Editable Image | Flutter Package

Flutter package for creating a fully customizable and editable image widget. The package has been written solely in Dart Language.

 

editable_image_gif_1 editable_image_gif_2

 

Features

A powerful and fully customizable widget. It provides a custom widget to save time.

For example, almost in every profile settings interface, etc., there is a profile image. Instead of writing from scratch, this widget can be used and can save a lot of time.

 

 

Getting started

Let's take a look at how to implement EditableImage to fastly create user interfaces for profile picture edit, etc.

First, add following line to pubspec.yaml:

editable_image: ^2.0.0

Second, import EditableImage:

import 'package:editable_image/editable_image.dart';

Lastly, make platform-specific setups by applying the following instructions.

Android Setup
  • The minimum required SDK version is 21. Therefore, please find the following line inside android/app/build.gradle and modify it:
compileSdkVersion 33
..
..
..
minSdkVersion 21
targetSdkVersion 33
  • Please upgrade the Kotlin version (ext.kotlin_version) to 1.7.0 or the latest version. To do that, find the following line inside android/build.gradle and modify it:
ext.kotlin_version = '1.7.0'
  • Please upgrade the Gradle version (ext.kotlin_version) to 6.8.3 or the latest version but lower than 7.0.0. To do that, find the following line inside android/gradle/wrapper/gradle-wrapper.properties and modify it:
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip
  • Please go to your project folder and add android:exported="true" to AndroidManifest.xml file
<activity
     android:name=".MainActivity"
     android:exported="true"
     android:launchMode="singleTop"
     android:theme="@style/LaunchTheme"
 </activity>
  • Required permissions: READ_EXTERNAL_STORAGE. Please modify android/app/src/main/AndroidManifest.xml and update accordingly:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
  • I recommand you add android:requestLegacyExternalStorage="true" to AndroidManifest.xml. Therefore, please modify android/app/src/main/AndroidManifest.xml and add the following line inside application:
<application android:requestLegacyExternalStorage="true"</application>

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

iOS Setup
  • Platform version must be at least 9.0. Please modify ios/Podfile and update accordingly:
platform :ios, '11.0'
  • Add the following lines to ios/Runner/Info.plist:
<key>NSAppTransportSecurity</key>
<dict>
	<key>NSAllowsArbitraryLoads</key>
	<true/>
</dict>
<key>NSPhotoLibraryUsageDescription</key>
<string>Put here your permission description.</string>
macOS Setup
  • Platform version must be at least 10.15. Please modify macos/Podfile and update accordingly:
platform :osx, '10.15'
  • Please set the minimum deployment target to 10.15. Use XCode to open macos/Runner.xcworkspace:

  • Follow the iOS instructions and modify ios/Runner/Info.plist accordingly.

 

Usage

Basic usage example:

main.dart

// A simple usage of EditableImage.
// This method gets called when trying to change an image.
void _directUpdateImage(File? file) async {
    if (file == null) return;

    setState(() {
      _profilePicFile = file;
    });
}

EditableImage(
// Define the method that will run on the change process of the image.
onChange: (file) => _directUpdateImage(file),

// Define the source of the image.
image: _profilePicFile != null
    ? Image.file(_profilePicFile!, fit: BoxFit.cover)
    : null,

// Define the size of EditableImage.
size: 150.0,

// Define the Theme of image picker.
imagePickerTheme: ThemeData(
    // Define the default brightness and colors.
    primaryColor: Colors.white,
    shadowColor: Colors.transparent,
    backgroundColor: Colors.white70,
    iconTheme: const IconThemeData(color: Colors.black87),

    // Define the default font family.
    fontFamily: 'Georgia',
),

// Define the border of the image if needed.
imageBorder: Border.all(color: Colors.black87, width: 2.0),

// Define the border of the icon if needed.
editIconBorder: Border.all(color: Colors.black87, width: 2.0),
),

 

Example

More examples can be found in /example folder on GitHub.

User Profile 1 - an example of basic implementation of EditableImage. Simple project that simulates user profile edit screen.

User Profile 2 - an example of implementation of EditableImage. Simple project that simulates user profile edit screen.

 

Additional information

This package has been written solely in Dart Language yet it has the wechat_assets_picker as a dependency. Therefore, EditableImage currently supports only Android, iOS, and macOS platforms. In the future, other platform supports may be added.

For more information please visit GitHub.

 

Feature requests and bugs

Please file feature requests and bugs at the issue tracker.

 

Maintainers

所屬分類

依賴

依賴清單 1 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。