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!,
),
),
),
),
),
),
),
);
}
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: