mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-16 17:09:31 +01:00
Fix chatlist design
This commit is contained in:
parent
1cdbfc4f0b
commit
76ebe310a0
@ -289,7 +289,6 @@ class _ChatListState extends State<ChatList> {
|
||||
icon: Icon(Icons.close),
|
||||
onPressed: () => Matrix.of(context).shareContent = null,
|
||||
),
|
||||
elevation: Matrix.of(context).client.statusList.isEmpty ? null : 0,
|
||||
titleSpacing: 0,
|
||||
title: selectMode == SelectMode.share
|
||||
? Text(I18n.of(context).share)
|
||||
@ -321,21 +320,6 @@ class _ChatListState extends State<ChatList> {
|
||||
),
|
||||
),
|
||||
),
|
||||
bottom: Matrix.of(context).client.statusList.isEmpty
|
||||
? null
|
||||
: PreferredSize(
|
||||
preferredSize: Size.fromHeight(89),
|
||||
child: Container(
|
||||
height: 81,
|
||||
child: ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: Matrix.of(context).client.statusList.length,
|
||||
itemBuilder: (BuildContext context, int i) =>
|
||||
PresenceListItem(
|
||||
Matrix.of(context).client.statusList[i]),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
floatingActionButton: (AdaptivePageLayout.columnMode(context) ||
|
||||
selectMode == SelectMode.share)
|
||||
@ -368,34 +352,23 @@ class _ChatListState extends State<ChatList> {
|
||||
),
|
||||
],
|
||||
),
|
||||
body: Column(
|
||||
children: <Widget>[
|
||||
Divider(
|
||||
height: 1,
|
||||
color: Theme.of(context).secondaryHeaderColor,
|
||||
),
|
||||
Expanded(
|
||||
child: FutureBuilder<bool>(
|
||||
body: FutureBuilder<bool>(
|
||||
future: waitForFirstSync(context),
|
||||
builder: (BuildContext context, snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
List<Room> rooms =
|
||||
List<Room>.from(Matrix.of(context).client.rooms);
|
||||
List<Room> rooms = List<Room>.from(Matrix.of(context).client.rooms);
|
||||
rooms.removeWhere((Room room) =>
|
||||
searchMode &&
|
||||
!room.displayname
|
||||
.toLowerCase()
|
||||
.contains(searchController.text.toLowerCase() ?? ""));
|
||||
if (rooms.isEmpty &&
|
||||
(!searchMode || publicRoomsResponse == null)) {
|
||||
if (rooms.isEmpty && (!searchMode || publicRoomsResponse == null)) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
searchMode
|
||||
? Icons.search
|
||||
: Icons.chat_bubble_outline,
|
||||
searchMode ? Icons.search : Icons.chat_bubble_outline,
|
||||
size: 80,
|
||||
color: Colors.grey,
|
||||
),
|
||||
@ -419,16 +392,36 @@ class _ChatListState extends State<ChatList> {
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
itemCount: totalCount,
|
||||
itemBuilder: (BuildContext context, int i) => i <
|
||||
rooms.length
|
||||
itemCount: totalCount + 1,
|
||||
itemBuilder: (BuildContext context, int i) {
|
||||
if (i == 0) {
|
||||
return Matrix.of(context).client.statusList.isEmpty
|
||||
? Container()
|
||||
: PreferredSize(
|
||||
preferredSize: Size.fromHeight(89),
|
||||
child: Container(
|
||||
height: 81,
|
||||
child: ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount:
|
||||
Matrix.of(context).client.statusList.length,
|
||||
itemBuilder: (BuildContext context, int i) =>
|
||||
PresenceListItem(Matrix.of(context)
|
||||
.client
|
||||
.statusList[i]),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
i--;
|
||||
return i < rooms.length
|
||||
? ChatListItem(
|
||||
rooms[i],
|
||||
activeChat: widget.activeChat == rooms[i].id,
|
||||
)
|
||||
: PublicRoomListItem(
|
||||
publicRoomsResponse.publicRooms[i - rooms.length]),
|
||||
);
|
||||
publicRoomsResponse.publicRooms[i - rooms.length]);
|
||||
});
|
||||
} else {
|
||||
return Center(
|
||||
child: CircularProgressIndicator(),
|
||||
@ -436,9 +429,6 @@ class _ChatListState extends State<ChatList> {
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user