Skip to main content
Version: v4

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.

note

Make sure to check the StreamUserListView documentation to know how to show results in a ListView.

Basic Example#

class UserGridPage extends StatefulWidget {
const UserGridPage({
Key? key,
required this.client,
}) : super(key: key);

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: [
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,
onChannelTap: (channel) => Navigator.push(
context,
MaterialPageRoute(
builder: (_) => StreamChannel(
channel: channel,
child: const ChannelPage(),
),
),
),
),
),
);
}

Did you find this page helpful?