diff --git a/CHANGELOG.md b/CHANGELOG.md index a19ebb9..e3b5cfc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 1.2.0 +- Breaking Change: `noRecentsText` of type `String` was changed to `noRecents` of type `Widget` and `noRecentsStyle` was removed from `Config` + ## 1.1.2 - Fix a issue with macos platform 👨‍🔧 - Close Skin-Tone dialog on several other timings diff --git a/README.md b/README.md index f136311..8727d85 100644 --- a/README.md +++ b/README.md @@ -51,12 +51,14 @@ EmojiPicker( enableSkinTones: true, showRecentsTab: true, recentsLimit: 28, - noRecentsText: "No Recents", - noRecentsStyle: - const TextStyle(fontSize: 20, color: Colors.black26), + noRecents: const Text( + 'No Recents', + style: TextStyle(fontSize: 20, color: Colors.black26), + textAlign: TextAlign.center, + ), tabIndicatorAnimDuration: kTabScrollDuration, categoryIcons: const CategoryIcons(), - buttonMode: ButtonMode.MATERIAL + buttonMode: ButtonMode.MATERIAL, ), ) ``` @@ -82,8 +84,7 @@ See the [demo](https://github.com/Fintasys/emoji_picker_flutter/blob/master/exam | enableSkinTones | Enable feature to select a skin tone of certain emoji's | true | | showRecentsTab | Show extra tab with recently used emoji | true | | recentsLimit | Limit of recently used emoji that will be saved | 28 | -| noRecentsText | The text to be displayed if no recent emojis to display | "No Recents" | -| noRecentsStyle | The text style for [noRecentsText] | TextStyle(fontSize: 20, color: Colors.black26) | +| noRecents | A widget (usually [Text]) to be displayed if no recent emojis to display | Text('No Recents', style: TextStyle(fontSize: 20, color: Colors.black26), textAlign: TextAlign.center) | | tabIndicatorAnimDuration | Duration of tab indicator to animate to next category | Duration(milliseconds: 300) | | categoryIcons | Determines the icon to display for each Category. You can change icons by setting them in the constructor. | CategoryIcons() | | buttonMode | Choose between Material and Cupertino button style | ButtonMode.MATERIAL | diff --git a/example/lib/main.dart b/example/lib/main.dart index 9326cc6..f382413 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -123,9 +123,11 @@ class _MyAppState extends State { enableSkinTones: true, showRecentsTab: true, recentsLimit: 28, - noRecentsText: 'No Recents', - noRecentsStyle: const TextStyle( - fontSize: 20, color: Colors.black26), + noRecents: const Text( + 'No Recents', + style: TextStyle(fontSize: 20, color: Colors.black26), + textAlign: TextAlign.center, + ), tabIndicatorAnimDuration: kTabScrollDuration, categoryIcons: const CategoryIcons(), buttonMode: ButtonMode.MATERIAL)), diff --git a/example/pubspec.lock b/example/pubspec.lock index 7063926..ab416b9 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -21,7 +21,7 @@ packages: path: ".." relative: true source: path - version: "1.1.2" + version: "1.2.0" ffi: dependency: transitive description: @@ -53,6 +53,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.6.3" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.3" meta: dependency: transitive description: diff --git a/lib/src/config.dart b/lib/src/config.dart index 1383c0e..527ff8a 100644 --- a/lib/src/config.dart +++ b/lib/src/config.dart @@ -4,6 +4,13 @@ import 'package:emoji_picker_flutter/src/category_icons.dart'; import 'package:emoji_picker_flutter/src/emoji_picker.dart'; import 'package:flutter/material.dart'; +/// Default Widget if no recent is available +const DefaultNoRecentsWidget = Text( + 'No Recents', + style: TextStyle(fontSize: 20, color: Colors.black26), + textAlign: TextAlign.center, +); + /// Config for customizations class Config { /// Constructor @@ -24,9 +31,7 @@ class Config { this.enableSkinTones = true, this.showRecentsTab = true, this.recentsLimit = 28, - this.noRecentsText = 'No Recents', - this.noRecentsStyle = - const TextStyle(fontSize: 20, color: Colors.black26), + this.noRecents = DefaultNoRecentsWidget, this.tabIndicatorAnimDuration = kTabScrollDuration, this.categoryIcons = const CategoryIcons(), this.buttonMode = ButtonMode.MATERIAL}); @@ -81,11 +86,8 @@ class Config { /// Limit of recently used emoji that will be saved final int recentsLimit; - /// The text to be displayed if no recent emojis to display - final String noRecentsText; - - /// The text style for [noRecentsText] - final TextStyle noRecentsStyle; + /// A widget (usually [Text]) to be displayed if no recent emojis to display + final Widget noRecents; /// Duration of tab indicator to animate to next category final Duration tabIndicatorAnimDuration; @@ -147,8 +149,7 @@ class Config { other.enableSkinTones == enableSkinTones && other.showRecentsTab == showRecentsTab && other.recentsLimit == recentsLimit && - other.noRecentsText == noRecentsText && - other.noRecentsStyle == noRecentsStyle && + other.noRecents == noRecents && other.tabIndicatorAnimDuration == tabIndicatorAnimDuration && other.categoryIcons == categoryIcons && other.buttonMode == buttonMode; @@ -172,8 +173,7 @@ class Config { enableSkinTones.hashCode ^ showRecentsTab.hashCode ^ recentsLimit.hashCode ^ - noRecentsText.hashCode ^ - noRecentsStyle.hashCode ^ + noRecents.hashCode ^ tabIndicatorAnimDuration.hashCode ^ categoryIcons.hashCode ^ buttonMode.hashCode; diff --git a/lib/src/default_emoji_picker_view.dart b/lib/src/default_emoji_picker_view.dart index 09ac060..7761e01 100644 --- a/lib/src/default_emoji_picker_view.dart +++ b/lib/src/default_emoji_picker_view.dart @@ -269,11 +269,8 @@ class _DefaultEmojiPickerViewState extends State /// Build Widget for when no recent emoji are available Widget _buildNoRecent() { return Center( - child: Text( - widget.config.noRecentsText, - style: widget.config.noRecentsStyle, - textAlign: TextAlign.center, - )); + child: widget.config.noRecents, + ); } /// Overlay for SkinTone diff --git a/pubspec.lock b/pubspec.lock index 0b40d31..e947c71 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -165,6 +165,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.12.11" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.3" meta: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index a57aa22..df28ade 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: emoji_picker_flutter description: A Flutter package that provides an Emoji picker widget with 1500+ emojis in 8 categories. -version: 1.1.2 +version: 1.2.0 homepage: https://github.com/Fintasys/emoji_picker_flutter environment: