feat: implement pinned messages

- render pinned events on the chat top
- support scroll up for several pinned messages
- ask to unpin messages
- add button to pin message
- fix some null-safety issues
- fix the Linux database directly for debug builds

Signed-off-by: TheOneWithTheBraid <the-one@with-the-braid.cf>
This commit is contained in:
TheOneWithTheBraid 2022-02-14 18:44:37 +01:00 • committed by Krille Fear
commit 704fd404b1
10 changed files with 169 additions and 32 deletions

View file

@ -22,10 +22,11 @@ import 'sticker.dart';
class MessageContent extends StatelessWidget {
final Event event;
final Color? textColor;
final Color textColor;
final void Function(Event)? onInfoTab;
const MessageContent(this.event, {this.onInfoTab, Key? key, this.textColor})
const MessageContent(this.event,
{this.onInfoTab, Key? key, required this.textColor})
: super(key: key);
void _verifyOrRequestKey(BuildContext context) async {
@ -83,17 +84,17 @@ class MessageContent extends StatelessWidget {
if (PlatformInfos.isMobile) {
return AudioPlayerWidget(
event,
color: textColor!,
color: textColor,
);
}
return MessageDownloadContent(event, textColor!);
return MessageDownloadContent(event, textColor);
case MessageTypes.Video:
if (PlatformInfos.isMobile || PlatformInfos.isWeb) {
return EventVideoPlayer(event);
}
return MessageDownloadContent(event, textColor!);
return MessageDownloadContent(event, textColor);
case MessageTypes.File:
return MessageDownloadContent(event, textColor!);
return MessageDownloadContent(event, textColor);
case MessageTypes.Text:
case MessageTypes.Notice:
@ -115,7 +116,7 @@ class MessageContent extends StatelessWidget {
fontSize: bigEmotes ? fontSize * 3 : fontSize,
),
linkStyle: TextStyle(
color: textColor!.withAlpha(150),
color: textColor.withAlpha(150),
fontSize: bigEmotes ? fontSize * 3 : fontSize,
decoration: TextDecoration.underline,
),
@ -200,7 +201,7 @@ class MessageContent extends StatelessWidget {
decoration: event.redacted ? TextDecoration.lineThrough : null,
),
linkStyle: TextStyle(
color: textColor!.withAlpha(150),
color: textColor.withAlpha(150),
fontSize: bigEmotes ? fontSize * 3 : fontSize,
decoration: TextDecoration.underline,
),