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(),
),
),
),
),
),
);
}
This is documentation for
Stream Chat Flutter SDK v4, 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: