Skip to content

Commit 98c1852

Browse files
authored
Merge pull request #36 from weta-vn/dev_/customstickers
Add custom stickers
2 parents 9ad7c09 + e3acce6 commit 98c1852

File tree

13 files changed

+37
-9
lines changed

13 files changed

+37
-9
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1+
## [0.1.5+1]
2+
3+
* **New features:**
4+
* Add custom stickers (by @matthewmizzi suggestion)
5+
16
## [0.1.5]
27

38
* **New features:**
49
* Object detection & OCR extraction interface for image
510

6-
## [0.1.4]
11+
## [0.1.4]d
712

813
* **New `ImagePickerConfigs` features:**
914
* Camera flash mode `flashMode`, the starting flash mode for the camera

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Flutter plugin for selecting **multiple images** from the Android and iOS image
1818
- Easy image editing features, such as rotation, cropping, adding sticker/filters
1919
- Allow user add external image editors for editing selected images.
2020
- Support for displaying object detection & OCR result on selected image view
21+
- Allow setting user's own stickers
2122

2223
## Apps using this package
2324

example/assets/icon/cus1.png

30 KB
Loading

example/assets/icon/cus2.png

23.9 KB
Loading

example/assets/icon/cus3.png

24.2 KB
Loading

example/assets/icon/cus4.png

18.5 KB
Loading

example/assets/icon/cus5.png

25.8 KB
Loading

example/lib/main.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,16 @@ class MyApp extends StatelessWidget {
9292
}
9393
};
9494

95+
// Example about custom stickers
96+
configs.customStickerOnly = true;
97+
configs.customStickers = [
98+
'assets/icon/cus1.png',
99+
'assets/icon/cus2.png',
100+
'assets/icon/cus3.png',
101+
'assets/icon/cus4.png',
102+
'assets/icon/cus5.png'
103+
];
104+
95105
return MaterialApp(
96106
title: 'Flutter Demo',
97107
theme: ThemeData(

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ packages:
77
path: ".."
88
relative: true
99
source: path
10-
version: "0.1.5"
10+
version: "0.1.5+1"
1111
archive:
1212
dependency: transitive
1313
description:

example/pubspec.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,9 @@ flutter:
4646
# the material Icons class.
4747
uses-material-design: true
4848

49-
# To add assets to your application, add an assets section, like this:
50-
# assets:
51-
# - images/a_dot_burr.jpeg
52-
# - images/a_dot_ham.jpeg
49+
# To add assets to your package, add an assets section, like this:
50+
assets:
51+
- assets/icon/
5352

5453
# An image asset can refer to one or more resolution-specific "variants", see
5554
# https://flutter.dev/assets-and-images/#resolution-aware.

lib/configs/image_picker_configs.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,14 @@ class ImagePickerConfigs {
188188
/// Detect OCR from image function
189189
Future<String> Function(String path, {bool? isCloudService})? ocrExtractFunc;
190190

191+
/// Custom sticker only flag
192+
///
193+
/// Defaults to false.
194+
bool customStickerOnly = false;
195+
196+
/// Custom sticker paths
197+
List<String> customStickers = [];
198+
191199
/// Camera direction setting.
192200
///
193201
/// Options:

lib/widgets/editors/image_sticker.dart

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,20 @@ class _ImageStickerState extends State<ImageSticker>
6565
void initState() {
6666
super.initState();
6767

68+
if (widget.configs != null) _configs = widget.configs!;
69+
6870
_attachedList = [];
6971
_stickerList = List<int>.generate(34, (index) => index + 1)
7072
.map((e) => Image.asset(
71-
"assets/icon/$e.png",
73+
'assets/icon/$e.png',
7274
package: 'advance_image_picker',
7375
))
7476
.toList();
7577

76-
if (widget.configs != null) _configs = widget.configs!;
78+
if (_configs.customStickers.isNotEmpty) {
79+
if (_configs.customStickerOnly) _stickerList.clear();
80+
_stickerList.addAll(_configs.customStickers.map((e) => Image.asset(e)));
81+
}
7782
}
7883

7984
@override

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: advance_image_picker
22
description: Flutter plugin in pure Dart code for selecting/editing multiple images from the Android/iOS image library and taking new pictures with the camera in the same view.
3-
version: 0.1.5
3+
version: 0.1.5+1
44
homepage: https://freemar.vn
55
repository: https://github.com/weta-vn/advance_image_picker
66

0 commit comments

Comments
 (0)