暂无描述
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 3 个月前 | ||
| 8 年前 | ||
| 5 年前 | ||
| 2 个月前 | ||
| 6 年前 | ||
| 5 年前 | ||
| 1 个月前 | ||
| 2 年前 | ||
| 12 天前 | ||
| 5 年前 | ||
| 1 年前 | ||
| 8 年前 | ||
| 3 个月前 | ||
| 11 天前 | ||
| 11 天前 | ||
| 1 年前 | ||
| 3 年前 | ||
| 1 个月前 | ||
| 8 年前 | ||
| 8 年前 | ||
| 2 年前 |
flutter_native_image
本项目基于 flutter_native_image 开发。
1. 安装与使用
1.1 安装方式
进入到工程目录并在 pubspec.yaml 中添加以下依赖:
pubspec.yaml
...
dependencies:
flutter_native_image:
git:
url: https://gitcode.com/CPF-Flutter/flutter_native_image.git
# ref: 根据下方表格选择不同框架适配的TAG版本
ref: 0.0.6_1-ohos-1.0.0
...
执行命令
flutter pub get
TAG 命名规则:
原库版本-ohos-版本号,不同TAG之间的变更详见 CHANGELOG.OpenHarmony.md。
| Flutter框架版本 | TAG名称 | 分支名 |
|---|---|---|
| 3.7 | 0.0.6_1-ohos-1.0.0 | master |
| 3.22 | - | - |
| 3.27 | 0.0.6_1-ohos-1.0.0 | master |
| 3.35 | 0.0.6_1-ohos-1.0.0 | master |
1.2 使用案例
使用案例详见 example。
2. 约束与限制
2.1 兼容性
在以下版本中已测试通过:
- Flutter: 3.7.12-ohos-1.1.3; SDK: 5.0.0(12); IDE: DevEco Studio: 5.1.0.828; ROM: 5.1.0.130 SP8;
- Flutter: 3.22.1-ohos-1.0.3; SDK: 5.0.0(12); IDE: DevEco Studio: 5.1.0.828; ROM: 5.1.0.130 SP8;
- Flutter: 3.35.8-ohos-0.0.1-canary1; SDK: 6.0.1(21); IDE: DevEco Studio: 6.0.1.260; ROM: 6.0.0.130 SP8;
3. API
"ohos Support"列为 yes 表示 ohos 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。
| Name | Description | Type | Input | Output | ohos Support |
|---|---|---|---|---|---|
| compressImage | Compress an image | function | String fileName,{int percentage = 70,int quality = 70,int targetWidth = 0,int targetHeight = 0} | Future | yes |
| getImageProperties | Gets the properties of an image | function | String fileName | Future | yes |
| cropImage | Crops an image | function | String fileName, int originX, int originY, int width, int height | Future | yes |
4. 属性
"ohos Support"列为 yes 表示 ohos 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。
4.1 compressImage
| Name | Description | Type | Input | Output | ohos Support |
|---|---|---|---|---|---|
| fileName | Path of the image file to compress | String | / | / | yes |
| percentage | Resize percentage (0-100) for scaling | int | / | / | yes |
| quality | Compression quality (0-100) | int | / | / | yes |
| targetWidth | Target width in pixels (overrides percentage) | int | / | / | yes |
| targetHeight | Target height in pixels (overrides percentage) | int | / | / | yes |
4.2 ImageProperties
| Name | Description | Type | Input | Ouput | ohos Support |
|---|---|---|---|---|---|
| width | Width of the image | int? | / | / | yes |
| height | Height of the image | int? | / | / | yes |
| orientation | Orientation flag | ImageOrientation | / | / | yes |
4.3 cropImage
| Name | Description | Type | Input | Output | ohos Support |
|---|---|---|---|---|---|
| fileName | Path of the image file to crop | String | / | / | yes |
| originX | X-coordinate of crop origin | int | / | / | yes |
| originY | Y-coordinate of crop origin | int | / | / | yes |
| width | Width of the crop area | int | / | / | yes |
| height | Height of the crop area | int | / | / | yes |
5. 遗留问题
6. 其他
7. 开源协议
本项目基于 The MIT License,请自由地享受和参与开源。