Skip to content

Commit

Permalink
feat(dependencies): update emoji_picker_flutter to 4.2.0 and image to…
Browse files Browse the repository at this point in the history
… 4.5.2

Support custom translations in emoji editor for emoji search by updating dependencies.
- Updated `emoji_picker_flutter` to 4.2.0
- Updated `image` to 4.5.2
  • Loading branch information
hm21 committed Jan 2, 2025
1 parent 60d9c7f commit 22a21a2
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 17 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 7.3.0
- **FEAT**(dependencies): Update `emoji_picker_flutter` to `4.2.0` and `image` to `4.5.2`. Adds support for custom translations in emoji editor for emoji search.

## 7.2.0
- **FEAT**(export-history): Introduce the `serializeSticker` parameter to `ExportEditorConfigs` to enable exporting only `StickerLayerData` without converting the sticker to a `Uint8List`. This change incorporates the updates from pull request [#306](https://github.com/hm21/pro_image_editor/pull/306).

Expand Down
24 changes: 20 additions & 4 deletions lib/models/editor_configs/emoji_editor_configs.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Project imports:

import 'dart:ui';

import 'emoji_editor_configs.dart';

export 'package:emoji_picker_flutter/emoji_picker_flutter.dart'
Expand Down Expand Up @@ -34,7 +36,8 @@ class EmojiEditorConfigs {
this.minScale = double.negativeInfinity,
this.maxScale = double.infinity,
this.checkPlatformCompatibility = true,
this.emojiSet = defaultEmojiSet,
this.emojiSet,
this.locale = const Locale('en'),
this.style = const EmojiEditorStyle(),
this.icons = const EmojiEditorIcons(),
}) : assert(initScale > 0, 'initScale must be positive'),
Expand All @@ -50,8 +53,21 @@ class EmojiEditorConfigs {
/// Verify that emoji glyph is supported by the platform (Android only)
final bool checkPlatformCompatibility;

/// Custom emojis; if set, overrides default emojis provided by the library.
final List<CategoryEmoji> emojiSet;
/// Useful to provide a customized list of Emoji or add/remove the support
/// for specific locales
/// (create similar method as in default_emoji_set_locale.dart). If not
/// provided, the default emoji set will be used based on the locales that
/// are available in the package.
final List<CategoryEmoji> Function(Locale)? emojiSet;

/// Locale to choose the fitting language for the emoji set This will affect
/// the emoji search results
///
/// The package currently supports following languages:
/// en, de, es, fr, hi, it, ja, pt, ru, zh.
///
/// Default: const Locale('en')
final Locale locale;

/// The minimum scale factor from the layer.
final double minScale;
Expand All @@ -75,7 +91,7 @@ class EmojiEditorConfigs {
bool? enabled,
double? initScale,
bool? checkPlatformCompatibility,
List<CategoryEmoji>? emojiSet,
List<CategoryEmoji> Function(Locale)? emojiSet,
double? minScale,
double? maxScale,
EmojiEditorStyle? style,
Expand Down
5 changes: 4 additions & 1 deletion lib/modules/emoji_editor/emoji_editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import 'dart:math';

import 'package:emoji_picker_flutter/emoji_picker_flutter.dart';
import 'package:emoji_picker_flutter/locales/default_emoji_set_locale.dart';
import 'package:flutter/foundation.dart' show defaultTargetPlatform;
import 'package:flutter/material.dart';
import 'package:pro_image_editor/modules/emoji_editor/widgets/emoji_editor_category_view.dart';
Expand Down Expand Up @@ -94,6 +95,7 @@ class EmojiEditorState extends State<EmojiEditor>
Config _getEditorConfig(BoxConstraints constraints) {
return Config(
height: double.infinity,
locale: emojiEditorConfigs.locale,
emojiSet: emojiEditorConfigs.emojiSet,
checkPlatformCompatibility: emojiEditorConfigs.checkPlatformCompatibility,
emojiTextStyle: _textStyle,
Expand Down Expand Up @@ -190,7 +192,8 @@ class EmojiEditorState extends State<EmojiEditor>
key: _emojiSearchPageKey,
config: _getEditorConfig(constraints),
state: EmojiViewState(
emojiEditorConfigs.emojiSet,
(emojiEditorConfigs.emojiSet ??
getDefaultEmojiLocale)(emojiEditorConfigs.locale),
(category, emoji) {
Navigator.pop(
context,
Expand Down
8 changes: 2 additions & 6 deletions lib/modules/emoji_editor/widgets/emoji_editor_bottom_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ class EmojiEditorBottomBar extends StatelessWidget {
/// Callback function for closing the skin tone overlay.
final VoidCallback closeSkinToneOverlay;

List<CategoryEmoji> get _categories {
return categoryEmojis.where((el) => el.emoji.isNotEmpty).toList();
}

@override
Widget build(BuildContext context) {
return SizedBox(
Expand All @@ -48,9 +44,9 @@ class EmojiEditorBottomBar extends StatelessWidget {
onTap: (index) {
closeSkinToneOverlay();
EmojiStateManager.of(context)
?.setActiveCategory(_categories[index].category);
?.setActiveCategory(categoryEmojis[index].category);
},
tabs: _categories
tabs: categoryEmojis
.asMap()
.entries
.map<Widget>(
Expand Down
4 changes: 1 addition & 3 deletions lib/modules/emoji_editor/widgets/emoji_picker_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,7 @@ class _DefaultEmojiPickerViewState extends State<ProEmojiPickerView>
}

List<CategoryEmoji> get _categories {
return widget.state.categoryEmoji
.where((el) => el.emoji.isNotEmpty)
.toList();
return widget.state.categoryEmoji.toList();
}

@override
Expand Down
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: pro_image_editor
description: "A Flutter image editor: Seamlessly enhance your images with user-friendly editing features."
version: 7.2.0
version: 7.3.0
homepage: https://github.com/hm21/pro_image_editor/
repository: https://github.com/hm21/pro_image_editor/
issue_tracker: https://github.com/hm21/pro_image_editor/issues/
Expand Down Expand Up @@ -38,9 +38,9 @@ dependencies:
flutter:
sdk: flutter

emoji_picker_flutter: ">=3.1.0 <3.2.0"
emoji_picker_flutter: ^4.2.0
http: ^1.2.2
image: ^4.3.0
image: ^4.5.2
mime: ^2.0.0
vibration: ^2.0.1
web: ^1.1.0
Expand Down

0 comments on commit 22a21a2

Please sign in to comment.