Compare commits
3 Commits
3ae1b7d168
...
6ce90e08ef
Author | SHA1 | Date | |
---|---|---|---|
6ce90e08ef | |||
5ac80d8d60 | |||
56e1fa52d8 |
@ -17,6 +17,14 @@ const Color primaryColorAlt = Color(primaryColorAltHexRGB);
|
||||
const Color primaryColorDisabled = Color(primaryColorDisabledHexRGB);
|
||||
const Color textColorDisabled = Color(textColorDisabledHexRGB);
|
||||
|
||||
/// The color of a quote bubble displayed inside the TextField
|
||||
const Color bubbleQuoteInTextFieldColorLight = Color(0xffc7c7c7);
|
||||
const Color bubbleQuoteInTextFieldColorDark = Color(0xff2f2f2f);
|
||||
|
||||
/// The color of text inside a quote bubble inside the TextField
|
||||
const Color bubbleQuoteInTextFieldTextColorLight = Color(0xff373737);
|
||||
const Color bubbleQuoteInTextFieldTextColorDark = Color(0xffdadada);
|
||||
|
||||
/// The color of a bubble that was sent
|
||||
const Color bubbleColorSent = Color(0xff7e0bce);
|
||||
|
||||
@ -39,7 +47,7 @@ const Color bubbleColorNewDevice = Color(0xffeee8d5);
|
||||
const Color bubbleTextColor = Color(0xffffffff);
|
||||
|
||||
/// The color of text within a quote widget
|
||||
const Color bubbleTextQuote = Color(0xffdadada);
|
||||
const Color bubbleTextQuoteColor = Color(0xffdadada);
|
||||
|
||||
const Color conversationTextFieldColorLight = Color(0xffe6e6e6);
|
||||
const Color conversationTextFieldColorDark = Color(0xff414141);
|
||||
|
@ -8,6 +8,8 @@ class MoxxyThemeData extends ThemeExtension<MoxxyThemeData> {
|
||||
required this.conversationTextFieldColor,
|
||||
required this.profileFallbackBackgroundColor,
|
||||
required this.profileFallbackTextColor,
|
||||
required this.bubbleQuoteInTextFieldColor,
|
||||
required this.bubbleQuoteInTextFieldTextColor,
|
||||
});
|
||||
|
||||
/// The color of the conversation TextField
|
||||
@ -19,12 +21,20 @@ class MoxxyThemeData extends ThemeExtension<MoxxyThemeData> {
|
||||
/// The text color of a user with no avatar
|
||||
final Color profileFallbackTextColor;
|
||||
|
||||
/// The color of a quote bubble displayed inside the TextField
|
||||
final Color bubbleQuoteInTextFieldColor;
|
||||
|
||||
/// The color of text inside a quote bubble inside the TextField
|
||||
final Color bubbleQuoteInTextFieldTextColor;
|
||||
|
||||
@override
|
||||
MoxxyThemeData copyWith({Color? conversationTextFieldColor, Color? profileFallbackBackgroundColor, Color? profileFallbackTextColor}) {
|
||||
MoxxyThemeData copyWith({Color? conversationTextFieldColor, Color? profileFallbackBackgroundColor, Color? profileFallbackTextColor, Color? bubbleQuoteInTextFieldColor, Color? bubbleQuoteInTextFieldTextColor}) {
|
||||
return MoxxyThemeData(
|
||||
conversationTextFieldColor: conversationTextFieldColor ?? this.conversationTextFieldColor,
|
||||
profileFallbackBackgroundColor: profileFallbackBackgroundColor ?? this.profileFallbackBackgroundColor,
|
||||
profileFallbackTextColor: profileFallbackTextColor ?? this.profileFallbackTextColor,
|
||||
bubbleQuoteInTextFieldColor: bubbleQuoteInTextFieldColor ?? this.bubbleQuoteInTextFieldColor,
|
||||
bubbleQuoteInTextFieldTextColor: bubbleQuoteInTextFieldTextColor ?? this.bubbleQuoteInTextFieldTextColor,
|
||||
);
|
||||
}
|
||||
|
||||
@ -92,12 +102,16 @@ ThemeData getThemeData(BuildContext context, Brightness brightness) {
|
||||
conversationTextFieldColor: conversationTextFieldColorDark,
|
||||
profileFallbackBackgroundColor: profileFallbackBackgroundColorDark,
|
||||
profileFallbackTextColor: profileFallbackTextColorDark,
|
||||
bubbleQuoteInTextFieldColor: bubbleQuoteInTextFieldColorDark,
|
||||
bubbleQuoteInTextFieldTextColor: bubbleQuoteInTextFieldTextColorDark,
|
||||
)
|
||||
else
|
||||
const MoxxyThemeData(
|
||||
conversationTextFieldColor: conversationTextFieldColorLight,
|
||||
profileFallbackBackgroundColor: profileFallbackBackgroundColorLight,
|
||||
profileFallbackTextColor: profileFallbackTextColorLight,
|
||||
bubbleQuoteInTextFieldColor: bubbleQuoteInTextFieldColorLight,
|
||||
bubbleQuoteInTextFieldTextColor: bubbleQuoteInTextFieldTextColorLight,
|
||||
),
|
||||
],
|
||||
);
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:moxxyv2/shared/models/message.dart';
|
||||
import 'package:moxxyv2/ui/constants.dart';
|
||||
import 'package:moxxyv2/ui/theme.dart';
|
||||
|
||||
/// This Widget is used to show that a message has been quoted.
|
||||
class QuoteBaseWidget extends StatelessWidget {
|
||||
@ -20,7 +21,11 @@ class QuoteBaseWidget extends StatelessWidget {
|
||||
final bool sent;
|
||||
final void Function()? resetQuotedMessage;
|
||||
|
||||
Color _getColor() {
|
||||
Color _getColor(BuildContext context) {
|
||||
if (resetQuotedMessage != null) {
|
||||
return Theme.of(context).extension<MoxxyThemeData>()!.bubbleQuoteInTextFieldColor;
|
||||
}
|
||||
|
||||
if (sent) {
|
||||
return bubbleColorSentQuoted;
|
||||
} else {
|
||||
@ -47,7 +52,7 @@ class QuoteBaseWidget extends StatelessWidget {
|
||||
child: ClipRRect(
|
||||
borderRadius: const BorderRadius.all(radiusLarge),
|
||||
child: Material(
|
||||
color: _getColor(),
|
||||
color: _getColor(context),
|
||||
child: DecoratedBox(
|
||||
decoration: const BoxDecoration(
|
||||
border: Border(
|
||||
|
12
lib/ui/widgets/chat/quote/helpers.dart
Normal file
12
lib/ui/widgets/chat/quote/helpers.dart
Normal file
@ -0,0 +1,12 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:moxxyv2/ui/constants.dart';
|
||||
import 'package:moxxyv2/ui/theme.dart';
|
||||
|
||||
/// 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.
|
||||
Color getQuoteTextColor(BuildContext context, bool insideTextField) {
|
||||
if (!insideTextField) return bubbleTextQuoteColor;
|
||||
|
||||
return Theme.of(context).extension<MoxxyThemeData>()!.bubbleQuoteInTextFieldTextColor;
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:moxxyv2/shared/models/message.dart';
|
||||
import 'package:moxxyv2/ui/widgets/chat/quote/base.dart';
|
||||
import 'package:moxxyv2/ui/widgets/chat/quote/helpers.dart';
|
||||
|
||||
class QuotedMediaBaseWidget extends StatelessWidget {
|
||||
const QuotedMediaBaseWidget(
|
||||
@ -28,7 +29,12 @@ class QuotedMediaBaseWidget extends StatelessWidget {
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8),
|
||||
child: Text(text),
|
||||
child: Text(
|
||||
text,
|
||||
style: TextStyle(
|
||||
color: getQuoteTextColor(context, resetQuote != null),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:moxxyv2/shared/models/message.dart';
|
||||
import 'package:moxxyv2/ui/constants.dart';
|
||||
import 'package:moxxyv2/ui/widgets/chat/quote/base.dart';
|
||||
import 'package:moxxyv2/ui/widgets/chat/quote/helpers.dart';
|
||||
|
||||
class QuotedTextWidget extends StatelessWidget {
|
||||
const QuotedTextWidget(
|
||||
@ -14,15 +14,15 @@ 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: const TextStyle(
|
||||
color: bubbleTextQuote,
|
||||
style: TextStyle(
|
||||
color: getQuoteTextColor(context, resetQuote != null),
|
||||
),
|
||||
),
|
||||
sent,
|
||||
|
@ -154,19 +154,27 @@ class ConversationsListRowState extends State<ConversationsListRow> {
|
||||
);
|
||||
}
|
||||
} else if (widget.conversation.lastMessage!.mediaType!.startsWith('image/')) {
|
||||
preview = SharedImageWidget(
|
||||
widget.conversation.lastMessage!.mediaUrl!,
|
||||
borderRadius: 5,
|
||||
size: 30,
|
||||
);
|
||||
if (widget.conversation.lastMessage!.mediaUrl == null) {
|
||||
preview = const SizedBox();
|
||||
} else {
|
||||
preview = SharedImageWidget(
|
||||
widget.conversation.lastMessage!.mediaUrl!,
|
||||
borderRadius: 5,
|
||||
size: 30,
|
||||
);
|
||||
}
|
||||
} else if (widget.conversation.lastMessage!.mediaType!.startsWith('video/')) {
|
||||
preview = SharedVideoWidget(
|
||||
widget.conversation.lastMessage!.mediaUrl!,
|
||||
widget.conversation.jid,
|
||||
widget.conversation.lastMessage!.mediaType!,
|
||||
borderRadius: 5,
|
||||
size: 30,
|
||||
);
|
||||
if (widget.conversation.lastMessage!.mediaUrl == null) {
|
||||
preview = const SizedBox();
|
||||
} else {
|
||||
preview = SharedVideoWidget(
|
||||
widget.conversation.lastMessage!.mediaUrl!,
|
||||
widget.conversation.jid,
|
||||
widget.conversation.lastMessage!.mediaType!,
|
||||
borderRadius: 5,
|
||||
size: 30,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return Padding(
|
||||
|
Loading…
Reference in New Issue
Block a user