mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-30 16:29:30 +01:00
feat: Implement emojipicker for reactions
This commit is contained in:
parent
19c04403a2
commit
20b3157473
@ -3,6 +3,7 @@ import 'dart:io';
|
|||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
||||||
|
import 'package:emoji_picker/emoji_picker.dart';
|
||||||
import 'package:famedlysdk/famedlysdk.dart';
|
import 'package:famedlysdk/famedlysdk.dart';
|
||||||
import 'package:file_picker_cross/file_picker_cross.dart';
|
import 'package:file_picker_cross/file_picker_cross.dart';
|
||||||
import 'package:fluffychat/components/adaptive_page_layout.dart';
|
import 'package:fluffychat/components/adaptive_page_layout.dart';
|
||||||
@ -459,6 +460,34 @@ class _ChatState extends State<_Chat> {
|
|||||||
return filteredEvents;
|
return filteredEvents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _pickEmojiAction(BuildContext context) async {
|
||||||
|
final emoji = await showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
builder: (context) => Column(
|
||||||
|
children: [
|
||||||
|
Spacer(),
|
||||||
|
EmojiPicker(
|
||||||
|
onEmojiSelected: (emoji, category) =>
|
||||||
|
Navigator.of(context).pop<Emoji>(emoji),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
if (emoji == null) return;
|
||||||
|
return _sendEmojiAction(context, emoji.emoji);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _sendEmojiAction(BuildContext context, String emoji) {
|
||||||
|
SimpleDialogs(context).tryRequestWithLoadingDialog(
|
||||||
|
room.sendReaction(
|
||||||
|
selectedEvents.first.eventId,
|
||||||
|
emoji,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
setState(() => selectedEvents.clear());
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
matrix = Matrix.of(context);
|
matrix = Matrix.of(context);
|
||||||
@ -830,18 +859,22 @@ class _ChatState extends State<_Chat> {
|
|||||||
});
|
});
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
itemCount: emojis.length,
|
itemCount: emojis.length + 1,
|
||||||
itemBuilder: (c, i) => InkWell(
|
itemBuilder: (c, i) => i == emojis.length
|
||||||
|
? InkWell(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
onTap: () {
|
child: Container(
|
||||||
SimpleDialogs(context).tryRequestWithLoadingDialog(
|
width: 56,
|
||||||
room.sendReaction(
|
height: 56,
|
||||||
selectedEvents.first.eventId,
|
alignment: Alignment.center,
|
||||||
emojis[i],
|
child: Icon(Icons.add_outlined),
|
||||||
),
|
),
|
||||||
);
|
onTap: () => _pickEmojiAction(context),
|
||||||
setState(() => selectedEvents.clear());
|
)
|
||||||
},
|
: InkWell(
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
onTap: () =>
|
||||||
|
_sendEmojiAction(context, emojis[i]),
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 56,
|
width: 56,
|
||||||
height: 56,
|
height: 56,
|
||||||
|
49
pubspec.lock
49
pubspec.lock
@ -183,6 +183,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.0.3"
|
version: "0.0.3"
|
||||||
|
emoji_picker:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: emoji_picker
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.1.0"
|
||||||
encrypt:
|
encrypt:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -872,6 +879,48 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.6.5+4"
|
version: "0.6.5+4"
|
||||||
|
shared_preferences:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: shared_preferences
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.5.12+4"
|
||||||
|
shared_preferences_linux:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: shared_preferences_linux
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.0.2+4"
|
||||||
|
shared_preferences_macos:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: shared_preferences_macos
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.0.1+11"
|
||||||
|
shared_preferences_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: shared_preferences_platform_interface
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.4"
|
||||||
|
shared_preferences_web:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: shared_preferences_web
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.1.2+7"
|
||||||
|
shared_preferences_windows:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: shared_preferences_windows
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.0.1+3"
|
||||||
shelf:
|
shelf:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -64,6 +64,7 @@ dependencies:
|
|||||||
flutter_svg: 0.19.1 # Because fluffychat depends on flutter_svg >=0.19.2 which requires Flutter SDK version >=1.24.0-6.0.pre <2.0.0, version solving failed.
|
flutter_svg: 0.19.1 # Because fluffychat depends on flutter_svg >=0.19.2 which requires Flutter SDK version >=1.24.0-6.0.pre <2.0.0, version solving failed.
|
||||||
flutter_cache_manager: ^2.0.0
|
flutter_cache_manager: ^2.0.0
|
||||||
open_noti_settings: ^0.0.4
|
open_noti_settings: ^0.0.4
|
||||||
|
emoji_picker: ^0.1.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
Loading…
Reference in New Issue
Block a user