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:
parent
9272376fc5
commit
704fd404b1
10 changed files with 169 additions and 32 deletions
|
|
@ -22,19 +22,19 @@ class Message extends StatelessWidget {
|
|||
final void Function(Event)? onInfoTab;
|
||||
final void Function(String)? scrollToEventId;
|
||||
final void Function(String) unfold;
|
||||
final bool? longPressSelect;
|
||||
final bool? selected;
|
||||
final bool longPressSelect;
|
||||
final bool selected;
|
||||
final Timeline timeline;
|
||||
|
||||
const Message(this.event,
|
||||
{this.nextEvent,
|
||||
this.longPressSelect,
|
||||
this.longPressSelect = false,
|
||||
this.onSelect,
|
||||
this.onInfoTab,
|
||||
this.onAvatarTab,
|
||||
this.scrollToEventId,
|
||||
required this.unfold,
|
||||
this.selected,
|
||||
this.selected = false,
|
||||
required this.timeline,
|
||||
Key? key})
|
||||
: super(key: key);
|
||||
|
|
@ -152,11 +152,10 @@ class Message extends StatelessWidget {
|
|||
clipBehavior: Clip.antiAlias,
|
||||
child: InkWell(
|
||||
onHover: (b) => useMouse = true,
|
||||
onTap: !useMouse && longPressSelect!
|
||||
onTap: !useMouse && longPressSelect
|
||||
? () {}
|
||||
: () => onSelect!(event),
|
||||
onLongPress:
|
||||
!longPressSelect! ? null : () => onSelect!(event),
|
||||
onLongPress: !longPressSelect ? null : () => onSelect!(event),
|
||||
borderRadius: borderRadius,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
|
|
@ -301,7 +300,7 @@ class Message extends StatelessWidget {
|
|||
|
||||
return Center(
|
||||
child: Container(
|
||||
color: selected!
|
||||
color: selected
|
||||
? Theme.of(context).primaryColor.withAlpha(100)
|
||||
: Theme.of(context).primaryColor.withAlpha(0),
|
||||
constraints:
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue