removed duplicate emoji picker widgets and fixed name of variable in chat controller to resolve late initialization error when sending an emoji reaction
This commit is contained in:
parent
23a8e1f7ea
commit
9eb40e2b21
2 changed files with 6 additions and 59 deletions
|
|
@ -849,12 +849,9 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
});
|
||||
}
|
||||
|
||||
// #Pangea
|
||||
// void hideEmojiPicker() {
|
||||
void hideEmojiPicker({bool closeOverlay = false}) {
|
||||
if (closeOverlay) {
|
||||
MatrixState.pAnyState.closeOverlay();
|
||||
}
|
||||
void hideEmojiPicker() {
|
||||
// #Pangea
|
||||
clearSelectedEvents();
|
||||
// Pangea#
|
||||
setState(() => showEmojiPicker = false);
|
||||
}
|
||||
|
|
@ -1221,7 +1218,7 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
setState(() => showEmojiPicker = false);
|
||||
if (emoji == null) return;
|
||||
// make sure we don't send the same emoji twice
|
||||
if (allReactionEvents.any(
|
||||
if (_allReactionEvents.any(
|
||||
(e) => e.content.tryGetMap('m.relates_to')?['key'] == emoji.emoji,
|
||||
)) {
|
||||
return;
|
||||
|
|
@ -1245,7 +1242,7 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
);
|
||||
}
|
||||
|
||||
late Iterable<Event> allReactionEvents;
|
||||
late Iterable<Event> _allReactionEvents;
|
||||
|
||||
void emojiPickerBackspace() {
|
||||
switch (emojiPickerType) {
|
||||
|
|
@ -1266,7 +1263,7 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
// #Pangea
|
||||
closeSelectionOverlay();
|
||||
// Pangea#
|
||||
allReactionEvents = allReactionEvents;
|
||||
_allReactionEvents = allReactionEvents;
|
||||
emojiPickerType = EmojiPickerType.reaction;
|
||||
setState(() => showEmojiPicker = true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,56 +82,6 @@ class ChatEmojiPicker extends StatelessWidget {
|
|||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
children: [
|
||||
EmojiPicker(
|
||||
onEmojiSelected: controller.onEmojiSelected,
|
||||
onBackspacePressed: controller.emojiPickerBackspace,
|
||||
config: Config(
|
||||
emojiViewConfig: EmojiViewConfig(
|
||||
noRecents: const NoRecent(),
|
||||
backgroundColor: Theme.of(context)
|
||||
.colorScheme
|
||||
.onInverseSurface,
|
||||
),
|
||||
bottomActionBarConfig: const BottomActionBarConfig(
|
||||
enabled: false,
|
||||
),
|
||||
categoryViewConfig: CategoryViewConfig(
|
||||
backspaceColor: theme.colorScheme.primary,
|
||||
iconColor:
|
||||
theme.colorScheme.primary.withOpacity(0.5),
|
||||
iconColorSelected: theme.colorScheme.primary,
|
||||
indicatorColor: theme.colorScheme.primary,
|
||||
),
|
||||
skinToneConfig: SkinToneConfig(
|
||||
dialogBackgroundColor: Color.lerp(
|
||||
theme.colorScheme.surface,
|
||||
theme.colorScheme.primaryContainer,
|
||||
0.75,
|
||||
)!,
|
||||
indicatorColor: theme.colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
),
|
||||
StickerPickerDialog(
|
||||
room: controller.room,
|
||||
onSelected: (sticker) {
|
||||
controller.room.sendEvent(
|
||||
{
|
||||
'body': sticker.body,
|
||||
'info': sticker.info ?? {},
|
||||
'url': sticker.url.toString(),
|
||||
},
|
||||
type: EventTypes.Sticker,
|
||||
);
|
||||
controller.hideEmojiPicker();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// #Pangea
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue