design: New sticker picker next to emoji picker

This commit is contained in:
krille-chan 2024-02-25 16:14:12 +01:00
commit 5a6016931b
No known key found for this signature in database
5 changed files with 118 additions and 98 deletions

View file

@ -2,8 +2,10 @@ import 'package:flutter/material.dart';
import 'package:emoji_picker_flutter/emoji_picker_flutter.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart';
import 'package:fluffychat/config/themes.dart';
import 'package:fluffychat/pages/chat/sticker_picker_dialog.dart';
import 'chat.dart';
class ChatEmojiPicker extends StatelessWidget {
@ -16,30 +18,65 @@ class ChatEmojiPicker extends StatelessWidget {
return AnimatedContainer(
duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve,
clipBehavior: Clip.hardEdge,
decoration: const BoxDecoration(),
height: controller.showEmojiPicker
? MediaQuery.of(context).size.height / 2
: 0,
child: controller.showEmojiPicker
? EmojiPicker(
onEmojiSelected: controller.onEmojiSelected,
onBackspacePressed: controller.emojiPickerBackspace,
config: Config(
backspaceColor: theme.colorScheme.primary,
bgColor: Color.lerp(
theme.colorScheme.background,
theme.colorScheme.primaryContainer,
0.25,
)!,
iconColor: theme.colorScheme.primary.withOpacity(0.5),
iconColorSelected: theme.colorScheme.primary,
indicatorColor: theme.colorScheme.primary,
noRecents: const NoRecent(),
skinToneDialogBgColor: Color.lerp(
theme.colorScheme.background,
theme.colorScheme.primaryContainer,
0.75,
)!,
skinToneIndicatorColor: theme.colorScheme.onBackground,
? 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(
backspaceColor: theme.colorScheme.primary,
bgColor: theme.brightness == Brightness.light
? Colors.white
: Colors.black,
iconColor:
theme.colorScheme.primary.withOpacity(0.5),
iconColorSelected: theme.colorScheme.primary,
indicatorColor: theme.colorScheme.primary,
noRecents: const NoRecent(),
skinToneDialogBgColor: Color.lerp(
theme.colorScheme.background,
theme.colorScheme.primaryContainer,
0.75,
)!,
skinToneIndicatorColor:
theme.colorScheme.onBackground,
),
),
StickerPickerDialog(
room: controller.room,
onSelected: (sticker) {
controller.room.sendEvent(
{
'body': sticker.body,
if (sticker.info != null) 'info': sticker.info,
'url': sticker.url.toString(),
},
type: EventTypes.Sticker,
);
controller.hideEmojiPicker();
},
),
],
),
),
],
),
)
: null,