mirror of
https://github.com/Iconica-Development/flutter_chat.git
synced 2025-05-19 02:43:50 +02:00
feat: split first and lastname
This commit is contained in:
parent
f110c224a2
commit
3dde81838d
12 changed files with 26 additions and 52 deletions
|
@ -179,7 +179,7 @@ packages:
|
||||||
description:
|
description:
|
||||||
path: "packages/flutter_community_chat_interface"
|
path: "packages/flutter_community_chat_interface"
|
||||||
ref: HEAD
|
ref: HEAD
|
||||||
resolved-ref: "772764f84a2282f2f49de4a0910ae15024ceabd5"
|
resolved-ref: a6b21aab224b47e112ae771b3ce81c158843ee5d
|
||||||
url: "https://github.com/Iconica-Development/flutter_community_chat.git"
|
url: "https://github.com/Iconica-Development/flutter_community_chat.git"
|
||||||
source: git
|
source: git
|
||||||
version: "0.0.1"
|
version: "0.0.1"
|
||||||
|
@ -188,7 +188,7 @@ packages:
|
||||||
description:
|
description:
|
||||||
path: "packages/flutter_community_chat_view"
|
path: "packages/flutter_community_chat_view"
|
||||||
ref: HEAD
|
ref: HEAD
|
||||||
resolved-ref: "772764f84a2282f2f49de4a0910ae15024ceabd5"
|
resolved-ref: a6b21aab224b47e112ae771b3ce81c158843ee5d
|
||||||
url: "https://github.com/Iconica-Development/flutter_community_chat.git"
|
url: "https://github.com/Iconica-Development/flutter_community_chat.git"
|
||||||
source: git
|
source: git
|
||||||
version: "0.0.1"
|
version: "0.0.1"
|
||||||
|
@ -375,7 +375,7 @@ packages:
|
||||||
name: path_provider_android
|
name: path_provider_android
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.21"
|
version: "2.0.22"
|
||||||
path_provider_ios:
|
path_provider_ios:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: 2022 Iconica
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
|
|
||||||
import 'package:flutter_community_chat_interface/flutter_community_chat_interface.dart';
|
|
||||||
|
|
||||||
class FirebaseChatUserModel extends ChatUserModel {
|
|
||||||
FirebaseChatUserModel({
|
|
||||||
required super.name,
|
|
||||||
required super.imageUrl,
|
|
||||||
super.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
FirebaseChatUserModel.fromJson(String id, Map<String, Object?> json)
|
|
||||||
: this(
|
|
||||||
id: id,
|
|
||||||
name: json['name'] == null ? null : json['name'] as String,
|
|
||||||
imageUrl:
|
|
||||||
json['image_url'] == null ? null : json['image_url'] as String);
|
|
||||||
|
|
||||||
Map<String, Object?> toJson() {
|
|
||||||
return {
|
|
||||||
'name': name,
|
|
||||||
'image_url': imageUrl,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -43,7 +43,8 @@ class FirebaseUserService {
|
||||||
? ChatUserModel(id: id)
|
? ChatUserModel(id: id)
|
||||||
: ChatUserModel(
|
: ChatUserModel(
|
||||||
id: id,
|
id: id,
|
||||||
name: '${data.firstName} ${data.lastName}',
|
firstName: data.firstName,
|
||||||
|
lastName: data.lastName,
|
||||||
imageUrl: data.imageUrl,
|
imageUrl: data.imageUrl,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -79,7 +80,8 @@ class FirebaseUserService {
|
||||||
var userData = user.data();
|
var userData = user.data();
|
||||||
return ChatUserModel(
|
return ChatUserModel(
|
||||||
id: user.id,
|
id: user.id,
|
||||||
name: '${userData.firstName} ${userData.lastName}',
|
firstName: userData.firstName,
|
||||||
|
lastName: userData.lastName,
|
||||||
imageUrl: userData.imageUrl,
|
imageUrl: userData.imageUrl,
|
||||||
);
|
);
|
||||||
}).toList();
|
}).toList();
|
||||||
|
|
|
@ -154,7 +154,7 @@ packages:
|
||||||
name: firebase_auth
|
name: firebase_auth
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.1.3"
|
version: "4.1.4"
|
||||||
firebase_auth_platform_interface:
|
firebase_auth_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -228,7 +228,7 @@ packages:
|
||||||
description:
|
description:
|
||||||
path: "packages/flutter_community_chat_interface"
|
path: "packages/flutter_community_chat_interface"
|
||||||
ref: HEAD
|
ref: HEAD
|
||||||
resolved-ref: "772764f84a2282f2f49de4a0910ae15024ceabd5"
|
resolved-ref: a6b21aab224b47e112ae771b3ce81c158843ee5d
|
||||||
url: "https://github.com/Iconica-Development/flutter_community_chat.git"
|
url: "https://github.com/Iconica-Development/flutter_community_chat.git"
|
||||||
source: git
|
source: git
|
||||||
version: "0.0.1"
|
version: "0.0.1"
|
||||||
|
|
|
@ -5,11 +5,15 @@
|
||||||
class ChatUserModel {
|
class ChatUserModel {
|
||||||
ChatUserModel({
|
ChatUserModel({
|
||||||
this.id,
|
this.id,
|
||||||
this.name,
|
this.firstName,
|
||||||
|
this.lastName,
|
||||||
this.imageUrl,
|
this.imageUrl,
|
||||||
});
|
});
|
||||||
|
|
||||||
final String? id;
|
final String? id;
|
||||||
final String? name;
|
final String? firstName;
|
||||||
|
final String? lastName;
|
||||||
final String? imageUrl;
|
final String? imageUrl;
|
||||||
|
|
||||||
|
String get fullName => '$firstName $lastName';
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,7 +186,7 @@ packages:
|
||||||
description:
|
description:
|
||||||
path: "packages/flutter_community_chat_interface"
|
path: "packages/flutter_community_chat_interface"
|
||||||
ref: HEAD
|
ref: HEAD
|
||||||
resolved-ref: "772764f84a2282f2f49de4a0910ae15024ceabd5"
|
resolved-ref: a6b21aab224b47e112ae771b3ce81c158843ee5d
|
||||||
url: "https://github.com/Iconica-Development/flutter_community_chat.git"
|
url: "https://github.com/Iconica-Development/flutter_community_chat.git"
|
||||||
source: git
|
source: git
|
||||||
version: "0.0.1"
|
version: "0.0.1"
|
||||||
|
@ -322,7 +322,7 @@ packages:
|
||||||
name: path_provider_android
|
name: path_provider_android
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.21"
|
version: "2.0.22"
|
||||||
path_provider_ios:
|
path_provider_ios:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -45,9 +45,7 @@ class _ChatDetailRowState extends State<ChatDetailRow> {
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
widget.message.sender.name != null
|
widget.message.sender.fullName.toUpperCase(),
|
||||||
? widget.message.sender.name!.toUpperCase()
|
|
||||||
: '',
|
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_community_chat_view/src/components/chat_image.dart';
|
|
||||||
|
|
||||||
class ChatRow extends StatelessWidget {
|
class ChatRow extends StatelessWidget {
|
||||||
const ChatRow({
|
const ChatRow({
|
||||||
|
|
|
@ -47,7 +47,7 @@ class ChatDetailScreen extends StatelessWidget {
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(left: 15.5),
|
padding: const EdgeInsets.only(left: 15.5),
|
||||||
child: Text(
|
child: Text(
|
||||||
(chat as PersonalChatModel).user.name ?? '',
|
(chat as PersonalChatModel).user.fullName,
|
||||||
style: const TextStyle(fontSize: 18),
|
style: const TextStyle(fontSize: 18),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -77,7 +77,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||||
)
|
)
|
||||||
: Container(),
|
: Container(),
|
||||||
title: chat is PersonalChatModel
|
title: chat is PersonalChatModel
|
||||||
? chat.user.name ?? ''
|
? chat.user.fullName
|
||||||
: (chat as GroupChatModel).title,
|
: (chat as GroupChatModel).title,
|
||||||
subTitle: chat.lastMessage != null
|
subTitle: chat.lastMessage != null
|
||||||
? chat.lastMessage
|
? chat.lastMessage
|
||||||
|
|
|
@ -35,11 +35,9 @@ class _NewChatScreenState extends State<NewChatScreen> {
|
||||||
? null
|
? null
|
||||||
: widget.users
|
: widget.users
|
||||||
.where(
|
.where(
|
||||||
(user) =>
|
(user) => user.fullName.toLowerCase().contains(
|
||||||
user.name != null &&
|
query.toLowerCase(),
|
||||||
user.name!.toLowerCase().contains(
|
),
|
||||||
query.toLowerCase(),
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
.toList(),
|
.toList(),
|
||||||
);
|
);
|
||||||
|
@ -86,7 +84,7 @@ class _NewChatScreenState extends State<NewChatScreen> {
|
||||||
user,
|
user,
|
||||||
40.0,
|
40.0,
|
||||||
),
|
),
|
||||||
title: user.name ?? '',
|
title: user.fullName,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onTap: () => widget.onPressCreateChat(user),
|
onTap: () => widget.onPressCreateChat(user),
|
||||||
|
|
|
@ -179,7 +179,7 @@ packages:
|
||||||
description:
|
description:
|
||||||
path: "packages/flutter_community_chat_interface"
|
path: "packages/flutter_community_chat_interface"
|
||||||
ref: HEAD
|
ref: HEAD
|
||||||
resolved-ref: "772764f84a2282f2f49de4a0910ae15024ceabd5"
|
resolved-ref: a6b21aab224b47e112ae771b3ce81c158843ee5d
|
||||||
url: "https://github.com/Iconica-Development/flutter_community_chat.git"
|
url: "https://github.com/Iconica-Development/flutter_community_chat.git"
|
||||||
source: git
|
source: git
|
||||||
version: "0.0.1"
|
version: "0.0.1"
|
||||||
|
@ -308,7 +308,7 @@ packages:
|
||||||
name: path_provider_android
|
name: path_provider_android
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.21"
|
version: "2.0.22"
|
||||||
path_provider_ios:
|
path_provider_ios:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
Loading…
Reference in a new issue