Merge branch 'krille/status-header-fixes' into 'master'

Fix: Status header design

See merge request ChristianPauly/fluffychat-flutter!135
This commit is contained in:
Christian Pauly 2020-08-22 13:26:38 +00:00
commit e9d6a10949
2 changed files with 140 additions and 122 deletions

View File

@ -480,6 +480,7 @@ class _ChatState extends State<_Chat> {
), ),
Column( Column(
children: <Widget>[ children: <Widget>[
ConnectionStatusHeader(),
Expanded( Expanded(
child: FutureBuilder<bool>( child: FutureBuilder<bool>(
future: getTimeline(), future: getTimeline(),
@ -601,7 +602,6 @@ class _ChatState extends State<_Chat> {
}, },
), ),
), ),
ConnectionStatusHeader(),
AnimatedContainer( AnimatedContainer(
duration: Duration(milliseconds: 300), duration: Duration(milliseconds: 300),
height: editEvent != null || replyEvent != null ? 56 : 0, height: editEvent != null || replyEvent != null ? 56 : 0,

View File

@ -336,7 +336,11 @@ class _ChatListState extends State<ChatList> {
context, NewPrivateChatView()), context, NewPrivateChatView()),
(r) => r.isFirst), (r) => r.isFirst),
), ),
body: StreamBuilder( body: Column(
children: [
ConnectionStatusHeader(),
Expanded(
child: StreamBuilder(
stream: Matrix.of(context) stream: Matrix.of(context)
.client .client
.onSync .onSync
@ -352,8 +356,10 @@ class _ChatListState extends State<ChatList> {
rooms.removeWhere((Room room) => rooms.removeWhere((Room room) =>
room.lastEvent == null || room.lastEvent == null ||
(searchMode && (searchMode &&
!room.displayname.toLowerCase().contains( !room.displayname
searchController.text.toLowerCase() ?? .toLowerCase()
.contains(searchController.text
.toLowerCase() ??
''))); '')));
if (rooms.isEmpty && if (rooms.isEmpty &&
(!searchMode || (!searchMode ||
@ -378,15 +384,17 @@ class _ChatListState extends State<ChatList> {
); );
} }
final publicRoomsCount = final publicRoomsCount =
(publicRoomsResponse?.chunk?.length ?? 0); (publicRoomsResponse?.chunk?.length ??
0);
final totalCount = final totalCount =
rooms.length + publicRoomsCount; rooms.length + publicRoomsCount;
final directChats = final directChats = rooms
rooms.where((r) => r.isDirectChat).toList(); .where((r) => r.isDirectChat)
.toList();
final presences = final presences =
Matrix.of(context).client.presences; Matrix.of(context).client.presences;
directChats.sort((a, b) => directChats.sort((a, b) => presences[
presences[b.directChatMatrixID] b.directChatMatrixID]
?.presence ?.presence
?.statusMsg != ?.statusMsg !=
null null
@ -400,10 +408,12 @@ class _ChatListState extends State<ChatList> {
i == totalCount - publicRoomsCount i == totalCount - publicRoomsCount
? ListTile( ? ListTile(
title: Text( title: Text(
L10n.of(context).publicRooms + L10n.of(context)
.publicRooms +
':', ':',
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight:
FontWeight.bold,
color: Theme.of(context) color: Theme.of(context)
.primaryColor, .primaryColor,
), ),
@ -411,12 +421,12 @@ class _ChatListState extends State<ChatList> {
) )
: Container(), : Container(),
itemCount: totalCount + 1, itemCount: totalCount + 1,
itemBuilder: (BuildContext context, int i) { itemBuilder:
(BuildContext context, int i) {
if (i == 0) { if (i == 0) {
return Column( return Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
ConnectionStatusHeader(),
(directChats.isEmpty || (directChats.isEmpty ||
selectMode == selectMode ==
SelectMode.share) SelectMode.share)
@ -426,16 +436,19 @@ class _ChatListState extends State<ChatList> {
Size.fromHeight(90), Size.fromHeight(90),
child: Container( child: Container(
height: 82, height: 82,
child: ListView.builder( child:
ListView.builder(
scrollDirection: scrollDirection:
Axis.horizontal, Axis.horizontal,
itemCount: itemCount:
directChats.length, directChats
.length,
itemBuilder: (BuildContext itemBuilder: (BuildContext
context, context,
int i) => int i) =>
PresenceListItem( PresenceListItem(
directChats[i]), directChats[
i]),
), ),
), ),
), ),
@ -446,10 +459,12 @@ class _ChatListState extends State<ChatList> {
return i < rooms.length return i < rooms.length
? ChatListItem( ? ChatListItem(
rooms[i], rooms[i],
activeChat: widget.activeChat == activeChat:
widget.activeChat ==
rooms[i].id, rooms[i].id,
) )
: PublicRoomListItem(publicRoomsResponse : PublicRoomListItem(
publicRoomsResponse
.chunk[i - rooms.length]); .chunk[i - rooms.length]);
}); });
} else { } else {
@ -460,6 +475,9 @@ class _ChatListState extends State<ChatList> {
}, },
); );
}), }),
),
],
),
); );
}); });
}); });