Skip to content

Commit

Permalink
Merge pull request weta-vn#36 from weta-vn/dev_/customstickers
Browse files Browse the repository at this point in the history
Add custom stickers
  • Loading branch information
weta-vn authored Oct 11, 2021
2 parents 9ad7c09 + e3acce6 commit 98c1852
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 9 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Binary file added example/assets/icon/cus1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/assets/icon/cus2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/assets/icon/cus3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/assets/icon/cus4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/assets/icon/cus5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.1.5"
version: "0.1.5+1"
archive:
dependency: transitive
description:
Expand Down
7 changes: 3 additions & 4 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 8 additions & 0 deletions lib/configs/image_picker_configs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,14 @@ class ImagePickerConfigs {
/// Detect OCR from image function
Future<String> Function(String path, {bool? isCloudService})? ocrExtractFunc;

/// Custom sticker only flag
///
/// Defaults to false.
bool customStickerOnly = false;

/// Custom sticker paths
List<String> customStickers = [];

/// Camera direction setting.
///
/// Options:
Expand Down
9 changes: 7 additions & 2 deletions lib/widgets/editors/image_sticker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,20 @@ class _ImageStickerState extends State<ImageSticker>
void initState() {
super.initState();

if (widget.configs != null) _configs = widget.configs!;

_attachedList = [];
_stickerList = List<int>.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
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit 98c1852

Please sign in to comment.