chore: some updates to copy in user sheet, account for transcription height in message overlay positioner (#2622)

This commit is contained in:
ggurdin 2025-05-02 12:01:01 -04:00 committed by GitHub
parent 3c0c84b366
commit a92dade08c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 50 additions and 21 deletions

View file

@ -4886,5 +4886,8 @@
"type": "String"
}
}
}
},
"ban": "Ban",
"unban": "Unban",
"kick": "Kick"
}

View file

@ -40,6 +40,7 @@ abstract class AppConfig {
toolbarButtonsHeight +
(chatInputRowOverlayPadding * 2) +
toolbarSpacing;
static const double audioTranscriptionMaxHeight = 150.0;
static TextStyle messageTextStyle(
Event? event,

View file

@ -325,7 +325,10 @@ class UserBottomSheetView extends StatelessWidget {
ListTile(
textColor: theme.colorScheme.error,
iconColor: theme.colorScheme.error,
title: Text(L10n.of(context).kickFromChat),
// #Pangea
// title: Text(L10n.of(context).kickFromChat),
title: Text(L10n.of(context).kick),
// Pangea#
leading: const Icon(Icons.exit_to_app_outlined),
onTap: () =>
controller.participantAction(UserBottomSheetAction.kick),
@ -336,7 +339,10 @@ class UserBottomSheetView extends StatelessWidget {
ListTile(
textColor: theme.colorScheme.onErrorContainer,
iconColor: theme.colorScheme.onErrorContainer,
title: Text(L10n.of(context).banFromChat),
// #Pangea
// title: Text(L10n.of(context).banFromChat),
title: Text(L10n.of(context).ban),
// Pangea#
leading: const Icon(Icons.warning_sharp),
onTap: () =>
controller.participantAction(UserBottomSheetAction.ban),
@ -345,7 +351,10 @@ class UserBottomSheetView extends StatelessWidget {
user.canBan &&
user.membership == Membership.ban)
ListTile(
title: Text(L10n.of(context).unbanFromChat),
// #Pangea
// title: Text(L10n.of(context).unbanFromChat),
title: Text(L10n.of(context).unban),
// Pangea#
leading: const Icon(Icons.warning_outlined),
onTap: () =>
controller.participantAction(UserBottomSheetAction.unban),

View file

@ -401,8 +401,8 @@ class MessageSelectionPositionerState extends State<MessageSelectionPositioner>
_reactionsHeight -
_selectionButtonsHeight;
final hasHeaderOverflow =
topOffset < (_headerHeight + AppConfig.toolbarSpacing);
final hasHeaderOverflow = topOffset <
(_headerHeight + AppConfig.toolbarSpacing + _audioTranscriptionHeight);
final hasFooterOverflow =
bottomOffset < (_footerHeight + AppConfig.toolbarSpacing);
@ -414,11 +414,16 @@ class MessageSelectionPositionerState extends State<MessageSelectionPositioner>
}
if (hasHeaderOverflow) {
final difference = topOffset - (_headerHeight + AppConfig.toolbarSpacing);
final difference = topOffset -
(_headerHeight +
AppConfig.toolbarSpacing +
_audioTranscriptionHeight);
double newBottomOffset = _mediaQuery!.size.height -
_originalMessageOffset.dy +
difference -
_originalMessageSize.height;
if (newBottomOffset < _footerHeight + AppConfig.toolbarSpacing) {
newBottomOffset = _footerHeight + AppConfig.toolbarSpacing;
}
@ -504,6 +509,12 @@ class MessageSelectionPositionerState extends State<MessageSelectionPositioner>
return showSelectionButtons ? AppConfig.toolbarButtonsHeight : 0;
}
double get _audioTranscriptionHeight {
return widget.pangeaMessageEvent?.isAudioMessage ?? false
? AppConfig.audioTranscriptionMaxHeight
: 0;
}
bool get _hasReactions {
final reactionsEvents = widget.event.aggregatedEvents(
widget.chatController.timeline!,

View file

@ -280,8 +280,11 @@ class OverlayMessage extends StatelessWidget {
)
: content,
if (showTranscription || showTranslation)
SizedBox(
Container(
width: messageWidth,
constraints: const BoxConstraints(
maxHeight: AppConfig.audioTranscriptionMaxHeight,
),
child: Padding(
padding: const EdgeInsets.fromLTRB(
12.0,
@ -289,20 +292,22 @@ class OverlayMessage extends StatelessWidget {
12.0,
12.0,
),
child: showTranscription
? MessageSpeechToTextCard(
messageEvent: pangeaMessageEvent!,
textColor: textColor,
)
: Text(
overlayController.translationText!,
style: AppConfig.messageTextStyle(
event,
textColor,
).copyWith(
fontStyle: FontStyle.italic,
child: SingleChildScrollView(
child: showTranscription
? MessageSpeechToTextCard(
messageEvent: pangeaMessageEvent!,
textColor: textColor,
)
: Text(
overlayController.translationText!,
style: AppConfig.messageTextStyle(
event,
textColor,
).copyWith(
fontStyle: FontStyle.italic,
),
),
),
),
),
),
],