mirror of
https://github.com/Iconica-Development/flutter_chat.git
synced 2025-05-18 18:33:49 +02:00
fix: linter issue
This commit is contained in:
parent
61d901c741
commit
8b4ada7edc
37 changed files with 285 additions and 285 deletions
|
@ -4,11 +4,11 @@
|
||||||
///
|
///
|
||||||
library flutter_chat;
|
library flutter_chat;
|
||||||
|
|
||||||
export 'package:flutter_chat/src/chat_entry_widget.dart';
|
export "package:flutter_chat/src/chat_entry_widget.dart";
|
||||||
export 'package:flutter_chat/src/flutter_chat_navigator_userstory.dart';
|
export "package:flutter_chat/src/flutter_chat_navigator_userstory.dart";
|
||||||
export 'package:flutter_chat/src/flutter_chat_userstory.dart';
|
export "package:flutter_chat/src/flutter_chat_userstory.dart";
|
||||||
export 'package:flutter_chat/src/models/chat_configuration.dart';
|
export "package:flutter_chat/src/models/chat_configuration.dart";
|
||||||
export 'package:flutter_chat/src/routes.dart';
|
export "package:flutter_chat/src/routes.dart";
|
||||||
export 'package:flutter_chat_interface/flutter_chat_interface.dart';
|
export "package:flutter_chat_interface/flutter_chat_interface.dart";
|
||||||
export 'package:flutter_chat_local/local_chat_service.dart';
|
export "package:flutter_chat_local/local_chat_service.dart";
|
||||||
export 'package:flutter_chat_view/flutter_chat_view.dart';
|
export "package:flutter_chat_view/flutter_chat_view.dart";
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import 'dart:async';
|
import "dart:async";
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import "package:flutter/material.dart";
|
||||||
import 'package:flutter_chat/flutter_chat.dart';
|
import "package:flutter_chat/flutter_chat.dart";
|
||||||
|
|
||||||
/// A widget representing an entry point for a chat UI.
|
/// A widget representing an entry point for a chat UI.
|
||||||
class ChatEntryWidget extends StatefulWidget {
|
class ChatEntryWidget extends StatefulWidget {
|
||||||
|
@ -104,7 +104,7 @@ class _ChatEntryWidgetState extends State<ChatEntryWidget> {
|
||||||
),
|
),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
'${snapshot.data ?? 0}',
|
"${snapshot.data ?? 0}",
|
||||||
style: widget.textStyle,
|
style: widget.textStyle,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import "package:flutter/material.dart";
|
||||||
import 'package:go_router/go_router.dart';
|
import "package:go_router/go_router.dart";
|
||||||
|
|
||||||
/// Builds a screen with a fade transition.
|
/// Builds a screen with a fade transition.
|
||||||
///
|
///
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
import 'dart:typed_data';
|
import "dart:typed_data";
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import "package:flutter/material.dart";
|
||||||
import 'package:flutter_chat_view/flutter_chat_view.dart';
|
import "package:flutter_chat_view/flutter_chat_view.dart";
|
||||||
|
|
||||||
/// `ChatUserStoryConfiguration` is a class that configures the chat user story.
|
/// `ChatUserStoryConfiguration` is a class that configures the chat user story.
|
||||||
@immutable
|
@immutable
|
||||||
|
|
|
@ -4,19 +4,19 @@
|
||||||
|
|
||||||
/// Provides route paths for the chat user story.
|
/// Provides route paths for the chat user story.
|
||||||
mixin ChatUserStoryRoutes {
|
mixin ChatUserStoryRoutes {
|
||||||
static const String chatScreen = '/chat';
|
static const String chatScreen = "/chat";
|
||||||
|
|
||||||
/// Constructs the path for the chat detail view.
|
/// Constructs the path for the chat detail view.
|
||||||
static String chatDetailViewPath(String chatId) => '/chat-detail/$chatId';
|
static String chatDetailViewPath(String chatId) => "/chat-detail/$chatId";
|
||||||
|
|
||||||
static const String chatDetailScreen = '/chat-detail/:id';
|
static const String chatDetailScreen = "/chat-detail/:id";
|
||||||
static const String newChatScreen = '/new-chat';
|
static const String newChatScreen = "/new-chat";
|
||||||
|
|
||||||
/// Constructs the path for the chat profile screen.
|
/// Constructs the path for the chat profile screen.
|
||||||
static const String newGroupChatScreen = '/new-group-chat';
|
static const String newGroupChatScreen = "/new-group-chat";
|
||||||
static const String newGroupChatOverviewScreen = '/new-group-chat-overview';
|
static const String newGroupChatOverviewScreen = "/new-group-chat-overview";
|
||||||
static String chatProfileScreenPath(String chatId, String? userId) =>
|
static String chatProfileScreenPath(String chatId, String? userId) =>
|
||||||
'/chat-profile/$chatId/$userId';
|
"/chat-profile/$chatId/$userId";
|
||||||
|
|
||||||
static const String chatProfileScreen = '/chat-profile/:id/:userId';
|
static const String chatProfileScreen = "/chat-profile/:id/:userId";
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,19 +2,19 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import "package:flutter/material.dart";
|
||||||
|
|
||||||
/// Options for Firebase chat configuration.
|
/// Options for Firebase chat configuration.
|
||||||
@immutable
|
@immutable
|
||||||
class FirebaseChatOptions {
|
class FirebaseChatOptions {
|
||||||
/// Creates a new instance of `FirebaseChatOptions`.
|
/// Creates a new instance of `FirebaseChatOptions`.
|
||||||
const FirebaseChatOptions({
|
const FirebaseChatOptions({
|
||||||
this.groupChatsCollectionName = 'group_chats',
|
this.groupChatsCollectionName = "group_chats",
|
||||||
this.chatsCollectionName = 'chats',
|
this.chatsCollectionName = "chats",
|
||||||
this.messagesCollectionName = 'messages',
|
this.messagesCollectionName = "messages",
|
||||||
this.usersCollectionName = 'users',
|
this.usersCollectionName = "users",
|
||||||
this.chatsMetaDataCollectionName = 'chat_metadata',
|
this.chatsMetaDataCollectionName = "chat_metadata",
|
||||||
this.userChatsCollectionName = 'chats',
|
this.userChatsCollectionName = "chats",
|
||||||
});
|
});
|
||||||
|
|
||||||
/// The collection name for group chats.
|
/// The collection name for group chats.
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
import "package:cloud_firestore/cloud_firestore.dart";
|
||||||
import 'package:flutter/material.dart';
|
import "package:flutter/material.dart";
|
||||||
import 'package:flutter_chat_firebase/dto/firebase_message_document.dart';
|
import "package:flutter_chat_firebase/dto/firebase_message_document.dart";
|
||||||
|
|
||||||
/// Represents a chat document in Firebase.
|
/// Represents a chat document in Firebase.
|
||||||
@immutable
|
@immutable
|
||||||
|
@ -23,16 +23,16 @@ class FirebaseChatDocument {
|
||||||
|
|
||||||
/// Constructs a FirebaseChatDocument from JSON.
|
/// Constructs a FirebaseChatDocument from JSON.
|
||||||
FirebaseChatDocument.fromJson(Map<String, dynamic> json, this.id)
|
FirebaseChatDocument.fromJson(Map<String, dynamic> json, this.id)
|
||||||
: title = json['title'],
|
: title = json["title"],
|
||||||
imageUrl = json['image_url'],
|
imageUrl = json["image_url"],
|
||||||
personal = json['personal'],
|
personal = json["personal"],
|
||||||
canBeDeleted = json['can_be_deleted'] ?? true,
|
canBeDeleted = json["can_be_deleted"] ?? true,
|
||||||
lastUsed = json['last_used'],
|
lastUsed = json["last_used"],
|
||||||
users = json['users'] != null ? List<String>.from(json['users']) : [],
|
users = json["users"] != null ? List<String>.from(json["users"]) : [],
|
||||||
lastMessage = json['last_message'] == null
|
lastMessage = json["last_message"] == null
|
||||||
? null
|
? null
|
||||||
: FirebaseMessageDocument.fromJson(
|
: FirebaseMessageDocument.fromJson(
|
||||||
json['last_message'],
|
json["last_message"],
|
||||||
null,
|
null,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -62,11 +62,11 @@ class FirebaseChatDocument {
|
||||||
|
|
||||||
/// Converts the FirebaseChatDocument to JSON format.
|
/// Converts the FirebaseChatDocument to JSON format.
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
'title': title,
|
"title": title,
|
||||||
'image_url': imageUrl,
|
"image_url": imageUrl,
|
||||||
'personal': personal,
|
"personal": personal,
|
||||||
'last_used': lastUsed,
|
"last_used": lastUsed,
|
||||||
'can_be_deleted': canBeDeleted,
|
"can_be_deleted": canBeDeleted,
|
||||||
'users': users,
|
"users": users,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
import "package:cloud_firestore/cloud_firestore.dart";
|
||||||
import 'package:flutter/material.dart';
|
import "package:flutter/material.dart";
|
||||||
|
|
||||||
/// Represents a message document in Firebase.
|
/// Represents a message document in Firebase.
|
||||||
@immutable
|
@immutable
|
||||||
|
@ -19,10 +19,10 @@ class FirebaseMessageDocument {
|
||||||
|
|
||||||
/// Constructs a FirebaseMessageDocument from JSON.
|
/// Constructs a FirebaseMessageDocument from JSON.
|
||||||
FirebaseMessageDocument.fromJson(Map<String, dynamic> json, this.id)
|
FirebaseMessageDocument.fromJson(Map<String, dynamic> json, this.id)
|
||||||
: sender = json['sender'],
|
: sender = json["sender"],
|
||||||
text = json['text'],
|
text = json["text"],
|
||||||
imageUrl = json['image_url'],
|
imageUrl = json["image_url"],
|
||||||
timestamp = json['timestamp'];
|
timestamp = json["timestamp"];
|
||||||
|
|
||||||
/// The unique identifier of the message document.
|
/// The unique identifier of the message document.
|
||||||
final String? id;
|
final String? id;
|
||||||
|
@ -41,9 +41,9 @@ class FirebaseMessageDocument {
|
||||||
|
|
||||||
/// Converts the FirebaseMessageDocument to JSON format.
|
/// Converts the FirebaseMessageDocument to JSON format.
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
'sender': sender,
|
"sender": sender,
|
||||||
'text': text,
|
"text": text,
|
||||||
'image_url': imageUrl,
|
"image_url": imageUrl,
|
||||||
'timestamp': timestamp,
|
"timestamp": timestamp,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import "package:flutter/material.dart";
|
||||||
|
|
||||||
/// Represents a user document in Firebase.
|
/// Represents a user document in Firebase.
|
||||||
@immutable
|
@immutable
|
||||||
|
@ -22,11 +22,11 @@ class FirebaseUserDocument {
|
||||||
) : this(
|
) : this(
|
||||||
id: id,
|
id: id,
|
||||||
firstName:
|
firstName:
|
||||||
json['first_name'] == null ? '' : json['first_name']! as String,
|
json["first_name"] == null ? "" : json["first_name"]! as String,
|
||||||
lastName:
|
lastName:
|
||||||
json['last_name'] == null ? '' : json['last_name']! as String,
|
json["last_name"] == null ? "" : json["last_name"]! as String,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
json['image_url'] == null ? null : json['image_url']! as String,
|
json["image_url"] == null ? null : json["image_url"]! as String,
|
||||||
);
|
);
|
||||||
|
|
||||||
/// The first name of the user.
|
/// The first name of the user.
|
||||||
|
@ -43,8 +43,8 @@ class FirebaseUserDocument {
|
||||||
|
|
||||||
/// Converts the FirebaseUserDocument to JSON format.
|
/// Converts the FirebaseUserDocument to JSON format.
|
||||||
Map<String, Object?> toJson() => {
|
Map<String, Object?> toJson() => {
|
||||||
'first_name': firstName,
|
"first_name": firstName,
|
||||||
'last_name': lastName,
|
"last_name": lastName,
|
||||||
'image_url': imageUrl,
|
"image_url": imageUrl,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,4 +4,4 @@
|
||||||
///
|
///
|
||||||
library flutter_chat_firebase;
|
library flutter_chat_firebase;
|
||||||
|
|
||||||
export 'package:flutter_chat_firebase/service/service.dart';
|
export "package:flutter_chat_firebase/service/service.dart";
|
||||||
|
|
|
@ -2,16 +2,16 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
import 'dart:async';
|
import "dart:async";
|
||||||
import 'dart:typed_data';
|
import "dart:typed_data";
|
||||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
import "package:cloud_firestore/cloud_firestore.dart";
|
||||||
import 'package:firebase_core/firebase_core.dart';
|
import "package:firebase_core/firebase_core.dart";
|
||||||
import 'package:firebase_storage/firebase_storage.dart';
|
import "package:firebase_storage/firebase_storage.dart";
|
||||||
import 'package:flutter/material.dart';
|
import "package:flutter/material.dart";
|
||||||
import 'package:flutter_chat_firebase/config/firebase_chat_options.dart';
|
import "package:flutter_chat_firebase/config/firebase_chat_options.dart";
|
||||||
import 'package:flutter_chat_firebase/dto/firebase_message_document.dart';
|
import "package:flutter_chat_firebase/dto/firebase_message_document.dart";
|
||||||
import 'package:flutter_chat_interface/flutter_chat_interface.dart';
|
import "package:flutter_chat_interface/flutter_chat_interface.dart";
|
||||||
import 'package:uuid/uuid.dart';
|
import "package:uuid/uuid.dart";
|
||||||
|
|
||||||
/// Service class for managing chat details using Firebase.
|
/// Service class for managing chat details using Firebase.
|
||||||
class FirebaseChatDetailService
|
class FirebaseChatDetailService
|
||||||
|
@ -56,8 +56,8 @@ class FirebaseChatDetailService
|
||||||
}
|
}
|
||||||
|
|
||||||
var message = {
|
var message = {
|
||||||
'sender': currentUser.id,
|
"sender": currentUser.id,
|
||||||
'timestamp': DateTime.now(),
|
"timestamp": DateTime.now(),
|
||||||
...data,
|
...data,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -89,8 +89,8 @@ class FirebaseChatDetailService
|
||||||
.doc(chatId);
|
.doc(chatId);
|
||||||
|
|
||||||
await metadataReference.update({
|
await metadataReference.update({
|
||||||
'last_used': DateTime.now(),
|
"last_used": DateTime.now(),
|
||||||
'last_message': message,
|
"last_message": message,
|
||||||
});
|
});
|
||||||
|
|
||||||
// update the chat counter for the other users
|
// update the chat counter for the other users
|
||||||
|
@ -98,7 +98,7 @@ class FirebaseChatDetailService
|
||||||
// there is a field in the chat document called users that has a
|
// there is a field in the chat document called users that has a
|
||||||
// list of user ids
|
// list of user ids
|
||||||
var fetchedChat = await metadataReference.get();
|
var fetchedChat = await metadataReference.get();
|
||||||
var chatUsers = fetchedChat.data()?['users'] as List<dynamic>;
|
var chatUsers = fetchedChat.data()?["users"] as List<dynamic>;
|
||||||
// for all users except the message sender update the unread counter
|
// for all users except the message sender update the unread counter
|
||||||
for (var userId in chatUsers) {
|
for (var userId in chatUsers) {
|
||||||
if (userId != currentUser.id) {
|
if (userId != currentUser.id) {
|
||||||
|
@ -113,15 +113,15 @@ class FirebaseChatDetailService
|
||||||
// it should be created when the chat is create
|
// it should be created when the chat is create
|
||||||
if ((await userReference.get())
|
if ((await userReference.get())
|
||||||
.data()
|
.data()
|
||||||
?.containsKey('amount_unread_messages') ??
|
?.containsKey("amount_unread_messages") ??
|
||||||
false) {
|
false) {
|
||||||
await userReference.update({
|
await userReference.update({
|
||||||
'amount_unread_messages': FieldValue.increment(1),
|
"amount_unread_messages": FieldValue.increment(1),
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
await userReference.set(
|
await userReference.set(
|
||||||
{
|
{
|
||||||
'amount_unread_messages': 1,
|
"amount_unread_messages": 1,
|
||||||
},
|
},
|
||||||
SetOptions(merge: true),
|
SetOptions(merge: true),
|
||||||
);
|
);
|
||||||
|
@ -142,7 +142,7 @@ class FirebaseChatDetailService
|
||||||
_sendMessage(
|
_sendMessage(
|
||||||
chatId,
|
chatId,
|
||||||
{
|
{
|
||||||
'text': text,
|
"text": text,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ class FirebaseChatDetailService
|
||||||
required Uint8List image,
|
required Uint8List image,
|
||||||
}) async {
|
}) async {
|
||||||
var ref = _storage
|
var ref = _storage
|
||||||
.ref('${_options.chatsCollectionName}/$chatId/${const Uuid().v4()}');
|
.ref("${_options.chatsCollectionName}/$chatId/${const Uuid().v4()}");
|
||||||
|
|
||||||
return ref.putData(image).then(
|
return ref.putData(image).then(
|
||||||
(_) => ref.getDownloadURL().then(
|
(_) => ref.getDownloadURL().then(
|
||||||
|
@ -164,7 +164,7 @@ class FirebaseChatDetailService
|
||||||
_sendMessage(
|
_sendMessage(
|
||||||
chatId,
|
chatId,
|
||||||
{
|
{
|
||||||
'image_url': url,
|
"image_url": url,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -186,7 +186,7 @@ class FirebaseChatDetailService
|
||||||
.doc(chatId)
|
.doc(chatId)
|
||||||
.collection(_options.messagesCollectionName)
|
.collection(_options.messagesCollectionName)
|
||||||
.where(
|
.where(
|
||||||
'timestamp',
|
"timestamp",
|
||||||
isGreaterThan: timestampToFilter,
|
isGreaterThan: timestampToFilter,
|
||||||
)
|
)
|
||||||
.withConverter<FirebaseMessageDocument>(
|
.withConverter<FirebaseMessageDocument>(
|
||||||
|
@ -241,7 +241,7 @@ class FirebaseChatDetailService
|
||||||
_cumulativeMessages = [];
|
_cumulativeMessages = [];
|
||||||
lastChat = chatId;
|
lastChat = chatId;
|
||||||
lastMessage = null;
|
lastMessage = null;
|
||||||
debugPrint('Canceling messages stream');
|
debugPrint("Canceling messages stream");
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ class FirebaseChatDetailService
|
||||||
.collection(_options.chatsCollectionName)
|
.collection(_options.chatsCollectionName)
|
||||||
.doc(chatId)
|
.doc(chatId)
|
||||||
.collection(_options.messagesCollectionName)
|
.collection(_options.messagesCollectionName)
|
||||||
.orderBy('timestamp', descending: true)
|
.orderBy("timestamp", descending: true)
|
||||||
.limit(pageSize);
|
.limit(pageSize);
|
||||||
if (lastMessage == null) {
|
if (lastMessage == null) {
|
||||||
messagesQuerySnapshot = await query
|
messagesQuerySnapshot = await query
|
||||||
|
|
|
@ -3,14 +3,14 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
import 'dart:async';
|
import "dart:async";
|
||||||
|
|
||||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
import "package:cloud_firestore/cloud_firestore.dart";
|
||||||
import 'package:firebase_core/firebase_core.dart';
|
import "package:firebase_core/firebase_core.dart";
|
||||||
import 'package:firebase_storage/firebase_storage.dart';
|
import "package:firebase_storage/firebase_storage.dart";
|
||||||
import 'package:flutter_chat_firebase/config/firebase_chat_options.dart';
|
import "package:flutter_chat_firebase/config/firebase_chat_options.dart";
|
||||||
import 'package:flutter_chat_firebase/dto/firebase_chat_document.dart';
|
import "package:flutter_chat_firebase/dto/firebase_chat_document.dart";
|
||||||
import 'package:flutter_chat_interface/flutter_chat_interface.dart';
|
import "package:flutter_chat_interface/flutter_chat_interface.dart";
|
||||||
|
|
||||||
/// Service class for managing chat overviews using Firebase.
|
/// Service class for managing chat overviews using Firebase.
|
||||||
class FirebaseChatOverviewService implements ChatOverviewService {
|
class FirebaseChatOverviewService implements ChatOverviewService {
|
||||||
|
@ -49,7 +49,7 @@ class FirebaseChatOverviewService implements ChatOverviewService {
|
||||||
.doc(chatId)
|
.doc(chatId)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
return snapshots.data()?['amount_unread_messages'];
|
return snapshots.data()?["amount_unread_messages"];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieves a stream of chat overviews.
|
/// Retrieves a stream of chat overviews.
|
||||||
|
@ -144,8 +144,8 @@ class FirebaseChatOverviewService implements ChatOverviewService {
|
||||||
}
|
}
|
||||||
chatModel = GroupChatModel(
|
chatModel = GroupChatModel(
|
||||||
id: chat.id,
|
id: chat.id,
|
||||||
title: chat.title ?? '',
|
title: chat.title ?? "",
|
||||||
imageUrl: chat.imageUrl ?? '',
|
imageUrl: chat.imageUrl ?? "",
|
||||||
unreadMessages: unread,
|
unreadMessages: unread,
|
||||||
users: users,
|
users: users,
|
||||||
lastMessage: chat.lastMessage != null && otherUser != null
|
lastMessage: chat.lastMessage != null && otherUser != null
|
||||||
|
@ -226,7 +226,7 @@ class FirebaseChatOverviewService implements ChatOverviewService {
|
||||||
.collection(_options.usersCollectionName)
|
.collection(_options.usersCollectionName)
|
||||||
.doc(currentUser?.id)
|
.doc(currentUser?.id)
|
||||||
.collection(_options.userChatsCollectionName)
|
.collection(_options.userChatsCollectionName)
|
||||||
.where('users', arrayContains: user.id)
|
.where("users", arrayContains: user.id)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
var doc = collection.docs.isNotEmpty ? collection.docs.first : null;
|
var doc = collection.docs.isNotEmpty ? collection.docs.first : null;
|
||||||
|
@ -250,16 +250,16 @@ class FirebaseChatOverviewService implements ChatOverviewService {
|
||||||
.doc(chatId)
|
.doc(chatId)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
if (chatCollection.exists && chatCollection.data()?['users'] != null) {
|
if (chatCollection.exists && chatCollection.data()?["users"] != null) {
|
||||||
// ignore: avoid_dynamic_calls
|
// ignore: avoid_dynamic_calls
|
||||||
var otherUser = chatCollection.data()?['users'].firstWhere(
|
var otherUser = chatCollection.data()?["users"].firstWhere(
|
||||||
(element) => element != currentUser?.id,
|
(element) => element != currentUser?.id,
|
||||||
);
|
);
|
||||||
var user = await _userService.getUser(otherUser);
|
var user = await _userService.getUser(otherUser);
|
||||||
return PersonalChatModel(
|
return PersonalChatModel(
|
||||||
id: chatId,
|
id: chatId,
|
||||||
user: user!,
|
user: user!,
|
||||||
canBeDeleted: chatCollection.data()?['can_be_deleted'] ?? true,
|
canBeDeleted: chatCollection.data()?["can_be_deleted"] ?? true,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
var groupChatCollection = await _db
|
var groupChatCollection = await _db
|
||||||
|
@ -281,8 +281,8 @@ class FirebaseChatOverviewService implements ChatOverviewService {
|
||||||
}
|
}
|
||||||
return GroupChatModel(
|
return GroupChatModel(
|
||||||
id: chat?.id ?? chatId,
|
id: chat?.id ?? chatId,
|
||||||
title: chat?.title ?? '',
|
title: chat?.title ?? "",
|
||||||
imageUrl: chat?.imageUrl ?? '',
|
imageUrl: chat?.imageUrl ?? "",
|
||||||
users: users,
|
users: users,
|
||||||
canBeDeleted: chat?.canBeDeleted ?? true,
|
canBeDeleted: chat?.canBeDeleted ?? true,
|
||||||
);
|
);
|
||||||
|
@ -373,7 +373,7 @@ class FirebaseChatOverviewService implements ChatOverviewService {
|
||||||
.doc(userId)
|
.doc(userId)
|
||||||
.collection(_options.userChatsCollectionName)
|
.collection(_options.userChatsCollectionName)
|
||||||
.doc(reference.id)
|
.doc(reference.id)
|
||||||
.set({'users': userIds}, SetOptions(merge: true));
|
.set({"users": userIds}, SetOptions(merge: true));
|
||||||
}
|
}
|
||||||
|
|
||||||
chat.id = reference.id;
|
chat.id = reference.id;
|
||||||
|
@ -411,11 +411,11 @@ class FirebaseChatOverviewService implements ChatOverviewService {
|
||||||
.doc(userId)
|
.doc(userId)
|
||||||
.collection(_options.groupChatsCollectionName)
|
.collection(_options.groupChatsCollectionName)
|
||||||
.doc(reference.id)
|
.doc(reference.id)
|
||||||
.set({'users': userIds}, SetOptions(merge: true));
|
.set({"users": userIds}, SetOptions(merge: true));
|
||||||
}
|
}
|
||||||
chat.id = reference.id;
|
chat.id = reference.id;
|
||||||
} else {
|
} else {
|
||||||
throw Exception('Chat type not supported for firebase');
|
throw Exception("Chat type not supported for firebase");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -443,7 +443,7 @@ class FirebaseChatOverviewService implements ChatOverviewService {
|
||||||
// every chat has a field called amount_unread_messages, combine all
|
// every chat has a field called amount_unread_messages, combine all
|
||||||
// of these fields to get the total amount of unread messages
|
// of these fields to get the total amount of unread messages
|
||||||
var unreadChats = event.docs
|
var unreadChats = event.docs
|
||||||
.map((chat) => chat.data()['amount_unread_messages'] ?? 0)
|
.map((chat) => chat.data()["amount_unread_messages"] ?? 0)
|
||||||
.toList();
|
.toList();
|
||||||
var totalUnreadChats = unreadChats.fold<int>(
|
var totalUnreadChats = unreadChats.fold<int>(
|
||||||
0,
|
0,
|
||||||
|
@ -476,6 +476,6 @@ class FirebaseChatOverviewService implements ChatOverviewService {
|
||||||
.doc(currentUser!.id)
|
.doc(currentUser!.id)
|
||||||
.collection(_options.userChatsCollectionName)
|
.collection(_options.userChatsCollectionName)
|
||||||
.doc(chat.id)
|
.doc(chat.id)
|
||||||
.set({'amount_unread_messages': 0}, SetOptions(merge: true));
|
.set({"amount_unread_messages": 0}, SetOptions(merge: true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import 'package:firebase_core/firebase_core.dart';
|
import "package:firebase_core/firebase_core.dart";
|
||||||
import 'package:flutter_chat_firebase/config/firebase_chat_options.dart';
|
import "package:flutter_chat_firebase/config/firebase_chat_options.dart";
|
||||||
import 'package:flutter_chat_firebase/flutter_chat_firebase.dart';
|
import "package:flutter_chat_firebase/flutter_chat_firebase.dart";
|
||||||
import 'package:flutter_chat_interface/flutter_chat_interface.dart';
|
import "package:flutter_chat_interface/flutter_chat_interface.dart";
|
||||||
|
|
||||||
/// Service class for managing chat services using Firebase.
|
/// Service class for managing chat services using Firebase.
|
||||||
class FirebaseChatService implements ChatService {
|
class FirebaseChatService implements ChatService {
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
import "package:cloud_firestore/cloud_firestore.dart";
|
||||||
import 'package:firebase_auth/firebase_auth.dart';
|
import "package:firebase_auth/firebase_auth.dart";
|
||||||
import 'package:firebase_core/firebase_core.dart';
|
import "package:firebase_core/firebase_core.dart";
|
||||||
import 'package:flutter_chat_firebase/config/firebase_chat_options.dart';
|
import "package:flutter_chat_firebase/config/firebase_chat_options.dart";
|
||||||
import 'package:flutter_chat_firebase/dto/firebase_user_document.dart';
|
import "package:flutter_chat_firebase/dto/firebase_user_document.dart";
|
||||||
import 'package:flutter_chat_interface/flutter_chat_interface.dart';
|
import "package:flutter_chat_interface/flutter_chat_interface.dart";
|
||||||
|
|
||||||
/// Service class for managing chat users using Firebase.
|
/// Service class for managing chat users using Firebase.
|
||||||
class FirebaseChatUserService implements ChatUserService {
|
class FirebaseChatUserService implements ChatUserService {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export 'package:flutter_chat_firebase/service/firebase_chat_detail_service.dart';
|
export "package:flutter_chat_firebase/service/firebase_chat_detail_service.dart";
|
||||||
export 'package:flutter_chat_firebase/service/firebase_chat_overview_service.dart';
|
export "package:flutter_chat_firebase/service/firebase_chat_overview_service.dart";
|
||||||
export 'package:flutter_chat_firebase/service/firebase_chat_service.dart';
|
export "package:flutter_chat_firebase/service/firebase_chat_service.dart";
|
||||||
export 'package:flutter_chat_firebase/service/firebase_chat_user_service.dart';
|
export "package:flutter_chat_firebase/service/firebase_chat_user_service.dart";
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
///
|
///
|
||||||
library local_chat_service;
|
library local_chat_service;
|
||||||
|
|
||||||
export 'service/local_chat_detail_service.dart';
|
export "service/local_chat_detail_service.dart";
|
||||||
export 'service/local_chat_overview_service.dart';
|
export "service/local_chat_overview_service.dart";
|
||||||
export 'service/local_chat_service.dart';
|
export "service/local_chat_service.dart";
|
||||||
export 'service/local_chat_user_service.dart';
|
export "service/local_chat_user_service.dart";
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import 'dart:async';
|
import "dart:async";
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
import "package:flutter/foundation.dart";
|
||||||
import 'package:flutter_chat_interface/flutter_chat_interface.dart';
|
import "package:flutter_chat_interface/flutter_chat_interface.dart";
|
||||||
import 'package:flutter_chat_local/local_chat_service.dart';
|
import "package:flutter_chat_local/local_chat_service.dart";
|
||||||
|
|
||||||
/// A class providing local chat detail service implementation.
|
/// A class providing local chat detail service implementation.
|
||||||
class LocalChatDetailService with ChangeNotifier implements ChatDetailService {
|
class LocalChatDetailService with ChangeNotifier implements ChatDetailService {
|
||||||
|
@ -69,13 +69,13 @@ class LocalChatDetailService with ChangeNotifier implements ChatDetailService {
|
||||||
.firstWhere((element) => element.id == chatId);
|
.firstWhere((element) => element.id == chatId);
|
||||||
var message = ChatImageMessageModel(
|
var message = ChatImageMessageModel(
|
||||||
sender: const ChatUserModel(
|
sender: const ChatUserModel(
|
||||||
id: '3',
|
id: "3",
|
||||||
firstName: 'ico',
|
firstName: "ico",
|
||||||
lastName: 'nica',
|
lastName: "nica",
|
||||||
imageUrl: 'https://picsum.photos/100/200',
|
imageUrl: "https://picsum.photos/100/200",
|
||||||
),
|
),
|
||||||
timestamp: DateTime.now(),
|
timestamp: DateTime.now(),
|
||||||
imageUrl: 'https://picsum.photos/200/300',
|
imageUrl: "https://picsum.photos/200/300",
|
||||||
);
|
);
|
||||||
|
|
||||||
await (chatOverviewService as LocalChatOverviewService).updateChat(
|
await (chatOverviewService as LocalChatOverviewService).updateChat(
|
||||||
|
@ -102,10 +102,10 @@ class LocalChatDetailService with ChangeNotifier implements ChatDetailService {
|
||||||
.firstWhere((element) => element.id == chatId);
|
.firstWhere((element) => element.id == chatId);
|
||||||
var message = ChatTextMessageModel(
|
var message = ChatTextMessageModel(
|
||||||
sender: const ChatUserModel(
|
sender: const ChatUserModel(
|
||||||
id: '3',
|
id: "3",
|
||||||
firstName: 'ico',
|
firstName: "ico",
|
||||||
lastName: 'nica',
|
lastName: "nica",
|
||||||
imageUrl: 'https://picsum.photos/100/200',
|
imageUrl: "https://picsum.photos/100/200",
|
||||||
),
|
),
|
||||||
timestamp: DateTime.now(),
|
timestamp: DateTime.now(),
|
||||||
text: text,
|
text: text,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import 'dart:async';
|
import "dart:async";
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
import "package:flutter/foundation.dart";
|
||||||
import 'package:flutter_chat_interface/flutter_chat_interface.dart';
|
import "package:flutter_chat_interface/flutter_chat_interface.dart";
|
||||||
|
|
||||||
/// A class providing local chat overview service implementation.
|
/// A class providing local chat overview service implementation.
|
||||||
class LocalChatOverviewService
|
class LocalChatOverviewService
|
||||||
|
@ -22,7 +22,7 @@ class LocalChatOverviewService
|
||||||
_chats[index] = chat;
|
_chats[index] = chat;
|
||||||
_chatsController.addStream(Stream.value(_chats));
|
_chatsController.addStream(Stream.value(_chats));
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
debugPrint('Chat updated: $chat');
|
debugPrint("Chat updated: $chat");
|
||||||
return Future.value();
|
return Future.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,15 +31,15 @@ class LocalChatOverviewService
|
||||||
_chats.removeWhere((element) => element.id == chat.id);
|
_chats.removeWhere((element) => element.id == chat.id);
|
||||||
_chatsController.add(_chats);
|
_chatsController.add(_chats);
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
debugPrint('Chat deleted: $chat');
|
debugPrint("Chat deleted: $chat");
|
||||||
return Future.value();
|
return Future.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<ChatModel> getChatById(String id) {
|
Future<ChatModel> getChatById(String id) {
|
||||||
var chat = _chats.firstWhere((element) => element.id == id);
|
var chat = _chats.firstWhere((element) => element.id == id);
|
||||||
debugPrint('Retrieved chat by ID: $chat');
|
debugPrint("Retrieved chat by ID: $chat");
|
||||||
debugPrint('Messages are: ${chat.messages?.length}');
|
debugPrint("Messages are: ${chat.messages?.length}");
|
||||||
return Future.value(chat);
|
return Future.value(chat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,11 +55,11 @@ class LocalChatOverviewService
|
||||||
chat = PersonalChatModel(
|
chat = PersonalChatModel(
|
||||||
user: user,
|
user: user,
|
||||||
messages: [],
|
messages: [],
|
||||||
id: '',
|
id: "",
|
||||||
);
|
);
|
||||||
chat.id = chat.hashCode.toString();
|
chat.id = chat.hashCode.toString();
|
||||||
_chats.add(chat);
|
_chats.add(chat);
|
||||||
debugPrint('New chat created: $chat');
|
debugPrint("New chat created: $chat");
|
||||||
}
|
}
|
||||||
|
|
||||||
_chatsController.add([..._chats]);
|
_chatsController.add([..._chats]);
|
||||||
|
@ -85,9 +85,9 @@ class LocalChatOverviewService
|
||||||
_chats.add(chat);
|
_chats.add(chat);
|
||||||
_chatsController.add([..._chats]);
|
_chatsController.add([..._chats]);
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
debugPrint('Chat stored: $chat');
|
debugPrint("Chat stored: $chat");
|
||||||
} else {
|
} else {
|
||||||
debugPrint('Chat already exists: $chat');
|
debugPrint("Chat already exists: $chat");
|
||||||
}
|
}
|
||||||
|
|
||||||
return Future.value(chat);
|
return Future.value(chat);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import 'package:flutter_chat_interface/flutter_chat_interface.dart';
|
import "package:flutter_chat_interface/flutter_chat_interface.dart";
|
||||||
import 'package:flutter_chat_local/service/local_chat_detail_service.dart';
|
import "package:flutter_chat_local/service/local_chat_detail_service.dart";
|
||||||
import 'package:flutter_chat_local/service/local_chat_overview_service.dart';
|
import "package:flutter_chat_local/service/local_chat_overview_service.dart";
|
||||||
import 'package:flutter_chat_local/service/local_chat_user_service.dart';
|
import "package:flutter_chat_local/service/local_chat_user_service.dart";
|
||||||
|
|
||||||
/// Service class for managing local chat services.
|
/// Service class for managing local chat services.
|
||||||
class LocalChatService implements ChatService {
|
class LocalChatService implements ChatService {
|
||||||
|
|
|
@ -1,32 +1,32 @@
|
||||||
import 'package:flutter_chat_interface/flutter_chat_interface.dart';
|
import "package:flutter_chat_interface/flutter_chat_interface.dart";
|
||||||
|
|
||||||
/// Service class for managing local chat users.
|
/// Service class for managing local chat users.
|
||||||
class LocalChatUserService implements ChatUserService {
|
class LocalChatUserService implements ChatUserService {
|
||||||
/// List of predefined chat users.
|
/// List of predefined chat users.
|
||||||
List<ChatUserModel> users = [
|
List<ChatUserModel> users = [
|
||||||
const ChatUserModel(
|
const ChatUserModel(
|
||||||
id: '1',
|
id: "1",
|
||||||
firstName: 'John',
|
firstName: "John",
|
||||||
lastName: 'Doe',
|
lastName: "Doe",
|
||||||
imageUrl: 'https://picsum.photos/200/300',
|
imageUrl: "https://picsum.photos/200/300",
|
||||||
),
|
),
|
||||||
const ChatUserModel(
|
const ChatUserModel(
|
||||||
id: '2',
|
id: "2",
|
||||||
firstName: 'Jane',
|
firstName: "Jane",
|
||||||
lastName: 'Doe',
|
lastName: "Doe",
|
||||||
imageUrl: 'https://picsum.photos/200/300',
|
imageUrl: "https://picsum.photos/200/300",
|
||||||
),
|
),
|
||||||
const ChatUserModel(
|
const ChatUserModel(
|
||||||
id: '3',
|
id: "3",
|
||||||
firstName: 'ico',
|
firstName: "ico",
|
||||||
lastName: 'nica',
|
lastName: "nica",
|
||||||
imageUrl: 'https://picsum.photos/100/200',
|
imageUrl: "https://picsum.photos/100/200",
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<List<ChatUserModel>> getAllUsers() =>
|
Future<List<ChatUserModel>> getAllUsers() =>
|
||||||
Future.value(users.where((element) => element.id != '3').toList());
|
Future.value(users.where((element) => element.id != "3").toList());
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<ChatUserModel?> getCurrentUser() =>
|
Future<ChatUserModel?> getCurrentUser() =>
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
///
|
///
|
||||||
library flutter_chat_view;
|
library flutter_chat_view;
|
||||||
|
|
||||||
export 'package:flutter_chat_interface/flutter_chat_interface.dart';
|
export "package:flutter_chat_interface/flutter_chat_interface.dart";
|
||||||
|
|
||||||
export 'src/components/chat_row.dart';
|
export "src/components/chat_row.dart";
|
||||||
export 'src/config/chat_options.dart';
|
export "src/config/chat_options.dart";
|
||||||
export 'src/config/chat_translations.dart';
|
export "src/config/chat_translations.dart";
|
||||||
export 'src/screens/chat_detail_screen.dart';
|
export "src/screens/chat_detail_screen.dart";
|
||||||
export 'src/screens/chat_profile_screen.dart';
|
export "src/screens/chat_profile_screen.dart";
|
||||||
export 'src/screens/chat_screen.dart';
|
export "src/screens/chat_screen.dart";
|
||||||
export 'src/screens/new_chat_screen.dart';
|
export "src/screens/new_chat_screen.dart";
|
||||||
export 'src/screens/new_group_chat_overview_screen.dart';
|
export "src/screens/new_group_chat_overview_screen.dart";
|
||||||
export 'src/screens/new_group_chat_screen.dart';
|
export "src/screens/new_group_chat_screen.dart";
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
//
|
//
|
||||||
// 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_chat_view/flutter_chat_view.dart';
|
import "package:flutter_chat_view/flutter_chat_view.dart";
|
||||||
|
|
||||||
class ChatBottom extends StatefulWidget {
|
class ChatBottom extends StatefulWidget {
|
||||||
const ChatBottom({
|
const ChatBottom({
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
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_chat_view/flutter_chat_view.dart';
|
import "package:flutter_chat_view/flutter_chat_view.dart";
|
||||||
import 'package:flutter_chat_view/src/components/chat_image.dart';
|
import "package:flutter_chat_view/src/components/chat_image.dart";
|
||||||
import 'package:flutter_chat_view/src/services/date_formatter.dart';
|
import "package:flutter_chat_view/src/services/date_formatter.dart";
|
||||||
|
|
||||||
class ChatDetailRow extends StatefulWidget {
|
class ChatDetailRow extends StatefulWidget {
|
||||||
const ChatDetailRow({
|
const ChatDetailRow({
|
||||||
|
@ -98,7 +98,7 @@ class _ChatDetailRowState extends State<ChatDetailRow> {
|
||||||
children: [
|
children: [
|
||||||
if (widget.usernameBuilder != null)
|
if (widget.usernameBuilder != null)
|
||||||
widget.usernameBuilder!(
|
widget.usernameBuilder!(
|
||||||
widget.message.sender.fullName ?? '',
|
widget.message.sender.fullName ?? "",
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
Text(
|
Text(
|
||||||
|
@ -158,7 +158,7 @@ class _ChatDetailRowState extends State<ChatDetailRow> {
|
||||||
date: widget.message.timestamp,
|
date: widget.message.timestamp,
|
||||||
showFullDate: true,
|
showFullDate: true,
|
||||||
)
|
)
|
||||||
.split(' ')
|
.split(" ")
|
||||||
.last,
|
.last,
|
||||||
style: theme.textTheme.bodySmall,
|
style: theme.textTheme.bodySmall,
|
||||||
textAlign: TextAlign.end,
|
textAlign: TextAlign.end,
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
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";
|
||||||
|
|
||||||
/// A stateless widget representing an image in the chat.
|
/// A stateless widget representing an image in the chat.
|
||||||
class ChatImage extends StatelessWidget {
|
class ChatImage extends StatelessWidget {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import "package:flutter/material.dart";
|
||||||
|
|
||||||
class ChatRow extends StatelessWidget {
|
class ChatRow extends StatelessWidget {
|
||||||
const ChatRow({
|
const ChatRow({
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import 'package:flutter/material.dart';
|
import "package:flutter/material.dart";
|
||||||
import 'package:flutter_chat_view/flutter_chat_view.dart';
|
import "package:flutter_chat_view/flutter_chat_view.dart";
|
||||||
|
|
||||||
SnackBar getImageLoadingSnackbar(ChatTranslations translations) => SnackBar(
|
SnackBar getImageLoadingSnackbar(ChatTranslations translations) => SnackBar(
|
||||||
duration: const Duration(minutes: 1),
|
duration: const Duration(minutes: 1),
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
//
|
//
|
||||||
// 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_chat_view/flutter_chat_view.dart';
|
import "package:flutter_chat_view/flutter_chat_view.dart";
|
||||||
import 'package:flutter_chat_view/src/components/chat_image.dart';
|
import "package:flutter_chat_view/src/components/chat_image.dart";
|
||||||
import 'package:flutter_image_picker/flutter_image_picker.dart';
|
import "package:flutter_image_picker/flutter_image_picker.dart";
|
||||||
import 'package:flutter_profile/flutter_profile.dart';
|
import "package:flutter_profile/flutter_profile.dart";
|
||||||
|
|
||||||
class ChatOptions {
|
class ChatOptions {
|
||||||
const ChatOptions({
|
const ChatOptions({
|
||||||
|
@ -133,7 +133,7 @@ Widget _createChatRowContainer(
|
||||||
vertical: 12.0,
|
vertical: 12.0,
|
||||||
horizontal: 10.0,
|
horizontal: 10.0,
|
||||||
),
|
),
|
||||||
child: Container(
|
child: ColoredBox(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
child: chatRow,
|
child: chatRow,
|
||||||
),
|
),
|
||||||
|
|
|
@ -44,39 +44,39 @@ class ChatTranslations {
|
||||||
|
|
||||||
/// Default translations for the chat component view
|
/// Default translations for the chat component view
|
||||||
const ChatTranslations.empty({
|
const ChatTranslations.empty({
|
||||||
this.chatsTitle = 'Chats',
|
this.chatsTitle = "Chats",
|
||||||
this.chatsUnread = 'unread',
|
this.chatsUnread = "unread",
|
||||||
this.newChatButton = 'Start chat',
|
this.newChatButton = "Start chat",
|
||||||
this.newGroupChatButton = 'Create a group chat',
|
this.newGroupChatButton = "Create a group chat",
|
||||||
this.newChatTitle = 'Start a chat',
|
this.newChatTitle = "Start a chat",
|
||||||
this.image = 'Image',
|
this.image = "Image",
|
||||||
this.searchPlaceholder = 'Search...',
|
this.searchPlaceholder = "Search...",
|
||||||
this.startTyping = 'Start typing to find a user to chat with',
|
this.startTyping = "Start typing to find a user to chat with",
|
||||||
this.cancelImagePickerBtn = 'Cancel',
|
this.cancelImagePickerBtn = "Cancel",
|
||||||
this.messagePlaceholder = 'Write your message here...',
|
this.messagePlaceholder = "Write your message here...",
|
||||||
this.writeMessageToStartChat = 'Write a message to start the chat',
|
this.writeMessageToStartChat = "Write a message to start the chat",
|
||||||
this.writeFirstMessageInGroupChat =
|
this.writeFirstMessageInGroupChat =
|
||||||
'Write the first message in this group chat',
|
"Write the first message in this group chat",
|
||||||
this.imageUploading = 'Image is uploading...',
|
this.imageUploading = "Image is uploading...",
|
||||||
this.deleteChatButton = 'Delete',
|
this.deleteChatButton = "Delete",
|
||||||
this.deleteChatModalTitle = 'Delete chat',
|
this.deleteChatModalTitle = "Delete chat",
|
||||||
this.deleteChatModalDescription =
|
this.deleteChatModalDescription =
|
||||||
'Are you sure you want to delete this chat?',
|
"Are you sure you want to delete this chat?",
|
||||||
this.deleteChatModalCancel = 'Cancel',
|
this.deleteChatModalCancel = "Cancel",
|
||||||
this.deleteChatModalConfirm = 'Delete',
|
this.deleteChatModalConfirm = "Delete",
|
||||||
this.noUsersFound = 'No users were found to start a chat with',
|
this.noUsersFound = "No users were found to start a chat with",
|
||||||
this.noChatsFound = 'Click on \'Start a chat\' to create a new chat',
|
this.noChatsFound = "Click on 'Start a chat' to create a new chat",
|
||||||
this.anonymousUser = 'Anonymous user',
|
this.anonymousUser = "Anonymous user",
|
||||||
this.chatCantBeDeleted = 'This chat can\'t be deleted',
|
this.chatCantBeDeleted = "This chat can't be deleted",
|
||||||
this.chatProfileUsers = 'Users:',
|
this.chatProfileUsers = "Users:",
|
||||||
this.imagePickerTitle = 'Do you want to upload a file or take a picture?',
|
this.imagePickerTitle = "Do you want to upload a file or take a picture?",
|
||||||
this.uploadFile = 'UPLOAD FILE',
|
this.uploadFile = "UPLOAD FILE",
|
||||||
this.takePicture = 'TAKE PICTURE',
|
this.takePicture = "TAKE PICTURE",
|
||||||
this.groupNameHintText = 'Group chat name',
|
this.groupNameHintText = "Group chat name",
|
||||||
this.groupNameValidatorEmpty = 'Please enter a group chat name',
|
this.groupNameValidatorEmpty = "Please enter a group chat name",
|
||||||
this.groupNameValidatorTooLong =
|
this.groupNameValidatorTooLong =
|
||||||
'Group name is too long, max 15 characters',
|
"Group name is too long, max 15 characters",
|
||||||
this.newGroupChatTitle = 'New Group Chat',
|
this.newGroupChatTitle = "New Group Chat",
|
||||||
});
|
});
|
||||||
|
|
||||||
final String chatsTitle;
|
final String chatsTitle;
|
||||||
|
|
|
@ -2,14 +2,14 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
import 'dart:async';
|
import "dart:async";
|
||||||
import 'dart:typed_data';
|
import "dart:typed_data";
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import "package:flutter/material.dart";
|
||||||
import 'package:flutter_chat_view/flutter_chat_view.dart';
|
import "package:flutter_chat_view/flutter_chat_view.dart";
|
||||||
import 'package:flutter_chat_view/src/components/chat_bottom.dart';
|
import "package:flutter_chat_view/src/components/chat_bottom.dart";
|
||||||
import 'package:flutter_chat_view/src/components/chat_detail_row.dart';
|
import "package:flutter_chat_view/src/components/chat_detail_row.dart";
|
||||||
import 'package:flutter_chat_view/src/components/image_loading_snackbar.dart';
|
import "package:flutter_chat_view/src/components/image_loading_snackbar.dart";
|
||||||
|
|
||||||
class ChatDetailScreen extends StatefulWidget {
|
class ChatDetailScreen extends StatefulWidget {
|
||||||
const ChatDetailScreen({
|
const ChatDetailScreen({
|
||||||
|
@ -200,7 +200,7 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
|
||||||
: (chatModel is PersonalChatModel)
|
: (chatModel is PersonalChatModel)
|
||||||
? chatModel.user.firstName ??
|
? chatModel.user.firstName ??
|
||||||
widget.translations.anonymousUser
|
widget.translations.anonymousUser
|
||||||
: '',
|
: "",
|
||||||
)
|
)
|
||||||
: Text(
|
: Text(
|
||||||
(chatModel is GroupChatModel)
|
(chatModel is GroupChatModel)
|
||||||
|
@ -208,7 +208,7 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
|
||||||
: (chatModel is PersonalChatModel)
|
: (chatModel is PersonalChatModel)
|
||||||
? chatModel.user.firstName ??
|
? chatModel.user.firstName ??
|
||||||
widget.translations.anonymousUser
|
widget.translations.anonymousUser
|
||||||
: '',
|
: "",
|
||||||
style: theme.appBarTheme.titleTextStyle,
|
style: theme.appBarTheme.titleTextStyle,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -251,7 +251,7 @@ class _ChatDetailScreenState extends State<ChatDetailScreen> {
|
||||||
reverse: detailRows.isNotEmpty,
|
reverse: detailRows.isNotEmpty,
|
||||||
padding: const EdgeInsets.only(top: 24.0),
|
padding: const EdgeInsets.only(top: 24.0),
|
||||||
children: [
|
children: [
|
||||||
if (detailRows.isEmpty)
|
if (detailRows.isEmpty && !showIndicator)
|
||||||
Center(
|
Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
(chatModel is GroupChatModel)
|
(chatModel is GroupChatModel)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import 'package:flutter/material.dart';
|
import "package:flutter/material.dart";
|
||||||
import 'package:flutter_chat_view/flutter_chat_view.dart';
|
import "package:flutter_chat_view/flutter_chat_view.dart";
|
||||||
import 'package:flutter_profile/flutter_profile.dart';
|
import "package:flutter_profile/flutter_profile.dart";
|
||||||
|
|
||||||
class ChatProfileScreen extends StatefulWidget {
|
class ChatProfileScreen extends StatefulWidget {
|
||||||
const ChatProfileScreen({
|
const ChatProfileScreen({
|
||||||
|
@ -75,10 +75,10 @@ class _ProfileScreenState extends State<ChatProfileScreen> {
|
||||||
(data is ChatUserModel)
|
(data is ChatUserModel)
|
||||||
? '${data.firstName ?? ''} ${data.lastName ?? ''}'
|
? '${data.firstName ?? ''} ${data.lastName ?? ''}'
|
||||||
: (data is PersonalChatModel)
|
: (data is PersonalChatModel)
|
||||||
? data.user.fullName ?? ''
|
? data.user.fullName ?? ""
|
||||||
: (data is GroupChatModel)
|
: (data is GroupChatModel)
|
||||||
? data.title
|
? data.title
|
||||||
: '',
|
: "",
|
||||||
style: theme.appBarTheme.titleTextStyle,
|
style: theme.appBarTheme.titleTextStyle,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -111,8 +111,8 @@ class _ProfileScreenState extends State<ChatProfileScreen> {
|
||||||
),
|
),
|
||||||
...data.users.map((e) {
|
...data.users.map((e) {
|
||||||
var user = User(
|
var user = User(
|
||||||
firstName: e.firstName ?? '',
|
firstName: e.firstName ?? "",
|
||||||
lastName: e.lastName ?? '',
|
lastName: e.lastName ?? "",
|
||||||
imageUrl: e.imageUrl,
|
imageUrl: e.imageUrl,
|
||||||
);
|
);
|
||||||
return Padding(
|
return Padding(
|
||||||
|
|
|
@ -4,11 +4,11 @@
|
||||||
|
|
||||||
// ignore_for_file: lines_longer_than_80_chars
|
// ignore_for_file: lines_longer_than_80_chars
|
||||||
|
|
||||||
import 'dart:async';
|
import "dart:async";
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import "package:flutter/material.dart";
|
||||||
import 'package:flutter_chat_view/flutter_chat_view.dart';
|
import "package:flutter_chat_view/flutter_chat_view.dart";
|
||||||
import 'package:flutter_chat_view/src/services/date_formatter.dart';
|
import "package:flutter_chat_view/src/services/date_formatter.dart";
|
||||||
|
|
||||||
class ChatScreen extends StatefulWidget {
|
class ChatScreen extends StatefulWidget {
|
||||||
const ChatScreen({
|
const ChatScreen({
|
||||||
|
@ -94,7 +94,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(right: 22.0),
|
padding: const EdgeInsets.only(right: 22.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
'${snapshot.data ?? 0} ${translations.chatsUnread}',
|
"${snapshot.data ?? 0} ${translations.chatsUnread}",
|
||||||
style: widget.unreadMessageTextStyle ??
|
style: widget.unreadMessageTextStyle ??
|
||||||
const TextStyle(
|
const TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
|
@ -143,7 +143,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||||
for (ChatModel chat in (snapshot.data ?? []).where(
|
for (ChatModel chat in (snapshot.data ?? []).where(
|
||||||
(chat) => !deletedChats.contains(chat.id),
|
(chat) => !deletedChats.contains(chat.id),
|
||||||
)) ...[
|
)) ...[
|
||||||
Container(
|
DecoratedBox(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border(
|
border: Border(
|
||||||
bottom: BorderSide(
|
bottom: BorderSide(
|
||||||
|
@ -269,7 +269,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||||
});
|
});
|
||||||
widget.onDeleteChat(chat);
|
widget.onDeleteChat(chat);
|
||||||
},
|
},
|
||||||
background: Container(
|
background: ColoredBox(
|
||||||
color: Colors.red,
|
color: Colors.red,
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: Alignment.centerRight,
|
alignment: Alignment.centerRight,
|
||||||
|
@ -354,9 +354,9 @@ class ChatListItem extends StatelessWidget {
|
||||||
subTitle: chat.lastMessage != null
|
subTitle: chat.lastMessage != null
|
||||||
? chat.lastMessage is ChatTextMessageModel
|
? chat.lastMessage is ChatTextMessageModel
|
||||||
? (chat.lastMessage! as ChatTextMessageModel).text
|
? (chat.lastMessage! as ChatTextMessageModel).text
|
||||||
: '📷 '
|
: "📷 "
|
||||||
'${translations.image}'
|
"${translations.image}"
|
||||||
: '',
|
: "",
|
||||||
lastUsed: chat.lastUsed != null
|
lastUsed: chat.lastUsed != null
|
||||||
? _dateFormatter.format(
|
? _dateFormatter.format(
|
||||||
date: chat.lastUsed!,
|
date: chat.lastUsed!,
|
||||||
|
@ -369,9 +369,9 @@ class ChatListItem extends StatelessWidget {
|
||||||
subTitle: chat.lastMessage != null
|
subTitle: chat.lastMessage != null
|
||||||
? chat.lastMessage is ChatTextMessageModel
|
? chat.lastMessage is ChatTextMessageModel
|
||||||
? (chat.lastMessage! as ChatTextMessageModel).text
|
? (chat.lastMessage! as ChatTextMessageModel).text
|
||||||
: '📷 '
|
: "📷 "
|
||||||
'${translations.image}'
|
"${translations.image}"
|
||||||
: '',
|
: "",
|
||||||
avatar: widget.options.groupAvatarBuilder(
|
avatar: widget.options.groupAvatarBuilder(
|
||||||
(chat as GroupChatModel).title,
|
(chat as GroupChatModel).title,
|
||||||
(chat as GroupChatModel).imageUrl,
|
(chat as GroupChatModel).imageUrl,
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
//
|
//
|
||||||
// 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_chat_view/flutter_chat_view.dart';
|
import "package:flutter_chat_view/flutter_chat_view.dart";
|
||||||
|
|
||||||
class NewChatScreen extends StatefulWidget {
|
class NewChatScreen extends StatefulWidget {
|
||||||
const NewChatScreen({
|
const NewChatScreen({
|
||||||
|
@ -41,7 +41,7 @@ class NewChatScreen extends StatefulWidget {
|
||||||
class _NewChatScreenState extends State<NewChatScreen> {
|
class _NewChatScreenState extends State<NewChatScreen> {
|
||||||
final FocusNode _textFieldFocusNode = FocusNode();
|
final FocusNode _textFieldFocusNode = FocusNode();
|
||||||
bool _isSearching = false;
|
bool _isSearching = false;
|
||||||
String query = '';
|
String query = "";
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -111,7 +111,7 @@ class _NewChatScreenState extends State<NewChatScreen> {
|
||||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||||
return const Center(child: CircularProgressIndicator());
|
return const Center(child: CircularProgressIndicator());
|
||||||
} else if (snapshot.hasError) {
|
} else if (snapshot.hasError) {
|
||||||
return Text('Error: ${snapshot.error}');
|
return Text("Error: ${snapshot.error}");
|
||||||
} else if (snapshot.hasData) {
|
} else if (snapshot.hasData) {
|
||||||
return _buildUserList(snapshot.data!);
|
return _buildUserList(snapshot.data!);
|
||||||
} else {
|
} else {
|
||||||
|
@ -162,7 +162,7 @@ class _NewChatScreenState extends State<NewChatScreen> {
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isSearching = !_isSearching;
|
_isSearching = !_isSearching;
|
||||||
query = '';
|
query = "";
|
||||||
});
|
});
|
||||||
|
|
||||||
if (_isSearching) {
|
if (_isSearching) {
|
||||||
|
@ -207,7 +207,7 @@ class _NewChatScreenState extends State<NewChatScreen> {
|
||||||
itemCount: filteredUsers.length,
|
itemCount: filteredUsers.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
var user = filteredUsers[index];
|
var user = filteredUsers[index];
|
||||||
return Container(
|
return DecoratedBox(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border(
|
border: Border(
|
||||||
bottom: BorderSide(
|
bottom: BorderSide(
|
||||||
|
@ -221,7 +221,7 @@ class _NewChatScreenState extends State<NewChatScreen> {
|
||||||
Padding(
|
Padding(
|
||||||
padding: widget.options.paddingAroundChatList ??
|
padding: widget.options.paddingAroundChatList ??
|
||||||
const EdgeInsets.symmetric(vertical: 8, horizontal: 28),
|
const EdgeInsets.symmetric(vertical: 8, horizontal: 28),
|
||||||
child: Container(
|
child: ColoredBox(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
//
|
//
|
||||||
// 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_chat_view/flutter_chat_view.dart';
|
import "package:flutter_chat_view/flutter_chat_view.dart";
|
||||||
|
|
||||||
class NewGroupChatOverviewScreen extends StatefulWidget {
|
class NewGroupChatOverviewScreen extends StatefulWidget {
|
||||||
const NewGroupChatOverviewScreen({
|
const NewGroupChatOverviewScreen({
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// 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_chat_view/flutter_chat_view.dart';
|
import "package:flutter_chat_view/flutter_chat_view.dart";
|
||||||
|
|
||||||
class NewGroupChatScreen extends StatefulWidget {
|
class NewGroupChatScreen extends StatefulWidget {
|
||||||
const NewGroupChatScreen({
|
const NewGroupChatScreen({
|
||||||
|
@ -26,7 +26,7 @@ class _NewGroupChatScreenState extends State<NewGroupChatScreen> {
|
||||||
List<ChatUserModel> selectedUserList = [];
|
List<ChatUserModel> selectedUserList = [];
|
||||||
|
|
||||||
bool _isSearching = false;
|
bool _isSearching = false;
|
||||||
String query = '';
|
String query = "";
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -49,7 +49,7 @@ class _NewGroupChatScreenState extends State<NewGroupChatScreen> {
|
||||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||||
return const Center(child: CircularProgressIndicator());
|
return const Center(child: CircularProgressIndicator());
|
||||||
} else if (snapshot.hasError) {
|
} else if (snapshot.hasError) {
|
||||||
return Text('Error: ${snapshot.error}');
|
return Text("Error: ${snapshot.error}");
|
||||||
} else if (snapshot.hasData) {
|
} else if (snapshot.hasData) {
|
||||||
return _buildUserList(snapshot.data!);
|
return _buildUserList(snapshot.data!);
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ class _NewGroupChatScreenState extends State<NewGroupChatScreen> {
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isSearching = !_isSearching;
|
_isSearching = !_isSearching;
|
||||||
query = '';
|
query = "";
|
||||||
});
|
});
|
||||||
|
|
||||||
if (_isSearching) {
|
if (_isSearching) {
|
||||||
|
@ -174,7 +174,7 @@ class _UserListState extends State<UserList> {
|
||||||
var isSelected = widget.selectedUserList
|
var isSelected = widget.selectedUserList
|
||||||
.any((selectedUser) => selectedUser == user);
|
.any((selectedUser) => selectedUser == user);
|
||||||
var theme = Theme.of(context);
|
var theme = Theme.of(context);
|
||||||
return Container(
|
return DecoratedBox(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border(
|
border: Border(
|
||||||
bottom: BorderSide(
|
bottom: BorderSide(
|
||||||
|
@ -196,7 +196,7 @@ class _UserListState extends State<UserList> {
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: widget.options.paddingAroundChatList ??
|
padding: widget.options.paddingAroundChatList ??
|
||||||
const EdgeInsets.fromLTRB(28, 8, 28, 8),
|
const EdgeInsets.fromLTRB(28, 8, 28, 8),
|
||||||
child: Container(
|
child: ColoredBox(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
import 'package:intl/intl.dart';
|
import "package:intl/intl.dart";
|
||||||
|
|
||||||
class DateFormatter {
|
class DateFormatter {
|
||||||
final _now = DateTime.now();
|
final _now = DateTime.now();
|
||||||
|
@ -28,6 +28,6 @@ class DateFormatter {
|
||||||
bool showFullDate = false,
|
bool showFullDate = false,
|
||||||
}) =>
|
}) =>
|
||||||
DateFormat(
|
DateFormat(
|
||||||
_isToday(date) ? 'HH:mm' : 'dd-MM-yyyy${showFullDate ? ' HH:mm' : ''}',
|
_isToday(date) ? "HH:mm" : 'dd-MM-yyyy${showFullDate ? ' HH:mm' : ''}',
|
||||||
).format(date);
|
).format(date);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import 'dart:async';
|
import "dart:async";
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import "package:flutter/material.dart";
|
||||||
import 'package:flutter_profile/flutter_profile.dart';
|
import "package:flutter_profile/flutter_profile.dart";
|
||||||
|
|
||||||
class ChatProfileService extends ProfileService {
|
class ChatProfileService extends ProfileService {
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import "package:flutter_test/flutter_test.dart";
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
test('test', () {
|
test("test", () {
|
||||||
expect(true, true);
|
expect(true, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue