mirror of
https://github.com/Iconica-Development/flutter_chat.git
synced 2025-05-19 10:53:51 +02:00
fix: getting users
This commit is contained in:
parent
c2437fb3ce
commit
5d959184de
2 changed files with 14 additions and 13 deletions
|
@ -16,9 +16,9 @@ class UserModel {
|
||||||
|
|
||||||
factory UserModel.fromMap(String id, Map<String, dynamic> data) => UserModel(
|
factory UserModel.fromMap(String id, Map<String, dynamic> data) => UserModel(
|
||||||
id: id,
|
id: id,
|
||||||
firstName: data["firstName"],
|
firstName: data["first_name"],
|
||||||
lastName: data["lastName"],
|
lastName: data["last_name"],
|
||||||
imageUrl: data["imageUrl"],
|
imageUrl: data["image_url"],
|
||||||
);
|
);
|
||||||
|
|
||||||
/// The user id
|
/// The user id
|
||||||
|
|
|
@ -62,15 +62,17 @@ class _UserListState extends State<UserList> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var theme = Theme.of(context);
|
var theme = Theme.of(context);
|
||||||
var translations = widget.options.translations;
|
var translations = widget.options.translations;
|
||||||
filteredUsers = users
|
filteredUsers = widget.query.isNotEmpty
|
||||||
.where(
|
? users
|
||||||
(user) =>
|
.where(
|
||||||
user.fullname?.toLowerCase().contains(
|
(user) =>
|
||||||
widget.query.toLowerCase(),
|
user.fullname?.toLowerCase().contains(
|
||||||
) ??
|
widget.query.toLowerCase(),
|
||||||
false,
|
) ??
|
||||||
)
|
false,
|
||||||
.toList();
|
)
|
||||||
|
.toList()
|
||||||
|
: users;
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
|
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
|
@ -78,7 +80,6 @@ class _UserListState extends State<UserList> {
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
var user = filteredUsers[index];
|
var user = filteredUsers[index];
|
||||||
var isSelected = widget.selectedUsers.any((u) => u.id == user.id);
|
var isSelected = widget.selectedUsers.any((u) => u.id == user.id);
|
||||||
|
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
if (widget.creatingGroup) {
|
if (widget.creatingGroup) {
|
||||||
|
|
Loading…
Reference in a new issue