feat: New account data wallpaper feature

This commit is contained in:
Krille 2024-01-25 16:52:36 +01:00
commit 3b9245c8c7
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652
11 changed files with 262 additions and 34 deletions

View file

@ -37,7 +37,6 @@ class ChatAppBarTitle extends StatelessWidget {
MatrixLocals(L10n.of(context)!),
),
size: 32,
presenceUserId: room.directChatMatrixID,
),
),
const SizedBox(width: 12),

View file

@ -9,6 +9,7 @@ import 'package:fluffychat/pages/chat/events/message.dart';
import 'package:fluffychat/pages/chat/seen_by_row.dart';
import 'package:fluffychat/pages/chat/typing_indicators.dart';
import 'package:fluffychat/pages/user_bottom_sheet/user_bottom_sheet.dart';
import 'package:fluffychat/utils/account_config.dart';
import 'package:fluffychat/utils/adaptive_bottom_sheet.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/filtered_timeline_extension.dart';
import 'package:fluffychat/utils/platform_infos.dart';
@ -36,6 +37,9 @@ class ChatEventList extends StatelessWidget {
thisEventsKeyMap[events[i].eventId] = i;
}
final hasWallpaper =
controller.room.client.applicationAccountConfig.wallpaperUrl != null;
return SelectionArea(
child: ListView.custom(
padding: EdgeInsets.only(
@ -140,6 +144,8 @@ class ChatEventList extends StatelessWidget {
controller.readMarkerEventId == event.eventId &&
controller.timeline?.allowNewEvent == false,
nextEvent: i + 1 < events.length ? events[i + 1] : null,
avatarPresenceBackgroundColor:
hasWallpaper ? Colors.transparent : null,
),
);
},

View file

@ -16,9 +16,11 @@ import 'package:fluffychat/pages/chat/pinned_events.dart';
import 'package:fluffychat/pages/chat/reactions_picker.dart';
import 'package:fluffychat/pages/chat/reply_display.dart';
import 'package:fluffychat/pages/chat/tombstone_display.dart';
import 'package:fluffychat/utils/account_config.dart';
import 'package:fluffychat/widgets/chat_settings_popup_menu.dart';
import 'package:fluffychat/widgets/connection_status_header.dart';
import 'package:fluffychat/widgets/matrix.dart';
import 'package:fluffychat/widgets/mxc_image.dart';
import 'package:fluffychat/widgets/unread_rooms_badge.dart';
import '../../utils/stream_extension.dart';
import 'chat_emoji_picker.dart';
@ -136,6 +138,8 @@ class ChatView extends StatelessWidget {
final bottomSheetPadding = FluffyThemes.isColumnMode(context) ? 16.0 : 8.0;
final scrollUpBannerEventId = controller.scrollUpBannerEventId;
final accountConfig = Matrix.of(context).client.applicationAccountConfig;
return PopScope(
canPop: controller.selectedEvents.isEmpty && !controller.showEmojiPicker,
onPopInvoked: (pop) async {
@ -198,6 +202,18 @@ class ChatView extends StatelessWidget {
onDragExited: controller.onDragExited,
child: Stack(
children: <Widget>[
if (accountConfig.wallpaperUrl != null)
Opacity(
opacity: accountConfig.wallpaperOpacity ?? 1,
child: MxcImage(
uri: accountConfig.wallpaperUrl,
fit: BoxFit.cover,
isThumbnail: true,
width: FluffyThemes.columnWidth * 2,
height: MediaQuery.of(context).size.height,
placeholder: (_) => Container(),
),
),
SafeArea(
child: Column(
children: <Widget>[
@ -300,8 +316,9 @@ class ChatView extends StatelessWidget {
children: [
TextButton.icon(
style: TextButton.styleFrom(
padding:
const EdgeInsets.all(16),
padding: const EdgeInsets.all(
16,
),
foregroundColor:
Theme.of(context)
.colorScheme
@ -317,8 +334,9 @@ class ChatView extends StatelessWidget {
),
TextButton.icon(
style: TextButton.styleFrom(
padding:
const EdgeInsets.all(16),
padding: const EdgeInsets.all(
16,
),
),
icon: const Icon(
Icons.forum_outlined,

View file

@ -33,6 +33,7 @@ class Message extends StatelessWidget {
final bool highlightMarker;
final bool animateIn;
final void Function()? resetAnimateIn;
final Color? avatarPresenceBackgroundColor;
const Message(
this.event, {
@ -49,6 +50,7 @@ class Message extends StatelessWidget {
this.highlightMarker = false,
this.animateIn = false,
this.resetAnimateIn,
this.avatarPresenceBackgroundColor,
super.key,
});
@ -177,6 +179,7 @@ class Message extends StatelessWidget {
mxContent: user.avatarUrl,
name: user.calcDisplayname(),
presenceUserId: user.stateKey,
presenceBackgroundColor: avatarPresenceBackgroundColor,
onTap: () => onAvatarTab(event),
);
},