diff --git a/lib/chat/view/chat_room/chat_room_info_drawer.dart b/lib/chat/view/chat_room/chat_room_info_drawer.dart index ecb8c6f..45e7eaf 100644 --- a/lib/chat/view/chat_room/chat_room_info_drawer.dart +++ b/lib/chat/view/chat_room/chat_room_info_drawer.dart @@ -42,56 +42,58 @@ class ChatRoomInfoDrawer extends StatelessWidget with WatchItMixin { children: [ if (!room.isDirectChat) AppBar( - title: Row( - mainAxisSize: MainAxisSize.min, - spacing: kMediumPadding, - children: [ - ChatAvatar( - avatarUri: room.avatar, - fallBackIcon: YaruIcons.users, - ), - Flexible( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Text(room.getLocalizedDisplayname()), - if (room.canonicalAlias.isNotEmpty) - Text( - room.canonicalAlias, - style: textTheme.labelSmall, - ), - Text( - room.isArchived - ? l10n.archive - : '(${room.summary.mJoinedMemberCount ?? 0} ${l10n.users})', - style: textTheme.labelSmall, - ), - ], + leadingWidth: 80, + leading: Center( + child: ChatAvatar( + avatarUri: room.avatar, + fallBackIcon: YaruIcons.users, + ), + ), + title: Center( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Text(room.getLocalizedDisplayname()), + if (room.canonicalAlias.isNotEmpty) + Text( + room.canonicalAlias, + style: textTheme.labelSmall, + textAlign: TextAlign.center, + ), + Text( + room.isArchived + ? l10n.archive + : '(${room.summary.mJoinedMemberCount ?? 0} ${l10n.users})', + style: textTheme.labelSmall, + textAlign: TextAlign.center, ), - ), - ], + ], + ), ), titleTextStyle: textTheme.bodyMedium?.copyWith(fontWeight: FontWeight.w500), automaticallyImplyLeading: false, actions: [ - if (!room.isArchived && room.canEditAtleastSomething) - Flexible( - key: ValueKey(room.canEditAtleastSomething), - child: Padding( - padding: const EdgeInsets.only(right: kSmallPadding), - child: IconButton( - onPressed: () => showDialog( - context: context, - builder: (context) => - ChatCreateOrEditRoomDialog(room: room), - ), - icon: const Icon(YaruIcons.pen), - ), + Flexible( + key: ValueKey(room.canEditAtleastSomething), + child: Padding( + padding: const EdgeInsets.only( + right: kBigPadding, + left: kMediumPadding, + ), + child: IconButton( + onPressed: !room.isArchived && + room.canEditAtleastSomething + ? () => showDialog( + context: context, + builder: (context) => + ChatCreateOrEditRoomDialog(room: room), + ) + : null, + icon: const Icon(YaruIcons.pen), ), - ) - else - Container(), + ), + ), ], toolbarHeight: 90, elevation: 0, @@ -136,7 +138,8 @@ class ChatRoomInfoDrawer extends StatelessWidget with WatchItMixin { ), ] : [ - ChatRoomInfoDrawerTopic(room: room), + if (room.topic.isNotEmpty) + ChatRoomInfoDrawerTopic(room: room), ChatRoomUsersList(room: room), ], ), diff --git a/lib/chat/view/chat_room/chat_room_page.dart b/lib/chat/view/chat_room/chat_room_page.dart index 1da4876..55d3c38 100644 --- a/lib/chat/view/chat_room/chat_room_page.dart +++ b/lib/chat/view/chat_room/chat_room_page.dart @@ -1,7 +1,9 @@ import 'package:flutter/material.dart'; import 'package:matrix/matrix.dart'; import 'package:watch_it/watch_it.dart'; +import 'package:yaru/yaru.dart'; +import '../../../common/view/build_context_x.dart'; import '../../../common/view/common_widgets.dart'; import '../../../common/view/confirm.dart'; import '../../../common/view/snackbars.dart'; @@ -48,6 +50,7 @@ class _ChatRoomPageState extends State { final archiveActive = watchPropertyValue((ChatModel m) => m.archiveActive); final loadingArchive = watchPropertyValue((ChatModel m) => m.loadingArchive); + final updating = watchPropertyValue((ChatModel m) => m.updatingTimeline); registerStreamHandler( select: (ChatModel m) => m.getLeftRoomStream(widget.room.id), @@ -74,6 +77,7 @@ class _ChatRoomPageState extends State { ); return Stack( + alignment: Alignment.center, children: [ const ChatRoomDefaultBackground(), Scaffold( @@ -108,6 +112,22 @@ class _ChatRoomPageState extends State { }, ), ), + if (updating) + Positioned( + top: 3 * kBigPadding, + child: FloatingActionButton.small( + backgroundColor: context.colorScheme.isLight + ? Colors.white + : Colors.black.scale(lightness: 0.09), + onPressed: () {}, + child: const SizedBox.square( + dimension: 20, + child: Progress( + strokeWidth: 2, + ), + ), + ), + ), ], ); } diff --git a/lib/chat/view/chat_room/chat_timeline_list.dart b/lib/chat/view/chat_room/chat_timeline_list.dart index 14d6a71..ced179a 100644 --- a/lib/chat/view/chat_room/chat_timeline_list.dart +++ b/lib/chat/view/chat_room/chat_timeline_list.dart @@ -130,27 +130,28 @@ class _ChatTimelineListState extends State { ChatTypingIndicator(room: widget.room), ], ), - Positioned( - right: kBigPadding, - bottom: kBigPadding, - child: AnimatedContainer( - duration: const Duration(milliseconds: 200), - padding: EdgeInsets.only( - bottom: _showScrollButton ? 3 * kBigPadding : 0, - ), - child: FloatingActionButton.small( - backgroundColor: getMonochromeBg(theme: theme, darkFactor: 5), - onPressed: () => showDialog( - context: context, - builder: (context) => ChatRoomSearchDialog(room: widget.room), + if (_showScrollButton) + Positioned( + right: kBigPadding, + bottom: kBigPadding, + child: AnimatedContainer( + duration: const Duration(milliseconds: 200), + padding: EdgeInsets.only( + bottom: _showScrollButton ? 3 * kBigPadding : 0, ), - child: Icon( - YaruIcons.search, - color: theme.colorScheme.onSurface, + child: FloatingActionButton.small( + backgroundColor: getMonochromeBg(theme: theme, darkFactor: 5), + onPressed: () => showDialog( + context: context, + builder: (context) => ChatRoomSearchDialog(room: widget.room), + ), + child: Icon( + YaruIcons.search, + color: theme.colorScheme.onSurface, + ), ), ), ), - ), if (_showScrollButton) Positioned( right: kBigPadding, diff --git a/lib/chat/view/chat_room/titlebar/chat_room_title_bar.dart b/lib/chat/view/chat_room/titlebar/chat_room_title_bar.dart index 2a4be91..f64ab6a 100644 --- a/lib/chat/view/chat_room/titlebar/chat_room_title_bar.dart +++ b/lib/chat/view/chat_room/titlebar/chat_room_title_bar.dart @@ -28,8 +28,6 @@ class ChatRoomTitleBar extends StatelessWidget Widget build(BuildContext context) { final l10n = context.l10n; - final updating = watchPropertyValue((ChatModel m) => m.updatingTimeline); - return YaruWindowTitleBar( heroTag: '', border: BorderSide.none, @@ -52,16 +50,6 @@ class ChatRoomTitleBar extends StatelessWidget actions: space( widthGap: kSmallPadding, children: [ - if (updating) - const Padding( - padding: EdgeInsets.only(right: kSmallPadding), - child: SizedBox.square( - dimension: 15, - child: Progress( - strokeWidth: 2, - ), - ), - ), if (!room.isArchived) ChatRoomPinButton(room: room), IconButton( onPressed: () => chatRoomScaffoldKey.currentState?.openEndDrawer(), diff --git a/lib/main.dart b/lib/main.dart index e1be005..407f4d8 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,6 +1,3 @@ -import 'dart:io'; - -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:window_manager/window_manager.dart'; import 'package:yaru/yaru.dart'; @@ -15,12 +12,10 @@ void main() async { WidgetsFlutterBinding.ensureInitialized(); } else { await YaruWindowTitleBar.ensureInitialized(); - if (!kIsWeb && !Platform.isLinux) { - windowManager.waitUntilReadyToShow(windowOptions, () async { - await windowManager.show(); - await windowManager.focus(); - }); - } + windowManager.waitUntilReadyToShow(windowOptions, () async { + await windowManager.show(); + await windowManager.focus(); + }); } registerDependencies();