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