class UserGridPage extends StatefulWidget {
const UserGridPage({
super.key,
required this.client,
});
final StreamChatClient client;
@override
State<UserGridPage> createState() => _UserGridPageState();
}
class _UserGridPageState extends State<UserGridPage> {
late final _controller = StreamUserListController(
client: widget.client,
limit: 25,
filter: Filter.and([
Filter.notEqual('id', StreamChat.of(context).currentUser!.id),
]),
sort: [
const SortOption(
'name',
direction: 1,
),
],
);
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) => Scaffold(
body: RefreshIndicator(
onRefresh: _controller.refresh,
child: StreamUserGridView(
controller: _controller,
onMemberTap: (member) => Navigator.push(
context,
MaterialPageRoute(
builder: (_) => Scaffold(
body: Center(
child: StreamUserAvatar(
user: member.user!,
),
),
),
),
),
),
),
);
}
This is documentation for
Stream Chat Flutter SDK v5, which is nolonger actively maintained. For up-to-date documentation, see the latest version (v8).
StreamUserGridView
A Widget For Displaying And Selecting Users
Find the pub.dev documentation here
Background
The StreamUserGridView
widget allows displaying a list of users in a GridView
.
Make sure to check the StreamUserListView documentation to know how to show results in a ListView
.
Basic Example
On this page: