Skip to content

Commit

Permalink
fix: linux size constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
Feichtmeier committed Jan 10, 2025
1 parent b27c05d commit 4ad2397
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 82 deletions.
91 changes: 47 additions & 44 deletions lib/chat/view/chat_room/chat_room_info_drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -136,7 +138,8 @@ class ChatRoomInfoDrawer extends StatelessWidget with WatchItMixin {
),
]
: [
ChatRoomInfoDrawerTopic(room: room),
if (room.topic.isNotEmpty)
ChatRoomInfoDrawerTopic(room: room),
ChatRoomUsersList(room: room),
],
),
Expand Down
20 changes: 20 additions & 0 deletions lib/chat/view/chat_room/chat_room_page.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -48,6 +50,7 @@ class _ChatRoomPageState extends State<ChatRoomPage> {
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),
Expand All @@ -74,6 +77,7 @@ class _ChatRoomPageState extends State<ChatRoomPage> {
);

return Stack(
alignment: Alignment.center,
children: [
const ChatRoomDefaultBackground(),
Scaffold(
Expand Down Expand Up @@ -108,6 +112,22 @@ class _ChatRoomPageState extends State<ChatRoomPage> {
},
),
),
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,
),
),
),
),
],
);
}
Expand Down
35 changes: 18 additions & 17 deletions lib/chat/view/chat_room/chat_timeline_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -130,27 +130,28 @@ class _ChatTimelineListState extends State<ChatTimelineList> {
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,
Expand Down
12 changes: 0 additions & 12 deletions lib/chat/view/chat_room/titlebar/chat_room_title_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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: '<Right hero tag>',
border: BorderSide.none,
Expand All @@ -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(),
Expand Down
13 changes: 4 additions & 9 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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();
Expand Down

0 comments on commit 4ad2397

Please sign in to comment.