selectMember method

Future selectMember(
  1. BuildContext context
)

选择@的成员

Implementation

Future<dynamic> selectMember(BuildContext context) async {
  return showModalBottomSheet(
      context: context,
      shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.only(
              topLeft: Radius.circular(8), topRight: Radius.circular(8))),
      builder: (context) {
        return ValueListenableBuilder(
          valueListenable: _teamMemberList,
          builder: (BuildContext context, List<UserInfoWithTeam>? value,
              Widget? child) {
            var _teamMembers = value
                ?.where((element) =>
                    element.userInfo?.accountId != IMKitClient.account())
                .toList();
            return Column(
              children: [
                SizedBox(
                  height: 48,
                  child: Stack(
                    alignment: Alignment.centerLeft,
                    children: [
                      IconButton(
                          onPressed: () {
                            Navigator.pop(context);
                          },
                          icon: Icon(
                            Icons.keyboard_arrow_down_rounded,
                            color: CommonColors.color_999999,
                          )),
                      Align(
                          alignment: Alignment.center,
                          child:
                              Text(S.of(context).chatMessageAitContactTitle))
                    ],
                  ),
                ),
                if (NIMChatCache.instance.haveAitAllPrivilege())
                  ListTile(
                    leading: SvgPicture.asset(
                      'images/ic_team_all.svg',
                      package: kPackage,
                      height: 42,
                      width: 42,
                    ),
                    title: Text(S.of(context).chatTeamAitAll),
                    onTap: () {
                      Navigator.pop(context, AitContactsModel.accountAll);
                    },
                  ),
                if (_teamMembers?.isNotEmpty == true)
                  Expanded(
                      child: ListView.builder(
                          controller: _scrollController,
                          itemCount: _teamMembers!.length,
                          itemBuilder: (context, index) {
                            var user = _teamMembers[index];
                            return ListTile(
                              leading: Avatar(
                                avatar: user.getAvatar(),
                                name: user.getName(
                                    needAlias: false, needTeamNick: false),
                                height: 42,
                                width: 42,
                              ),
                              title: Text(
                                user.getName(),
                                maxLines: 1,
                                overflow: TextOverflow.ellipsis,
                              ),
                              onTap: () {
                                Navigator.pop(context, user);
                              },
                            );
                          }))
              ],
            );
          },
        );
      });
}