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),
|
icon: Icon(Icons.close),
|
||||||
onPressed: () => Matrix.of(context).shareContent = null,
|
onPressed: () => Matrix.of(context).shareContent = null,
|
||||||
),
|
),
|
||||||
elevation: Matrix.of(context).client.statusList.isEmpty ? null : 0,
|
|
||||||
titleSpacing: 0,
|
titleSpacing: 0,
|
||||||
title: selectMode == SelectMode.share
|
title: selectMode == SelectMode.share
|
||||||
? Text(I18n.of(context).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) ||
|
floatingActionButton: (AdaptivePageLayout.columnMode(context) ||
|
||||||
selectMode == SelectMode.share)
|
selectMode == SelectMode.share)
|
||||||
|
@ -368,34 +352,23 @@ class _ChatListState extends State<ChatList> {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: Column(
|
body: FutureBuilder<bool>(
|
||||||
children: <Widget>[
|
|
||||||
Divider(
|
|
||||||
height: 1,
|
|
||||||
color: Theme.of(context).secondaryHeaderColor,
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: FutureBuilder<bool>(
|
|
||||||
future: waitForFirstSync(context),
|
future: waitForFirstSync(context),
|
||||||
builder: (BuildContext context, snapshot) {
|
builder: (BuildContext context, snapshot) {
|
||||||
if (snapshot.hasData) {
|
if (snapshot.hasData) {
|
||||||
List<Room> rooms =
|
List<Room> rooms = List<Room>.from(Matrix.of(context).client.rooms);
|
||||||
List<Room>.from(Matrix.of(context).client.rooms);
|
|
||||||
rooms.removeWhere((Room room) =>
|
rooms.removeWhere((Room room) =>
|
||||||
searchMode &&
|
searchMode &&
|
||||||
!room.displayname
|
!room.displayname
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.contains(searchController.text.toLowerCase() ?? ""));
|
.contains(searchController.text.toLowerCase() ?? ""));
|
||||||
if (rooms.isEmpty &&
|
if (rooms.isEmpty && (!searchMode || publicRoomsResponse == null)) {
|
||||||
(!searchMode || publicRoomsResponse == null)) {
|
|
||||||
return Center(
|
return Center(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Icon(
|
Icon(
|
||||||
searchMode
|
searchMode ? Icons.search : Icons.chat_bubble_outline,
|
||||||
? Icons.search
|
|
||||||
: Icons.chat_bubble_outline,
|
|
||||||
size: 80,
|
size: 80,
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
),
|
),
|
||||||
|
@ -419,16 +392,36 @@ class _ChatListState extends State<ChatList> {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: Container(),
|
: Container(),
|
||||||
itemCount: totalCount,
|
itemCount: totalCount + 1,
|
||||||
itemBuilder: (BuildContext context, int i) => i <
|
itemBuilder: (BuildContext context, int i) {
|
||||||
rooms.length
|
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(
|
? ChatListItem(
|
||||||
rooms[i],
|
rooms[i],
|
||||||
activeChat: widget.activeChat == rooms[i].id,
|
activeChat: widget.activeChat == rooms[i].id,
|
||||||
)
|
)
|
||||||
: PublicRoomListItem(
|
: PublicRoomListItem(
|
||||||
publicRoomsResponse.publicRooms[i - rooms.length]),
|
publicRoomsResponse.publicRooms[i - rooms.length]);
|
||||||
);
|
});
|
||||||
} else {
|
} else {
|
||||||
return Center(
|
return Center(
|
||||||
child: CircularProgressIndicator(),
|
child: CircularProgressIndicator(),
|
||||||
|
@ -436,9 +429,6 @@ class _ChatListState extends State<ChatList> {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue