Compare commits

...

2 Commits

Author SHA1 Message Date
f44861fead feat(ui): The quote bubble base only depends on the surrounding bubble
Also adds an indicator as to who send a message. Fixes #213.
2023-01-13 00:49:56 +01:00
1c4a30ebb4 fix(ui): Show a text when no sticker packs are installed 2023-01-12 23:53:27 +01:00
7 changed files with 88 additions and 13 deletions

View File

@ -59,7 +59,8 @@
"file": "File",
"sticker": "Sticker",
"retracted": "The message has been retracted",
"retractedFallback": "A previous message has been retracted but your client does not support it"
"retractedFallback": "A previous message has been retracted but your client does not support it",
"you": "You"
},
"errors": {
"omemo": {

View File

@ -59,7 +59,8 @@
"file": "Datei",
"sticker": "Sticker",
"retracted": "Die Nachricht wurde zurückgezogen",
"retractedFallback": "Eine vorherige Nachricht wurde zurückgezogen. Dein Client unterstüzt dies jedoch nicht"
"retractedFallback": "Eine vorherige Nachricht wurde zurückgezogen. Dein Client unterstüzt dies jedoch nicht",
"you": "Du"
},
"errors": {
"omemo": {

View File

@ -49,6 +49,10 @@ const Color bubbleTextColor = Color(0xffffffff);
/// The color of text within a quote widget
const Color bubbleTextQuoteColor = Color(0xffdadada);
/// The color of the sender name in a quote
const Color bubbleTextQuoteSenderColor = Color(0xffff90ff);
/// The color of the input text field of the conversation page
const Color conversationTextFieldColorLight = Color(0xffe6e6e6);
const Color conversationTextFieldColorDark = Color(0xff414141);

View File

@ -91,6 +91,11 @@ class StickersSettingsPage extends StatelessWidget {
),
SectionTitle(t.pages.settings.stickers.stickerPacksSection),
if (stickers.stickerPacks.isEmpty)
SettingsRow(
title: t.pages.conversation.stickerPickerNoStickersLine1,
),
],
);
}

View File

@ -1,7 +1,47 @@
import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'package:moxxyv2/i18n/strings.g.dart';
import 'package:moxxyv2/ui/bloc/conversation_bloc.dart';
import 'package:moxxyv2/ui/constants.dart';
import 'package:moxxyv2/ui/service/data.dart';
import 'package:moxxyv2/ui/theme.dart';
class QuoteSenderText extends StatelessWidget {
const QuoteSenderText({
required this.sender,
required this.resetQuoteNotNull,
required this.sent,
super.key,
});
/// The sender JID of the quoted message.
final String sender;
/// True if resetQuote is not null.
final bool resetQuoteNotNull;
/// The sent attribute passed to the quote widget.
final bool sent;
@override
Widget build(BuildContext context) {
final sentBySelf = resetQuoteNotNull ?
sent :
sender == GetIt.I.get<UIDataService>().ownJid;
return Text(
sentBySelf ?
t.messages.you :
GetIt.I.get<ConversationBloc>().state.conversation!.titleWithOptionalContact,
style: const TextStyle(
color: bubbleTextQuoteSenderColor,
fontWeight: FontWeight.bold,
),
overflow: TextOverflow.ellipsis,
);
}
}
/// Figures out the best text color for quotes. [context] is the surrounding
/// BuildContext. [insideTextField] is true if the quote is used as a widget inside
/// the TextField.

View File

@ -29,11 +29,23 @@ class QuotedMediaBaseWidget extends StatelessWidget {
Padding(
padding: const EdgeInsets.only(left: 8),
child: Text(
text,
style: TextStyle(
color: getQuoteTextColor(context, resetQuote != null),
),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
QuoteSenderText(
sender: message.sender,
resetQuoteNotNull: resetQuote != null,
sent: sent,
),
Text(
text,
style: TextStyle(
color: getQuoteTextColor(context, resetQuote != null),
),
),
],
),
),
],

View File

@ -14,16 +14,28 @@ class QuotedTextWidget extends StatelessWidget {
final Message message;
final bool sent;
final void Function()? resetQuote;
@override
Widget build(BuildContext context) {
return QuoteBaseWidget(
message,
Text(
message.body,
style: TextStyle(
color: getQuoteTextColor(context, resetQuote != null),
),
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
QuoteSenderText(
sender: message.sender,
resetQuoteNotNull: resetQuote != null,
sent: sent,
),
Text(
message.body,
style: TextStyle(
color: getQuoteTextColor(context, resetQuote != null),
),
),
],
),
sent,
resetQuotedMessage: resetQuote,