some simplifications of input bar stack

This commit is contained in:
ggurdin 2024-07-26 11:36:36 -04:00
parent db168c805f
commit 42ced399aa
3 changed files with 85 additions and 129 deletions

View file

@ -14,9 +14,6 @@ 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,
@ -26,103 +23,79 @@ class ChatEmojiPicker extends StatelessWidget {
? MediaQuery.of(context).size.height / 2
: 0,
child: controller.showEmojiPicker
?
// #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,
),
),
? 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,
),
StickerPickerDialog(
room: controller.room,
onSelected: (sticker) {
controller.room.sendEvent(
{
'body': sticker.body,
'info': sticker.info ?? {},
'url': sticker.url.toString(),
},
type: EventTypes.Sticker,
);
controller.hideEmojiPicker();
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
// 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,
),
),
],
// #Pangea
Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: FloatingActionButton(
onPressed: controller.hideEmojiPicker,
shape: const CircleBorder(),
mini: true,
child: const Icon(Icons.close),
),
),
),
// Pangea#
],
// Pangea#
],
),
)
: null,
);

View file

@ -446,17 +446,17 @@ class ChatView extends StatelessWidget {
Positioned(
left: 0,
right: 0,
bottom: 13,
bottom: 16,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
if (!controller.selectMode)
Container(
margin: const EdgeInsets.only(
bottom: 7,
left: 11,
right: 11,
margin: EdgeInsets.only(
bottom: 10,
left: bottomSheetPadding,
right: bottomSheetPadding,
),
constraints: const BoxConstraints(
maxWidth: FluffyThemes.columnWidth * 2.4,
@ -500,6 +500,7 @@ class ChatView extends StatelessWidget {
ReactionsPicker(controller),
ReplyDisplay(controller),
ChatInputRow(controller),
ChatEmojiPicker(controller),
],
),
),
@ -507,12 +508,6 @@ class ChatView extends StatelessWidget {
],
),
),
Positioned(
bottom: 0,
left: 0,
right: 0,
child: ChatEmojiPicker(controller),
),
// Pangea#
],
),

View file

@ -21,9 +21,6 @@ class ReplyDisplay extends StatelessWidget {
: 0,
clipBehavior: Clip.hardEdge,
decoration: BoxDecoration(
// #Pangea
borderRadius: const BorderRadius.all(Radius.circular(28.0)),
// Pangea#
color: Theme.of(context).colorScheme.onInverseSurface,
),
child: Row(
@ -67,28 +64,19 @@ class _EditContent extends StatelessWidget {
Icons.edit,
color: Theme.of(context).colorScheme.primary,
),
// #Pangea
// Container(width: 15.0),
Container(width: 8.0),
Flexible(
child:
// Pangea#
Text(
event.calcLocalizedBodyFallback(
MatrixLocals(L10n.of(context)!),
withSenderNamePrefix: false,
hideReply: true,
),
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
color: Theme.of(context).textTheme.bodyMedium!.color,
),
Container(width: 15.0),
Text(
event.calcLocalizedBodyFallback(
MatrixLocals(L10n.of(context)!),
withSenderNamePrefix: false,
hideReply: true,
),
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
color: Theme.of(context).textTheme.bodyMedium!.color,
),
),
// #Pangea
Container(width: 10.0),
// Pangea#
],
);
}