fluffychat merge
This commit is contained in:
commit
006ad4a09e
5 changed files with 34 additions and 23 deletions
|
|
@ -75,6 +75,7 @@ enum AppSettings<T> {
|
||||||
// #Pangea
|
// #Pangea
|
||||||
volume<double>('pangea.volume', 1.0),
|
volume<double>('pangea.volume', 1.0),
|
||||||
// Pangea#
|
// Pangea#
|
||||||
|
emojiSuggestionLocale<String>('emoji_suggestion_locale', ''),
|
||||||
enableSoftLogout<bool>('chat.fluffy.enable_soft_logout', false);
|
enableSoftLogout<bool>('chat.fluffy.enable_soft_logout', false);
|
||||||
|
|
||||||
final String key;
|
final String key;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,5 @@
|
||||||
// import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
// import 'package:animations/animations.dart';
|
// import 'package:animations/animations.dart';
|
||||||
// import 'package:matrix/matrix.dart';
|
// import 'package:emoji_picker_flutter/locales/default_emoji_set_locale.dart';
|
||||||
|
|
||||||
// import 'package:fluffychat/config/setting_keys.dart';
|
// import 'package:fluffychat/config/setting_keys.dart';
|
||||||
// import 'package:fluffychat/l10n/l10n.dart';
|
// import 'package:fluffychat/l10n/l10n.dart';
|
||||||
// import 'package:fluffychat/pages/chat/recording_input_row.dart';
|
// import 'package:fluffychat/pages/chat/recording_input_row.dart';
|
||||||
|
|
@ -11,6 +8,9 @@
|
||||||
// import 'package:fluffychat/utils/platform_infos.dart';
|
// import 'package:fluffychat/utils/platform_infos.dart';
|
||||||
// import 'package:fluffychat/widgets/avatar.dart';
|
// import 'package:fluffychat/widgets/avatar.dart';
|
||||||
// import 'package:fluffychat/widgets/matrix.dart';
|
// import 'package:fluffychat/widgets/matrix.dart';
|
||||||
|
// import 'package:flutter/material.dart';
|
||||||
|
// import 'package:matrix/matrix.dart';
|
||||||
|
|
||||||
// import '../../config/themes.dart';
|
// import '../../config/themes.dart';
|
||||||
// import 'chat.dart';
|
// import 'chat.dart';
|
||||||
// import 'input_bar.dart';
|
// import 'input_bar.dart';
|
||||||
|
|
@ -334,6 +334,14 @@
|
||||||
// filled: false,
|
// filled: false,
|
||||||
// ),
|
// ),
|
||||||
// onChanged: controller.onInputBarChanged,
|
// onChanged: controller.onInputBarChanged,
|
||||||
|
// suggestionEmojis: getDefaultEmojiLocale(
|
||||||
|
// AppSettings.emojiSuggestionLocale.value.isNotEmpty
|
||||||
|
// ? Locale(AppSettings.emojiSuggestionLocale.value)
|
||||||
|
// : Localizations.localeOf(context),
|
||||||
|
// ).fold(
|
||||||
|
// [],
|
||||||
|
// (emojis, category) => emojis..addAll(category.emoji),
|
||||||
|
// ),
|
||||||
// ),
|
// ),
|
||||||
// ),
|
// ),
|
||||||
// ),
|
// ),
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
import 'package:emojis/emoji.dart';
|
import 'package:emoji_picker_flutter/emoji_picker_flutter.dart';
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
import 'package:slugify/slugify.dart';
|
import 'package:slugify/slugify.dart';
|
||||||
|
|
||||||
|
|
@ -42,6 +42,7 @@ class InputBar extends StatelessWidget {
|
||||||
final ValueChanged<String>? onChanged;
|
final ValueChanged<String>? onChanged;
|
||||||
final bool? autofocus;
|
final bool? autofocus;
|
||||||
final bool readOnly;
|
final bool readOnly;
|
||||||
|
final List<Emoji> suggestionEmojis;
|
||||||
|
|
||||||
const InputBar({
|
const InputBar({
|
||||||
required this.room,
|
required this.room,
|
||||||
|
|
@ -61,6 +62,7 @@ class InputBar extends StatelessWidget {
|
||||||
required this.choreographer,
|
required this.choreographer,
|
||||||
required this.showNextMatch,
|
required this.showNextMatch,
|
||||||
// Pangea#
|
// Pangea#
|
||||||
|
required this.suggestionEmojis,
|
||||||
super.key,
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -135,13 +137,12 @@ class InputBar extends StatelessWidget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// aside of emote packs, also propose normal (tm) unicode emojis
|
// aside of emote packs, also propose normal (tm) unicode emojis
|
||||||
final matchingUnicodeEmojis = Emoji.all()
|
final matchingUnicodeEmojis = suggestionEmojis
|
||||||
.where(
|
.where((emoji) => emoji.name.toLowerCase().contains(emoteSearch))
|
||||||
(element) => [element.name, ...element.keywords]
|
|
||||||
.any((element) => element.toLowerCase().contains(emoteSearch)),
|
|
||||||
)
|
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
// sort by the index of the search term in the name in order to have
|
// sort by the index of the search term in the name in order to have
|
||||||
// best matches first
|
// best matches first
|
||||||
// (thanks for the hint by github.com/nextcloud/circles devs)
|
// (thanks for the hint by github.com/nextcloud/circles devs)
|
||||||
|
|
@ -161,9 +162,8 @@ class InputBar extends StatelessWidget {
|
||||||
for (final emoji in matchingUnicodeEmojis) {
|
for (final emoji in matchingUnicodeEmojis) {
|
||||||
ret.add({
|
ret.add({
|
||||||
'type': 'emoji',
|
'type': 'emoji',
|
||||||
'emoji': emoji.char,
|
'emoji': emoji.emoji,
|
||||||
// don't include sub-group names, splitting at `:` hence
|
'label': emoji.name,
|
||||||
'label': '${emoji.char} - ${emoji.name.split(':').first}',
|
|
||||||
'current_word': ':$emoteSearch',
|
'current_word': ':$emoteSearch',
|
||||||
});
|
});
|
||||||
if (ret.length > maxResults) {
|
if (ret.length > maxResults) {
|
||||||
|
|
@ -269,7 +269,18 @@ class InputBar extends StatelessWidget {
|
||||||
waitDuration: const Duration(days: 1), // don't show on hover
|
waitDuration: const Duration(days: 1), // don't show on hover
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
onTap: () => onSelected(suggestion),
|
onTap: () => onSelected(suggestion),
|
||||||
title: Text(label, style: const TextStyle(fontFamily: 'RobotoMono')),
|
leading: SizedBox.square(
|
||||||
|
dimension: size,
|
||||||
|
child: Text(
|
||||||
|
suggestion['emoji']!,
|
||||||
|
style: const TextStyle(fontSize: 16),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
title: Text(
|
||||||
|
label,
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -513,14 +513,6 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.3.0"
|
version: "4.3.0"
|
||||||
emojis:
|
|
||||||
dependency: "direct main"
|
|
||||||
description:
|
|
||||||
name: emojis
|
|
||||||
sha256: "2e4d847c3f1e2670f30dc355909ce6fa7808b4e626c34a4dd503a360995a38bf"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "0.9.9"
|
|
||||||
equatable:
|
equatable:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,6 @@ dependencies:
|
||||||
diacritic: ^0.1.6
|
diacritic: ^0.1.6
|
||||||
dynamic_color: ^1.8.1
|
dynamic_color: ^1.8.1
|
||||||
emoji_picker_flutter: ^4.3.0
|
emoji_picker_flutter: ^4.3.0
|
||||||
emojis: ^0.9.9
|
|
||||||
file_picker: ^10.3.6
|
file_picker: ^10.3.6
|
||||||
file_selector: ^1.0.4
|
file_selector: ^1.0.4
|
||||||
flutter:
|
flutter:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue