diff --git a/CHANGELOG.md b/CHANGELOG.md index 726b5c9..af2d8d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,14 @@ +## [0.1.5+1] + +* **New features:** + * Add custom stickers (by @matthewmizzi suggestion) + ## [0.1.5] * **New features:** * Object detection & OCR extraction interface for image -## [0.1.4] +## [0.1.4]d * **New `ImagePickerConfigs` features:** * Camera flash mode `flashMode`, the starting flash mode for the camera diff --git a/README.md b/README.md index 2b181ab..478fa16 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ Flutter plugin for selecting **multiple images** from the Android and iOS image - Easy image editing features, such as rotation, cropping, adding sticker/filters - Allow user add external image editors for editing selected images. - Support for displaying object detection & OCR result on selected image view +- Allow setting user's own stickers ## Apps using this package diff --git a/example/assets/icon/cus1.png b/example/assets/icon/cus1.png new file mode 100644 index 0000000..6f1267d Binary files /dev/null and b/example/assets/icon/cus1.png differ diff --git a/example/assets/icon/cus2.png b/example/assets/icon/cus2.png new file mode 100644 index 0000000..c35389a Binary files /dev/null and b/example/assets/icon/cus2.png differ diff --git a/example/assets/icon/cus3.png b/example/assets/icon/cus3.png new file mode 100644 index 0000000..d955cc3 Binary files /dev/null and b/example/assets/icon/cus3.png differ diff --git a/example/assets/icon/cus4.png b/example/assets/icon/cus4.png new file mode 100644 index 0000000..db5d9c5 Binary files /dev/null and b/example/assets/icon/cus4.png differ diff --git a/example/assets/icon/cus5.png b/example/assets/icon/cus5.png new file mode 100644 index 0000000..2e72263 Binary files /dev/null and b/example/assets/icon/cus5.png differ diff --git a/example/lib/main.dart b/example/lib/main.dart index 5efa395..f8bc41a 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -92,6 +92,16 @@ class MyApp extends StatelessWidget { } }; + // Example about custom stickers + configs.customStickerOnly = true; + configs.customStickers = [ + 'assets/icon/cus1.png', + 'assets/icon/cus2.png', + 'assets/icon/cus3.png', + 'assets/icon/cus4.png', + 'assets/icon/cus5.png' + ]; + return MaterialApp( title: 'Flutter Demo', theme: ThemeData( diff --git a/example/pubspec.lock b/example/pubspec.lock index 90759e6..05af30f 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -7,7 +7,7 @@ packages: path: ".." relative: true source: path - version: "0.1.5" + version: "0.1.5+1" archive: dependency: transitive description: diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 5f70836..0b670fe 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -46,10 +46,9 @@ flutter: # the material Icons class. uses-material-design: true - # To add assets to your application, add an assets section, like this: - # assets: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg + # To add assets to your package, add an assets section, like this: + assets: + - assets/icon/ # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware. diff --git a/lib/configs/image_picker_configs.dart b/lib/configs/image_picker_configs.dart index 2b23e86..14325cc 100644 --- a/lib/configs/image_picker_configs.dart +++ b/lib/configs/image_picker_configs.dart @@ -188,6 +188,14 @@ class ImagePickerConfigs { /// Detect OCR from image function Future Function(String path, {bool? isCloudService})? ocrExtractFunc; + /// Custom sticker only flag + /// + /// Defaults to false. + bool customStickerOnly = false; + + /// Custom sticker paths + List customStickers = []; + /// Camera direction setting. /// /// Options: diff --git a/lib/widgets/editors/image_sticker.dart b/lib/widgets/editors/image_sticker.dart index 135963d..0276a1b 100644 --- a/lib/widgets/editors/image_sticker.dart +++ b/lib/widgets/editors/image_sticker.dart @@ -65,15 +65,20 @@ class _ImageStickerState extends State void initState() { super.initState(); + if (widget.configs != null) _configs = widget.configs!; + _attachedList = []; _stickerList = List.generate(34, (index) => index + 1) .map((e) => Image.asset( - "assets/icon/$e.png", + 'assets/icon/$e.png', package: 'advance_image_picker', )) .toList(); - if (widget.configs != null) _configs = widget.configs!; + if (_configs.customStickers.isNotEmpty) { + if (_configs.customStickerOnly) _stickerList.clear(); + _stickerList.addAll(_configs.customStickers.map((e) => Image.asset(e))); + } } @override diff --git a/pubspec.yaml b/pubspec.yaml index d16db50..3b031d0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: advance_image_picker 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. -version: 0.1.5 +version: 0.1.5+1 homepage: https://freemar.vn repository: https://github.com/weta-vn/advance_image_picker