Minor emoji picker edits

This commit is contained in:
Kelrap 2024-07-22 16:36:44 -04:00
parent d60fe9e220
commit 5b8c2dc7a8
5 changed files with 141 additions and 120 deletions

View file

@ -378,13 +378,6 @@ class ChatController extends State<ChatPageWithRoom>
setState(() {});
}
// #Pangea
void closeEmojiPicker() {
showEmojiPicker = false;
updateView();
}
// Pangea#
Future<void>? loadTimelineFuture;
int? animateInEventIndex;

View file

@ -14,6 +14,9 @@ class ChatEmojiPicker extends StatelessWidget {
@override
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
// #Pangea
final bool lightMode = Theme.of(context).brightness == Brightness.light;
// Pangea#
return AnimatedContainer(
duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve,
@ -23,68 +26,103 @@ class ChatEmojiPicker extends StatelessWidget {
? MediaQuery.of(context).size.height / 2
: 0,
child: controller.showEmojiPicker
? DefaultTabController(
length: 2,
child: Column(
children: [
TabBar(
tabs: [
Tab(text: L10n.of(context)!.emojis),
Tab(text: L10n.of(context)!.stickers),
?
// #Pangea
Stack(
children: [
// Pangea#
DefaultTabController(
length: 2,
child: Column(
children: [
TabBar(
tabs: [
Tab(text: L10n.of(context)!.emojis),
Tab(text: L10n.of(context)!.stickers),
],
),
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();
},
),
],
),
),
],
),
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,
),
),
),
// #Pangea
// Close button placed at bottom of emoji picker
Positioned(
left: 0,
right: 0,
bottom: 5,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
FloatingActionButton(
onPressed: controller.hideEmojiPicker,
backgroundColor: lightMode
? const Color.fromARGB(255, 211, 211, 211)
: Colors.black,
shape: const CircleBorder(),
heroTag: null,
mini: true,
child: const Icon(
Icons.close,
size: 20,
),
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#
],
)
: null,
);

View file

@ -350,7 +350,16 @@ class ChatView extends StatelessWidget {
ITBar(
choreographer: controller.choreographer,
),
ReplyDisplay(controller),
Row(
// crossAxisAlignment: CrossAxisAlignment.end,
crossAxisAlignment:
CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
ReplyDisplay(controller),
],
),
],
),
),
@ -481,29 +490,6 @@ class ChatView extends StatelessWidget {
right: 0,
child: ChatEmojiPicker(controller),
),
// Close button placed at bottom of emoji picker
if (controller.showEmojiPicker)
Positioned(
left: 0,
right: 0,
bottom: 5,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
FloatingActionButton(
onPressed: controller.closeEmojiPicker,
backgroundColor: Colors.black,
shape: const CircleBorder(),
heroTag: null,
mini: true,
child: const Icon(
Icons.close,
size: 20,
),
),
],
),
),
// Pangea#
],
),

View file

@ -1,9 +1,8 @@
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
import '../../../config/app_config.dart';
class ReplyContent extends StatelessWidget {

View file

@ -13,35 +13,40 @@ class ReplyDisplay extends StatelessWidget {
@override
Widget build(BuildContext context) {
return AnimatedContainer(
duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve,
height: controller.editEvent != null || controller.replyEvent != null
? 56
: 0,
clipBehavior: Clip.hardEdge,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.onInverseSurface,
),
child: Row(
children: <Widget>[
IconButton(
tooltip: L10n.of(context)!.close,
icon: const Icon(Icons.close),
onPressed: controller.cancelReplyEventAction,
),
Expanded(
child: controller.replyEvent != null
? ReplyContent(
controller.replyEvent!,
timeline: controller.timeline!,
backgroundColor: Colors.transparent,
)
: _EditContent(
controller.editEvent?.getDisplayEvent(controller.timeline!),
),
),
],
return Padding(
padding: const EdgeInsets.all(8.0),
child: AnimatedContainer(
duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve,
height: controller.editEvent != null || controller.replyEvent != null
? 56
: 0,
clipBehavior: Clip.hardEdge,
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(28.0)),
color: Theme.of(context).colorScheme.onInverseSurface,
),
child: Row(
children: <Widget>[
IconButton(
tooltip: L10n.of(context)!.close,
icon: const Icon(Icons.close),
onPressed: controller.cancelReplyEventAction,
),
Expanded(
child: controller.replyEvent != null
? ReplyContent(
controller.replyEvent!,
timeline: controller.timeline!,
backgroundColor: Colors.transparent,
)
: _EditContent(
controller.editEvent
?.getDisplayEvent(controller.timeline!),
),
),
],
),
),
);
}