mirror of
https://github.com/Iconica-Development/flutter_chat.git
synced 2025-05-19 10:53:51 +02:00
fix: handle chat without lastmessage
This commit is contained in:
parent
67087ab147
commit
05ec6448f8
7 changed files with 39 additions and 31 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
## 0.3.1 - July 11 2023
|
||||||
|
|
||||||
|
- Removed image message when there is no last message in a chat
|
||||||
|
|
||||||
## 0.3.0 - March 31 2023
|
## 0.3.0 - March 31 2023
|
||||||
|
|
||||||
- Added support for group chats
|
- Added support for group chats
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name: flutter_community_chat
|
name: flutter_community_chat
|
||||||
description: A new Flutter package project.
|
description: A new Flutter package project.
|
||||||
version: 0.3.0
|
version: 0.3.1
|
||||||
|
|
||||||
publish_to: none
|
publish_to: none
|
||||||
|
|
||||||
|
@ -15,12 +15,12 @@ dependencies:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/Iconica-Development/flutter_community_chat.git
|
url: https://github.com/Iconica-Development/flutter_community_chat.git
|
||||||
path: packages/flutter_community_chat_view
|
path: packages/flutter_community_chat_view
|
||||||
ref: 0.3.0
|
ref: 0.3.1
|
||||||
flutter_community_chat_interface:
|
flutter_community_chat_interface:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/Iconica-Development/flutter_community_chat.git
|
url: https://github.com/Iconica-Development/flutter_community_chat.git
|
||||||
path: packages/flutter_community_chat_interface
|
path: packages/flutter_community_chat_interface
|
||||||
ref: 0.3.0
|
ref: 0.3.1
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_lints: ^2.0.0
|
flutter_lints: ^2.0.0
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
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.0
|
version: 0.3.1
|
||||||
publish_to: none
|
publish_to: none
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
|
@ -19,7 +19,7 @@ dependencies:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/Iconica-Development/flutter_community_chat.git
|
url: https://github.com/Iconica-Development/flutter_community_chat.git
|
||||||
path: packages/flutter_community_chat_interface
|
path: packages/flutter_community_chat_interface
|
||||||
ref: 0.3.0
|
ref: 0.3.1
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_lints: ^2.0.0
|
flutter_lints: ^2.0.0
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
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.0
|
version: 0.3.1
|
||||||
publish_to: none
|
publish_to: none
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
|
|
|
@ -54,3 +54,5 @@ windows
|
||||||
macos
|
macos
|
||||||
linux
|
linux
|
||||||
.metadata
|
.metadata
|
||||||
|
|
||||||
|
pubspec.lock
|
||||||
|
|
|
@ -33,9 +33,10 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
var translations = widget.translations;
|
||||||
return widget.options.scaffoldBuilder(
|
return widget.options.scaffoldBuilder(
|
||||||
AppBar(
|
AppBar(
|
||||||
title: Text(widget.translations.chatsTitle),
|
title: Text(translations.chatsTitle),
|
||||||
),
|
),
|
||||||
Column(
|
Column(
|
||||||
children: [
|
children: [
|
||||||
|
@ -54,16 +55,15 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) => AlertDialog(
|
builder: (BuildContext context) => AlertDialog(
|
||||||
title: Text(
|
title: Text(
|
||||||
widget.translations.deleteChatModalTitle,
|
translations.deleteChatModalTitle,
|
||||||
),
|
),
|
||||||
content: Text(
|
content: Text(
|
||||||
widget
|
translations.deleteChatModalDescription,
|
||||||
.translations.deleteChatModalDescription,
|
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
child: Text(
|
child: Text(
|
||||||
widget.translations.deleteChatModalCancel,
|
translations.deleteChatModalCancel,
|
||||||
),
|
),
|
||||||
onPressed: () =>
|
onPressed: () =>
|
||||||
Navigator.of(context).pop(false),
|
Navigator.of(context).pop(false),
|
||||||
|
@ -72,8 +72,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||||
onPressed: () =>
|
onPressed: () =>
|
||||||
Navigator.of(context).pop(true),
|
Navigator.of(context).pop(true),
|
||||||
child: Text(
|
child: Text(
|
||||||
widget
|
translations.deleteChatModalConfirm,
|
||||||
.translations.deleteChatModalConfirm,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -87,7 +86,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
widget.translations.deleteChatButton,
|
translations.deleteChatButton,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -106,13 +105,15 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||||
40.0,
|
40.0,
|
||||||
),
|
),
|
||||||
title: chat.user.fullName,
|
title: chat.user.fullName,
|
||||||
subTitle: chat.lastMessage != null &&
|
subTitle: chat.lastMessage != null
|
||||||
chat.lastMessage
|
? chat.lastMessage
|
||||||
is ChatTextMessageModel
|
is ChatTextMessageModel
|
||||||
? (chat.lastMessage!
|
? (chat.lastMessage!
|
||||||
as ChatTextMessageModel)
|
as ChatTextMessageModel)
|
||||||
.text
|
.text
|
||||||
: '📷 ${widget.translations.image}',
|
: '📷 '
|
||||||
|
'${translations.image}'
|
||||||
|
: '',
|
||||||
lastUsed: chat.lastUsed != null
|
lastUsed: chat.lastUsed != null
|
||||||
? _dateFormatter.format(
|
? _dateFormatter.format(
|
||||||
date: chat.lastUsed!,
|
date: chat.lastUsed!,
|
||||||
|
@ -121,14 +122,15 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||||
)
|
)
|
||||||
: ChatRow(
|
: ChatRow(
|
||||||
title: (chat as GroupChatModel).title,
|
title: (chat as GroupChatModel).title,
|
||||||
subTitle: chat.lastMessage != null &&
|
subTitle: chat.lastMessage != null
|
||||||
chat.lastMessage
|
? chat.lastMessage
|
||||||
is ChatTextMessageModel
|
is ChatTextMessageModel
|
||||||
? (chat.lastMessage!
|
? (chat.lastMessage!
|
||||||
as ChatTextMessageModel)
|
as ChatTextMessageModel)
|
||||||
.text
|
.text
|
||||||
: '📷 '
|
: '📷 '
|
||||||
'${widget.translations.image}',
|
'${translations.image}'
|
||||||
|
: '',
|
||||||
avatar:
|
avatar:
|
||||||
widget.options.groupAvatarBuilder(
|
widget.options.groupAvatarBuilder(
|
||||||
chat.imageUrl,
|
chat.imageUrl,
|
||||||
|
@ -155,7 +157,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||||
widget.options.newChatButtonBuilder(
|
widget.options.newChatButtonBuilder(
|
||||||
context,
|
context,
|
||||||
widget.onPressStartChat!,
|
widget.onPressStartChat!,
|
||||||
widget.translations,
|
translations,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
@ -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.0
|
version: 0.3.1
|
||||||
|
|
||||||
publish_to: none
|
publish_to: none
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ dependencies:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/Iconica-Development/flutter_community_chat.git
|
url: https://github.com/Iconica-Development/flutter_community_chat.git
|
||||||
path: packages/flutter_community_chat_interface
|
path: packages/flutter_community_chat_interface
|
||||||
ref: 0.3.0
|
ref: 0.3.1
|
||||||
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