mirror of
https://github.com/Iconica-Development/flutter_chat.git
synced 2025-05-19 10:53:51 +02:00
fix: profile avater correct defaults
This commit is contained in:
parent
c3928c19f6
commit
f6a2a26def
10 changed files with 43 additions and 29 deletions
|
@ -1,3 +1,9 @@
|
|||
## 0.4.0 - October 27 2023
|
||||
|
||||
- Show amount of unread messages per chat
|
||||
- More intuitive chat UI
|
||||
- Fix default profile avatars
|
||||
|
||||
## 0.3.4 - October 25 2023
|
||||
|
||||
- Add interface methods for getting amount of unread messages
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
name: flutter_community_chat
|
||||
description: A new Flutter package project.
|
||||
version: 0.3.4
|
||||
version: 0.4.0
|
||||
|
||||
publish_to: none
|
||||
|
||||
|
@ -19,12 +19,12 @@ dependencies:
|
|||
git:
|
||||
url: https://github.com/Iconica-Development/flutter_community_chat
|
||||
path: packages/flutter_community_chat_view
|
||||
ref: 0.3.4
|
||||
ref: 0.4.0
|
||||
flutter_community_chat_interface:
|
||||
git:
|
||||
url: https://github.com/Iconica-Development/flutter_community_chat
|
||||
path: packages/flutter_community_chat_interface
|
||||
ref: 0.3.4
|
||||
ref: 0.4.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_lints: ^2.0.0
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
name: flutter_community_chat_firebase
|
||||
description: A new Flutter package project.
|
||||
version: 0.3.4
|
||||
version: 0.4.0
|
||||
publish_to: none
|
||||
|
||||
environment:
|
||||
|
@ -23,7 +23,7 @@ dependencies:
|
|||
git:
|
||||
url: https://github.com/Iconica-Development/flutter_community_chat
|
||||
path: packages/flutter_community_chat_interface
|
||||
ref: 0.3.4
|
||||
ref: 0.4.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_lints: ^2.0.0
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
name: flutter_community_chat_interface
|
||||
description: A new Flutter package project.
|
||||
version: 0.3.4
|
||||
version: 0.4.0
|
||||
publish_to: none
|
||||
|
||||
environment:
|
||||
|
|
|
@ -18,7 +18,7 @@ dependencies:
|
|||
git:
|
||||
url: https://github.com/Iconica-Development/flutter_community_chat
|
||||
path: packages/flutter_community_chat_view
|
||||
ref: 0.3.4
|
||||
ref: 0.4.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
|
|
@ -4,17 +4,19 @@
|
|||
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_community_chat_interface/flutter_community_chat_interface.dart';
|
||||
import 'package:flutter_community_chat_view/flutter_community_chat_view.dart';
|
||||
import 'package:flutter_community_chat_view/src/components/chat_image.dart';
|
||||
import 'package:flutter_community_chat_view/src/services/date_formatter.dart';
|
||||
|
||||
class ChatDetailRow extends StatefulWidget {
|
||||
const ChatDetailRow({
|
||||
required this.message,
|
||||
required this.userAvatarBuilder,
|
||||
super.key,
|
||||
});
|
||||
|
||||
final ChatMessageModel message;
|
||||
final UserAvatarBuilder userAvatarBuilder;
|
||||
|
||||
@override
|
||||
State<ChatDetailRow> createState() => _ChatDetailRowState();
|
||||
|
@ -31,8 +33,14 @@ class _ChatDetailRowState extends State<ChatDetailRow> {
|
|||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 10.0),
|
||||
child: ChatImage(
|
||||
image: widget.message.sender.imageUrl,
|
||||
child: widget.message.sender.imageUrl != null &&
|
||||
widget.message.sender.imageUrl!.isNotEmpty
|
||||
? ChatImage(
|
||||
image: widget.message.sender.imageUrl!,
|
||||
)
|
||||
: widget.userAvatarBuilder(
|
||||
widget.message.sender,
|
||||
30,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
|
|
|
@ -7,12 +7,12 @@ import 'package:flutter/material.dart';
|
|||
|
||||
class ChatImage extends StatelessWidget {
|
||||
const ChatImage({
|
||||
super.key,
|
||||
this.image,
|
||||
required this.image,
|
||||
this.size = 40,
|
||||
super.key,
|
||||
});
|
||||
|
||||
final String? image;
|
||||
final String image;
|
||||
final double size;
|
||||
|
||||
@override
|
||||
|
@ -24,10 +24,8 @@ class ChatImage extends StatelessWidget {
|
|||
),
|
||||
width: size,
|
||||
height: size,
|
||||
child: image == null || image!.isEmpty
|
||||
? const Center(child: Icon(Icons.person))
|
||||
: CachedNetworkImage(
|
||||
imageUrl: image!,
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: image,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
);
|
||||
|
|
|
@ -100,7 +100,7 @@ Widget _createUserAvatar(
|
|||
double size,
|
||||
) =>
|
||||
ChatImage(
|
||||
image: user.imageUrl,
|
||||
image: user.imageUrl ?? '',
|
||||
size: size,
|
||||
);
|
||||
Widget _createGroupAvatar(
|
||||
|
|
|
@ -50,8 +50,8 @@ class ChatDetailScreen extends StatefulWidget {
|
|||
|
||||
class _ChatDetailScreenState extends State<ChatDetailScreen> {
|
||||
// stream listener that needs to be disposed later
|
||||
late StreamSubscription<List<ChatMessageModel>>? _chatMessagesSubscription;
|
||||
late Stream<List<ChatMessageModel>>? _chatMessages;
|
||||
StreamSubscription<List<ChatMessageModel>>? _chatMessagesSubscription;
|
||||
Stream<List<ChatMessageModel>>? _chatMessages;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
@ -67,10 +67,11 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
|
|||
widget.onReadChat(widget.chat!);
|
||||
}
|
||||
});
|
||||
// set the chat to read when opening the screen
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (widget.chat != null) {
|
||||
widget.onReadChat(widget.chat!);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -159,6 +160,7 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
|
|||
.reversed)
|
||||
ChatDetailRow(
|
||||
message: message,
|
||||
userAvatarBuilder: widget.options.userAvatarBuilder,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
name: flutter_community_chat_view
|
||||
description: A standard flutter package.
|
||||
version: 0.3.4
|
||||
version: 0.4.0
|
||||
|
||||
publish_to: none
|
||||
|
||||
|
@ -20,7 +20,7 @@ dependencies:
|
|||
git:
|
||||
url: https://github.com/Iconica-Development/flutter_community_chat
|
||||
path: packages/flutter_community_chat_interface
|
||||
ref: 0.3.4
|
||||
ref: 0.4.0
|
||||
cached_network_image: ^3.2.2
|
||||
flutter_image_picker:
|
||||
git:
|
||||
|
|
Loading…
Reference in a new issue