feat: split first and lastname

This commit is contained in:
Stein Milder 2022-11-24 16:01:40 +01:00
parent f110c224a2
commit 3dde81838d
12 changed files with 26 additions and 52 deletions

View file

@ -179,7 +179,7 @@ packages:
description:
path: "packages/flutter_community_chat_interface"
ref: HEAD
resolved-ref: "772764f84a2282f2f49de4a0910ae15024ceabd5"
resolved-ref: a6b21aab224b47e112ae771b3ce81c158843ee5d
url: "https://github.com/Iconica-Development/flutter_community_chat.git"
source: git
version: "0.0.1"
@ -188,7 +188,7 @@ packages:
description:
path: "packages/flutter_community_chat_view"
ref: HEAD
resolved-ref: "772764f84a2282f2f49de4a0910ae15024ceabd5"
resolved-ref: a6b21aab224b47e112ae771b3ce81c158843ee5d
url: "https://github.com/Iconica-Development/flutter_community_chat.git"
source: git
version: "0.0.1"
@ -375,7 +375,7 @@ packages:
name: path_provider_android
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.21"
version: "2.0.22"
path_provider_ios:
dependency: transitive
description:

View file

@ -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,
};
}
}

View file

@ -43,7 +43,8 @@ class FirebaseUserService {
? ChatUserModel(id: id)
: ChatUserModel(
id: id,
name: '${data.firstName} ${data.lastName}',
firstName: data.firstName,
lastName: data.lastName,
imageUrl: data.imageUrl,
);
@ -79,7 +80,8 @@ class FirebaseUserService {
var userData = user.data();
return ChatUserModel(
id: user.id,
name: '${userData.firstName} ${userData.lastName}',
firstName: userData.firstName,
lastName: userData.lastName,
imageUrl: userData.imageUrl,
);
}).toList();

View file

@ -154,7 +154,7 @@ packages:
name: firebase_auth
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.3"
version: "4.1.4"
firebase_auth_platform_interface:
dependency: transitive
description:
@ -228,7 +228,7 @@ packages:
description:
path: "packages/flutter_community_chat_interface"
ref: HEAD
resolved-ref: "772764f84a2282f2f49de4a0910ae15024ceabd5"
resolved-ref: a6b21aab224b47e112ae771b3ce81c158843ee5d
url: "https://github.com/Iconica-Development/flutter_community_chat.git"
source: git
version: "0.0.1"

View file

@ -5,11 +5,15 @@
class ChatUserModel {
ChatUserModel({
this.id,
this.name,
this.firstName,
this.lastName,
this.imageUrl,
});
final String? id;
final String? name;
final String? firstName;
final String? lastName;
final String? imageUrl;
String get fullName => '$firstName $lastName';
}

View file

@ -186,7 +186,7 @@ packages:
description:
path: "packages/flutter_community_chat_interface"
ref: HEAD
resolved-ref: "772764f84a2282f2f49de4a0910ae15024ceabd5"
resolved-ref: a6b21aab224b47e112ae771b3ce81c158843ee5d
url: "https://github.com/Iconica-Development/flutter_community_chat.git"
source: git
version: "0.0.1"
@ -322,7 +322,7 @@ packages:
name: path_provider_android
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.21"
version: "2.0.22"
path_provider_ios:
dependency: transitive
description:

View file

@ -45,9 +45,7 @@ class _ChatDetailRowState extends State<ChatDetailRow> {
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
widget.message.sender.name != null
? widget.message.sender.name!.toUpperCase()
: '',
widget.message.sender.fullName.toUpperCase(),
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,

View file

@ -3,7 +3,6 @@
// SPDX-License-Identifier: BSD-3-Clause
import 'package:flutter/material.dart';
import 'package:flutter_community_chat_view/src/components/chat_image.dart';
class ChatRow extends StatelessWidget {
const ChatRow({

View file

@ -47,7 +47,7 @@ class ChatDetailScreen extends StatelessWidget {
child: Padding(
padding: const EdgeInsets.only(left: 15.5),
child: Text(
(chat as PersonalChatModel).user.name ?? '',
(chat as PersonalChatModel).user.fullName,
style: const TextStyle(fontSize: 18),
),
),

View file

@ -77,7 +77,7 @@ class _ChatScreenState extends State<ChatScreen> {
)
: Container(),
title: chat is PersonalChatModel
? chat.user.name ?? ''
? chat.user.fullName
: (chat as GroupChatModel).title,
subTitle: chat.lastMessage != null
? chat.lastMessage

View file

@ -35,9 +35,7 @@ class _NewChatScreenState extends State<NewChatScreen> {
? null
: widget.users
.where(
(user) =>
user.name != null &&
user.name!.toLowerCase().contains(
(user) => user.fullName.toLowerCase().contains(
query.toLowerCase(),
),
)
@ -86,7 +84,7 @@ class _NewChatScreenState extends State<NewChatScreen> {
user,
40.0,
),
title: user.name ?? '',
title: user.fullName,
),
),
onTap: () => widget.onPressCreateChat(user),

View file

@ -179,7 +179,7 @@ packages:
description:
path: "packages/flutter_community_chat_interface"
ref: HEAD
resolved-ref: "772764f84a2282f2f49de4a0910ae15024ceabd5"
resolved-ref: a6b21aab224b47e112ae771b3ce81c158843ee5d
url: "https://github.com/Iconica-Development/flutter_community_chat.git"
source: git
version: "0.0.1"
@ -308,7 +308,7 @@ packages:
name: path_provider_android
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.21"
version: "2.0.22"
path_provider_ios:
dependency: transitive
description: