mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-25 23:12:37 +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),
|
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,76 +352,82 @@ class _ChatListState extends State<ChatList> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: Column(
|
body: FutureBuilder<bool>(
|
||||||
children: <Widget>[
|
future: waitForFirstSync(context),
|
||||||
Divider(
|
builder: (BuildContext context, snapshot) {
|
||||||
height: 1,
|
if (snapshot.hasData) {
|
||||||
color: Theme.of(context).secondaryHeaderColor,
|
List<Room> rooms = List<Room>.from(Matrix.of(context).client.rooms);
|
||||||
),
|
rooms.removeWhere((Room room) =>
|
||||||
Expanded(
|
searchMode &&
|
||||||
child: FutureBuilder<bool>(
|
!room.displayname
|
||||||
future: waitForFirstSync(context),
|
.toLowerCase()
|
||||||
builder: (BuildContext context, snapshot) {
|
.contains(searchController.text.toLowerCase() ?? ""));
|
||||||
if (snapshot.hasData) {
|
if (rooms.isEmpty && (!searchMode || publicRoomsResponse == null)) {
|
||||||
List<Room> rooms =
|
return Center(
|
||||||
List<Room>.from(Matrix.of(context).client.rooms);
|
child: Column(
|
||||||
rooms.removeWhere((Room room) =>
|
mainAxisSize: MainAxisSize.min,
|
||||||
searchMode &&
|
children: <Widget>[
|
||||||
!room.displayname
|
Icon(
|
||||||
.toLowerCase()
|
searchMode ? Icons.search : Icons.chat_bubble_outline,
|
||||||
.contains(searchController.text.toLowerCase() ?? ""));
|
size: 80,
|
||||||
if (rooms.isEmpty &&
|
color: Colors.grey,
|
||||||
(!searchMode || publicRoomsResponse == null)) {
|
),
|
||||||
return Center(
|
Text(searchMode
|
||||||
child: Column(
|
? I18n.of(context).noRoomsFound
|
||||||
mainAxisSize: MainAxisSize.min,
|
: I18n.of(context).startYourFirstChat),
|
||||||
children: <Widget>[
|
],
|
||||||
Icon(
|
),
|
||||||
searchMode
|
);
|
||||||
? Icons.search
|
}
|
||||||
: Icons.chat_bubble_outline,
|
final int publicRoomsCount =
|
||||||
size: 80,
|
(publicRoomsResponse?.publicRooms?.length ?? 0);
|
||||||
color: Colors.grey,
|
final int totalCount = rooms.length + publicRoomsCount;
|
||||||
),
|
return ListView.separated(
|
||||||
Text(searchMode
|
separatorBuilder: (BuildContext context, int i) =>
|
||||||
? I18n.of(context).noRoomsFound
|
i == totalCount - publicRoomsCount - 1
|
||||||
: I18n.of(context).startYourFirstChat),
|
? Material(
|
||||||
],
|
elevation: 2,
|
||||||
),
|
child: ListTile(
|
||||||
);
|
title: Text(I18n.of(context).publicRooms),
|
||||||
}
|
),
|
||||||
final int publicRoomsCount =
|
|
||||||
(publicRoomsResponse?.publicRooms?.length ?? 0);
|
|
||||||
final int totalCount = rooms.length + publicRoomsCount;
|
|
||||||
return ListView.separated(
|
|
||||||
separatorBuilder: (BuildContext context, int i) =>
|
|
||||||
i == totalCount - publicRoomsCount - 1
|
|
||||||
? Material(
|
|
||||||
elevation: 2,
|
|
||||||
child: ListTile(
|
|
||||||
title: Text(I18n.of(context).publicRooms),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: Container(),
|
|
||||||
itemCount: totalCount,
|
|
||||||
itemBuilder: (BuildContext context, int i) => i <
|
|
||||||
rooms.length
|
|
||||||
? ChatListItem(
|
|
||||||
rooms[i],
|
|
||||||
activeChat: widget.activeChat == rooms[i].id,
|
|
||||||
)
|
)
|
||||||
: PublicRoomListItem(
|
: Container(),
|
||||||
publicRoomsResponse.publicRooms[i - rooms.length]),
|
itemCount: totalCount + 1,
|
||||||
);
|
itemBuilder: (BuildContext context, int i) {
|
||||||
} else {
|
if (i == 0) {
|
||||||
return Center(
|
return Matrix.of(context).client.statusList.isEmpty
|
||||||
child: CircularProgressIndicator(),
|
? 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]);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return Center(
|
||||||
|
child: CircularProgressIndicator(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user