BC 图片编辑器
您可以使用此软件包编辑图片,也可以通过将前景设置为 null 来创建灵活的预览图像。目前,您只能使用资源文件。
特点
- 背景和前景(可选)图像
- 调整图像大小
- 设置 x,y 位置
- 在 x, y 轴上 3D 旋转图像(仅限前景)
- 2D 旋转前景图像
- 详细视图的比例
- 使用设备文件或资源文件
入门
导入
import 'package:bc_image_editor/bc_image_editor.dart';
使用方法
BcImageEditor(
frontImage: "image/path",
bgImage: "image/path",
frontWidth: 200,
frontHeight: 300,
bgWidth: 300,
bgHeight: 200, //If one of variable of width and height not setted or set to null, the other one will auto scale
frontLeft: 10,
frontTop: 10,
bgLeft: 10,
bgTop: 10,
frontBoxFit: BoxFit.fill,
bgBoxFit: BoxFit.fill,
rotateX: 0, //rotateX and y are on 3D axis
rotateY: 0,
rotate2D: 0,
),
使用资源文件夹中的图像
首先初始化您的路径名
String imagePath = "";
然后创建一个如下的异步函数并在 initState 中使用它
void initFiles() async {
File tempImg =
await getImageFileFromAssets("assets/image/path");
setState(() {
imagePath = tempImg.path;
});
}
示例
即将推出
许可
MIT 许可
附加信息
这是我在 pub.dev 上的第一个软件包,我会努力改进它。