This is documentation for Stream Chat Flutter SDK v7, which is nolonger actively maintained. For up-to-date documentation, see the latest version (v8).

StreamMemberGridView

A widget for displaying and selecting members in a grid view.

Find the pub.dev documentation here

Background

The StreamMemberGridView widget allows displaying a list of members in a GridView.

See the StreamMemberListView documentation for displaying members in a ListView.

Basic Example

class MemberGridPage extends StatefulWidget {
  const MemberGridPage({
    super.key,
    required this.client,
  });

  final Channel channel;

  @override
  State<MemberGridPage> createState() => _MemberGridPageState();
}

class _MemberGridPageState extends State<MemberGridPage> {
  late final _controller = StreamMemberListController(
    channel: widget.channel,
    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: StreamMemberGridView(
            controller: _controller,
            onMemberTap: (member) => Navigator.push(
              context,
              MaterialPageRoute(
                builder: (_) => Scaffold(
                  body: Center(
                    child: StreamUserAvatar(
                      user: member.user!,
                    ),
                 ),
               ),
              ),
            ),
          ),
        ),
      );
}
© Getstream.io, Inc. All Rights Reserved.