chore: Message bubble color follow up
This commit is contained in:
parent
321cc07fb8
commit
b6ea44da2e
7 changed files with 37 additions and 39 deletions
|
|
@ -147,3 +147,18 @@ extension on Brightness {
|
||||||
Brightness get reversed =>
|
Brightness get reversed =>
|
||||||
this == Brightness.dark ? Brightness.light : Brightness.dark;
|
this == Brightness.dark ? Brightness.light : Brightness.dark;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension BubbleColorTheme on ThemeData {
|
||||||
|
Color get bubbleColor => brightness == Brightness.light
|
||||||
|
? colorScheme.primary
|
||||||
|
: colorScheme.primaryContainer;
|
||||||
|
Color get onBubbleColor => brightness == Brightness.light
|
||||||
|
? colorScheme.onPrimary
|
||||||
|
: colorScheme.onPrimaryContainer;
|
||||||
|
|
||||||
|
Color get secondaryBubbleColor => HSLColor.fromColor(
|
||||||
|
brightness == Brightness.light
|
||||||
|
? colorScheme.tertiary
|
||||||
|
: colorScheme.tertiaryContainer,
|
||||||
|
).withSaturation(0.75).toColor();
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,12 @@ class ChatAppBarTitle extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final room = controller.room;
|
final room = controller.room;
|
||||||
if (controller.selectedEvents.isNotEmpty) {
|
if (controller.selectedEvents.isNotEmpty) {
|
||||||
return Text(controller.selectedEvents.length.toString());
|
return Text(
|
||||||
|
controller.selectedEvents.length.toString(),
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).secondaryBubbleColor,
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return InkWell(
|
return InkWell(
|
||||||
hoverColor: Colors.transparent,
|
hoverColor: Colors.transparent,
|
||||||
|
|
|
||||||
|
|
@ -34,20 +34,10 @@ class ChatEventList extends StatelessWidget {
|
||||||
|
|
||||||
final theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
|
|
||||||
const saturation = 0.85;
|
final colors = [
|
||||||
final colors = theme.brightness == Brightness.light
|
theme.secondaryBubbleColor,
|
||||||
? [
|
theme.bubbleColor,
|
||||||
HSLColor.fromColor(theme.colorScheme.tertiary)
|
];
|
||||||
.withSaturation(saturation)
|
|
||||||
.toColor(),
|
|
||||||
theme.colorScheme.primary,
|
|
||||||
]
|
|
||||||
: [
|
|
||||||
HSLColor.fromColor(theme.colorScheme.tertiaryContainer)
|
|
||||||
.withSaturation(saturation)
|
|
||||||
.toColor(),
|
|
||||||
theme.colorScheme.primaryContainer,
|
|
||||||
];
|
|
||||||
|
|
||||||
final horizontalPadding = FluffyThemes.isColumnMode(context) ? 8.0 : 0.0;
|
final horizontalPadding = FluffyThemes.isColumnMode(context) ? 8.0 : 0.0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -275,8 +275,8 @@ class ChatInputRow extends StatelessWidget {
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(height),
|
borderRadius: BorderRadius.circular(height),
|
||||||
),
|
),
|
||||||
backgroundColor: theme.colorScheme.primary,
|
backgroundColor: theme.bubbleColor,
|
||||||
foregroundColor: theme.colorScheme.onPrimary,
|
foregroundColor: theme.onBubbleColor,
|
||||||
child: const Icon(Icons.mic_none_outlined),
|
child: const Icon(Icons.mic_none_outlined),
|
||||||
)
|
)
|
||||||
: FloatingActionButton.small(
|
: FloatingActionButton.small(
|
||||||
|
|
@ -287,8 +287,8 @@ class ChatInputRow extends StatelessWidget {
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(height),
|
borderRadius: BorderRadius.circular(height),
|
||||||
),
|
),
|
||||||
backgroundColor: theme.colorScheme.onPrimaryContainer,
|
backgroundColor: theme.bubbleColor,
|
||||||
foregroundColor: theme.colorScheme.onPrimary,
|
foregroundColor: theme.onBubbleColor,
|
||||||
child: const Icon(Icons.send_outlined),
|
child: const Icon(Icons.send_outlined),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,7 @@ class ChatView extends StatelessWidget {
|
||||||
actionsIconTheme: IconThemeData(
|
actionsIconTheme: IconThemeData(
|
||||||
color: controller.selectedEvents.isEmpty
|
color: controller.selectedEvents.isEmpty
|
||||||
? null
|
? null
|
||||||
: theme.colorScheme.primary,
|
: theme.secondaryBubbleColor,
|
||||||
),
|
),
|
||||||
automaticallyImplyLeading: false,
|
automaticallyImplyLeading: false,
|
||||||
leading: controller.selectMode
|
leading: controller.selectMode
|
||||||
|
|
@ -187,7 +187,7 @@ class ChatView extends StatelessWidget {
|
||||||
icon: const Icon(Icons.close),
|
icon: const Icon(Icons.close),
|
||||||
onPressed: controller.clearSelectedEvents,
|
onPressed: controller.clearSelectedEvents,
|
||||||
tooltip: L10n.of(context).close,
|
tooltip: L10n.of(context).close,
|
||||||
color: theme.colorScheme.primary,
|
color: theme.secondaryBubbleColor,
|
||||||
)
|
)
|
||||||
: FluffyThemes.isColumnMode(context)
|
: FluffyThemes.isColumnMode(context)
|
||||||
? null
|
? null
|
||||||
|
|
|
||||||
|
|
@ -113,11 +113,8 @@ class Message extends StatelessWidget {
|
||||||
previousEvent!.senderId == event.senderId &&
|
previousEvent!.senderId == event.senderId &&
|
||||||
previousEvent!.originServerTs.sameEnvironment(event.originServerTs);
|
previousEvent!.originServerTs.sameEnvironment(event.originServerTs);
|
||||||
|
|
||||||
final textColor = ownMessage
|
final textColor =
|
||||||
? theme.brightness == Brightness.light
|
ownMessage ? theme.onBubbleColor : theme.colorScheme.onSurface;
|
||||||
? theme.colorScheme.onPrimary
|
|
||||||
: theme.colorScheme.onPrimaryContainer
|
|
||||||
: theme.colorScheme.onSurface;
|
|
||||||
|
|
||||||
final linkColor = ownMessage
|
final linkColor = ownMessage
|
||||||
? theme.brightness == Brightness.light
|
? theme.brightness == Brightness.light
|
||||||
|
|
@ -157,11 +154,8 @@ class Message extends StatelessWidget {
|
||||||
}.contains(event.messageType);
|
}.contains(event.messageType);
|
||||||
|
|
||||||
if (ownMessage) {
|
if (ownMessage) {
|
||||||
color = displayEvent.status.isError
|
color =
|
||||||
? Colors.redAccent
|
displayEvent.status.isError ? Colors.redAccent : theme.bubbleColor;
|
||||||
: theme.brightness == Brightness.light
|
|
||||||
? theme.colorScheme.primary
|
|
||||||
: theme.colorScheme.primaryContainer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final resetAnimateIn = this.resetAnimateIn;
|
final resetAnimateIn = this.resetAnimateIn;
|
||||||
|
|
|
||||||
|
|
@ -214,9 +214,7 @@ class SettingsStyleView extends StatelessWidget {
|
||||||
),
|
),
|
||||||
child: DecoratedBox(
|
child: DecoratedBox(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: theme.brightness == Brightness.light
|
color: theme.bubbleColor,
|
||||||
? theme.colorScheme.primary
|
|
||||||
: theme.colorScheme.primaryContainer,
|
|
||||||
borderRadius: BorderRadius.circular(
|
borderRadius: BorderRadius.circular(
|
||||||
AppConfig.borderRadius,
|
AppConfig.borderRadius,
|
||||||
),
|
),
|
||||||
|
|
@ -229,11 +227,7 @@ class SettingsStyleView extends StatelessWidget {
|
||||||
child: Text(
|
child: Text(
|
||||||
'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor',
|
'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color:
|
color: theme.onBubbleColor,
|
||||||
theme.brightness == Brightness.light
|
|
||||||
? theme.colorScheme.onPrimary
|
|
||||||
: theme.colorScheme
|
|
||||||
.onPrimaryContainer,
|
|
||||||
fontSize: AppConfig.messageFontSize *
|
fontSize: AppConfig.messageFontSize *
|
||||||
AppConfig.fontSizeFactor,
|
AppConfig.fontSizeFactor,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue