chore: Follow up styling

This commit is contained in:
Krille 2023-03-20 07:56:49 +01:00
parent 20c1dbd00a
commit d211dd4aeb
No known key found for this signature in database
2 changed files with 166 additions and 160 deletions

View File

@ -72,176 +72,181 @@ class ChatListViewBody extends StatelessWidget {
ActiveFilter.messages, ActiveFilter.messages,
}.contains(controller.activeFilter) && }.contains(controller.activeFilter) &&
client.storiesRooms.isNotEmpty; client.storiesRooms.isNotEmpty;
return CustomScrollView( return SafeArea(
controller: controller.scrollController, child: CustomScrollView(
slivers: [ controller: controller.scrollController,
ChatListHeader(controller: controller), slivers: [
SliverList( ChatListHeader(controller: controller),
delegate: SliverChildListDelegate( SliverList(
[ delegate: SliverChildListDelegate(
if (controller.isSearchMode) ...[ [
SearchTitle( if (controller.isSearchMode) ...[
title: L10n.of(context)!.publicRooms, SearchTitle(
icon: const Icon(Icons.explore_outlined), title: L10n.of(context)!.publicRooms,
), icon: const Icon(Icons.explore_outlined),
AnimatedContainer( ),
clipBehavior: Clip.hardEdge, AnimatedContainer(
decoration: const BoxDecoration(), clipBehavior: Clip.hardEdge,
height: roomSearchResult == null || decoration: const BoxDecoration(),
roomSearchResult.chunk.isEmpty height: roomSearchResult == null ||
? 0 roomSearchResult.chunk.isEmpty
: 106, ? 0
duration: FluffyThemes.animationDuration, : 106,
curve: FluffyThemes.animationCurve, duration: FluffyThemes.animationDuration,
child: roomSearchResult == null curve: FluffyThemes.animationCurve,
? null child: roomSearchResult == null
: ListView.builder( ? null
scrollDirection: Axis.horizontal, : ListView.builder(
itemCount: roomSearchResult.chunk.length, scrollDirection: Axis.horizontal,
itemBuilder: (context, i) => _SearchItem( itemCount: roomSearchResult.chunk.length,
title: roomSearchResult.chunk[i].name ?? itemBuilder: (context, i) => _SearchItem(
roomSearchResult.chunk[i].canonicalAlias title: roomSearchResult.chunk[i].name ??
?.localpart ?? roomSearchResult.chunk[i]
L10n.of(context)!.group, .canonicalAlias?.localpart ??
avatar: roomSearchResult.chunk[i].avatarUrl, L10n.of(context)!.group,
onPressed: () => showAdaptiveBottomSheet( avatar:
context: context, roomSearchResult.chunk[i].avatarUrl,
builder: (c) => PublicRoomBottomSheet( onPressed: () => showAdaptiveBottomSheet(
roomAlias: roomSearchResult context: context,
.chunk[i].canonicalAlias ?? builder: (c) => PublicRoomBottomSheet(
roomSearchResult.chunk[i].roomId, roomAlias: roomSearchResult
outerContext: context, .chunk[i].canonicalAlias ??
chunk: roomSearchResult.chunk[i], roomSearchResult.chunk[i].roomId,
outerContext: context,
chunk: roomSearchResult.chunk[i],
),
), ),
), ),
), ),
), ),
), SearchTitle(
SearchTitle( title: L10n.of(context)!.users,
title: L10n.of(context)!.users, icon: const Icon(Icons.group_outlined),
icon: const Icon(Icons.group_outlined), ),
), AnimatedContainer(
AnimatedContainer( clipBehavior: Clip.hardEdge,
clipBehavior: Clip.hardEdge, decoration: const BoxDecoration(),
decoration: const BoxDecoration(), height: userSearchResult == null ||
height: userSearchResult == null || userSearchResult.results.isEmpty
userSearchResult.results.isEmpty ? 0
? 0 : 106,
: 106, duration: FluffyThemes.animationDuration,
duration: FluffyThemes.animationDuration, curve: FluffyThemes.animationCurve,
curve: FluffyThemes.animationCurve, child: userSearchResult == null
child: userSearchResult == null ? null
? null : ListView.builder(
: ListView.builder( scrollDirection: Axis.horizontal,
scrollDirection: Axis.horizontal, itemCount: userSearchResult.results.length,
itemCount: userSearchResult.results.length, itemBuilder: (context, i) => _SearchItem(
itemBuilder: (context, i) => _SearchItem( title: userSearchResult
title: userSearchResult .results[i].displayName ??
.results[i].displayName ?? userSearchResult
userSearchResult .results[i].userId.localpart ??
.results[i].userId.localpart ?? L10n.of(context)!.unknownDevice,
L10n.of(context)!.unknownDevice, avatar:
avatar: userSearchResult.results[i].avatarUrl,
userSearchResult.results[i].avatarUrl, onPressed: () => showAdaptiveBottomSheet(
onPressed: () => showAdaptiveBottomSheet( context: context,
context: context, builder: (c) => ProfileBottomSheet(
builder: (c) => ProfileBottomSheet( userId: userSearchResult
userId: .results[i].userId,
userSearchResult.results[i].userId, outerContext: context,
outerContext: context, ),
), ),
), ),
), ),
),
SearchTitle(
title: L10n.of(context)!.stories,
icon: const Icon(Icons.camera_alt_outlined),
),
],
if (displayStoriesHeader)
StoriesHeader(
key: const Key('stories_header'),
filter: controller.searchController.text,
),
const ConnectionStatusHeader(),
AnimatedContainer(
height: controller.isTorBrowser ? 64 : 0,
duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve,
clipBehavior: Clip.hardEdge,
decoration: const BoxDecoration(),
child: Material(
color: Theme.of(context).colorScheme.surface,
child: ListTile(
leading: const Icon(Icons.vpn_key),
title: Text(L10n.of(context)!.dehydrateTor),
subtitle:
Text(L10n.of(context)!.dehydrateTorLong),
trailing:
const Icon(Icons.chevron_right_outlined),
onTap: controller.dehydrate,
),
),
),
if (controller.isSearchMode)
SearchTitle(
title: L10n.of(context)!.chats,
icon: const Icon(Icons.forum_outlined),
),
if (rooms.isEmpty && !controller.isSearchMode) ...[
Padding(
padding: const EdgeInsets.all(32.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
'assets/start_chat.png',
height: 256,
), ),
), const Divider(height: 1),
SearchTitle( ],
title: L10n.of(context)!.stories, ),
icon: const Icon(Icons.camera_alt_outlined), ),
), Center(
child: StartChatFloatingActionButton(
activeFilter: controller.activeFilter,
roomsIsEmpty: true,
scrolledToTop: controller.scrolledToTop,
),
),
],
], ],
if (displayStoriesHeader) ),
StoriesHeader(
key: const Key('stories_header'),
filter: controller.searchController.text,
),
const ConnectionStatusHeader(),
AnimatedContainer(
height: controller.isTorBrowser ? 64 : 0,
duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve,
clipBehavior: Clip.hardEdge,
decoration: const BoxDecoration(),
child: Material(
color: Theme.of(context).colorScheme.surface,
child: ListTile(
leading: const Icon(Icons.vpn_key),
title: Text(L10n.of(context)!.dehydrateTor),
subtitle: Text(L10n.of(context)!.dehydrateTorLong),
trailing: const Icon(Icons.chevron_right_outlined),
onTap: controller.dehydrate,
),
),
),
if (controller.isSearchMode)
SearchTitle(
title: L10n.of(context)!.chats,
icon: const Icon(Icons.forum_outlined),
),
if (rooms.isEmpty && !controller.isSearchMode) ...[
Padding(
padding: const EdgeInsets.all(32.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
'assets/start_chat.png',
height: 256,
),
const Divider(height: 1),
],
),
),
Center(
child: StartChatFloatingActionButton(
activeFilter: controller.activeFilter,
roomsIsEmpty: true,
scrolledToTop: controller.scrolledToTop,
),
),
],
],
), ),
), SliverList(
SliverList( delegate: SliverChildBuilderDelegate(
delegate: SliverChildBuilderDelegate( (BuildContext context, int i) {
(BuildContext context, int i) { if (!rooms[i]
if (!rooms[i] .getLocalizedDisplayname(
.getLocalizedDisplayname( MatrixLocals(L10n.of(context)!),
MatrixLocals(L10n.of(context)!), )
) .toLowerCase()
.toLowerCase() .contains(
.contains( controller.searchController.text.toLowerCase(),
controller.searchController.text.toLowerCase(), )) {
)) { return Container();
return Container(); }
} return ChatListItem(
return ChatListItem( rooms[i],
rooms[i], key: Key('chat_list_item_${rooms[i].id}'),
key: Key('chat_list_item_${rooms[i].id}'), selected:
selected: controller.selectedRoomIds.contains(rooms[i].id),
controller.selectedRoomIds.contains(rooms[i].id), onTap: controller.selectMode == SelectMode.select
onTap: controller.selectMode == SelectMode.select ? () => controller.toggleSelection(rooms[i].id)
? () => controller.toggleSelection(rooms[i].id) : null,
: null, onLongPress: () =>
onLongPress: () => controller.toggleSelection(rooms[i].id),
controller.toggleSelection(rooms[i].id), activeChat: controller.activeChat == rooms[i].id,
activeChat: controller.activeChat == rooms[i].id, );
); },
}, childCount: rooms.length,
childCount: rooms.length, ),
), ),
), ],
], ),
); );
} }
const dummyChatCount = 5; const dummyChatCount = 5;

View File

@ -69,6 +69,7 @@ class NewPrivateChatView extends StatelessWidget {
style: TextButton.styleFrom( style: TextButton.styleFrom(
fixedSize: fixedSize:
Size.fromWidth(qrCodeSize - (2 * _qrCodePadding)), Size.fromWidth(qrCodeSize - (2 * _qrCodePadding)),
foregroundColor: Colors.black,
), ),
icon: Icon(Icons.adaptive.share_outlined), icon: Icon(Icons.adaptive.share_outlined),
label: Text(L10n.of(context)!.shareYourInviteLink), label: Text(L10n.of(context)!.shareYourInviteLink),