Skip to content

Commit

Permalink
Merge pull request #65 from Iconica-Development/1.4.1
Browse files Browse the repository at this point in the history
refactor/match with Figma
  • Loading branch information
Gorter-dev authored Apr 19, 2024
2 parents 32189ba + 70c795e commit 3b443ee
Show file tree
Hide file tree
Showing 17 changed files with 372 additions and 202 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 1.4.1
- Made UI changes to match the Figma design

## 1.4.0
- Add way to create group chats
- Update flutter_profile to 1.3.0
Expand Down
9 changes: 7 additions & 2 deletions packages/flutter_chat/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ class Home extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Center(
child: chatNavigatorUserStory(context),
);
child: chatNavigatorUserStory(context,
configuration: ChatUserStoryConfiguration(
chatService: LocalChatService(),
chatOptionsBuilder: (ctx) => ChatOptions(
noChatsPlaceholderBuilder: (translations) =>
Text(translations.noUsersFound),
))));
}
}
8 changes: 4 additions & 4 deletions packages/flutter_chat/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

name: flutter_chat
description: A new Flutter package project.
version: 1.4.0
version: 1.4.1

publish_to: none

Expand All @@ -20,17 +20,17 @@ dependencies:
git:
url: https://github.com/Iconica-Development/flutter_chat
path: packages/flutter_chat_view
ref: 1.4.0
ref: 1.4.1
flutter_chat_interface:
git:
url: https://github.com/Iconica-Development/flutter_chat
path: packages/flutter_chat_interface
ref: 1.4.0
ref: 1.4.1
flutter_chat_local:
git:
url: https://github.com/Iconica-Development/flutter_chat
path: packages/flutter_chat_local
ref: 1.4.0
ref: 1.4.1
uuid: ^4.3.3

dev_dependencies:
Expand Down
4 changes: 2 additions & 2 deletions packages/flutter_chat_firebase/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

name: flutter_chat_firebase
description: A new Flutter package project.
version: 1.4.0
version: 1.4.1
publish_to: none

environment:
Expand All @@ -23,7 +23,7 @@ dependencies:
git:
url: https://github.com/Iconica-Development/flutter_chat
path: packages/flutter_chat_interface
ref: 1.4.0
ref: 1.4.1

dev_dependencies:
flutter_iconica_analysis:
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter_chat_interface/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

name: flutter_chat_interface
description: A new Flutter package project.
version: 1.4.0
version: 1.4.1
publish_to: none

environment:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class LocalChatDetailService with ChangeNotifier implements ChatDetailService {
.chats
.firstWhere((element) => element.id == chatId);
var message = ChatImageMessageModel(
sender: ChatUserModel(
sender: const ChatUserModel(
id: '3',
firstName: 'ico',
lastName: 'nica',
Expand Down Expand Up @@ -101,7 +101,7 @@ class LocalChatDetailService with ChangeNotifier implements ChatDetailService {
.chats
.firstWhere((element) => element.id == chatId);
var message = ChatTextMessageModel(
sender: ChatUserModel(
sender: const ChatUserModel(
id: '3',
firstName: 'ico',
lastName: 'nica',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ import 'package:flutter_chat_interface/flutter_chat_interface.dart';
class LocalChatUserService implements ChatUserService {
/// List of predefined chat users.
List<ChatUserModel> users = [
ChatUserModel(
const ChatUserModel(
id: '1',
firstName: 'John',
lastName: 'Doe',
imageUrl: 'https://picsum.photos/200/300',
),
ChatUserModel(
const ChatUserModel(
id: '2',
firstName: 'Jane',
lastName: 'Doe',
imageUrl: 'https://picsum.photos/200/300',
),
ChatUserModel(
const ChatUserModel(
id: '3',
firstName: 'ico',
lastName: 'nica',
Expand All @@ -29,7 +29,8 @@ class LocalChatUserService implements ChatUserService {
Future.value(users.where((element) => element.id != '3').toList());

@override
Future<ChatUserModel?> getCurrentUser() => Future.value(ChatUserModel());
Future<ChatUserModel?> getCurrentUser() =>
Future.value(const ChatUserModel());

@override
Future<ChatUserModel?> getUser(String id) {
Expand Down
4 changes: 2 additions & 2 deletions packages/flutter_chat_local/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_chat_local
description: "A new Flutter package project."
version: 1.4.0
version: 1.4.1
publish_to: none
homepage:

Expand All @@ -15,7 +15,7 @@ dependencies:
git:
url: https://github.com/Iconica-Development/flutter_chat
path: packages/flutter_chat_interface
ref: 1.4.0
ref: 1.4.1

dev_dependencies:
flutter_test:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ class _ChatDetailRowState extends State<ChatDetailRow> {
)
else
Text(
widget.message.sender.fullName?.toUpperCase() ??
widget.message.sender.fullName ??
widget.translations.anonymousUser,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
fontSize: 16,
fontWeight: FontWeight.w800,
color: Theme.of(context)
.textTheme
.labelMedium
Expand All @@ -121,7 +121,8 @@ class _ChatDetailRowState extends State<ChatDetailRow> {
showFullDate: true,
),
style: const TextStyle(
fontSize: 12,
fontSize: 16,
fontWeight: FontWeight.w300,
color: Color(0xFFBBBBBB),
),
),
Expand Down
59 changes: 30 additions & 29 deletions packages/flutter_chat_view/lib/src/components/chat_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ class ChatRow extends StatelessWidget {

@override
Widget build(BuildContext context) => Row(
crossAxisAlignment: CrossAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(left: 10.0),
child: avatar,
),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 22.0),
padding: const EdgeInsets.only(left: 16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expand All @@ -48,10 +48,10 @@ class ChatRow extends StatelessWidget {
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 18,
fontSize: 16,
fontWeight: unreadMessages > 0
? FontWeight.w600
: FontWeight.w400,
? FontWeight.w900
: FontWeight.w500,
),
),
if (subTitle != null)
Expand All @@ -62,11 +62,11 @@ class ChatRow extends StatelessWidget {
style: TextStyle(
fontSize: 16,
fontWeight: unreadMessages > 0
? FontWeight.w600
: FontWeight.w400,
? FontWeight.w500
: FontWeight.w300,
),
overflow: TextOverflow.ellipsis,
maxLines: 1,
maxLines: 2,
),
),
],
Expand All @@ -77,29 +77,30 @@ class ChatRow extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
lastUsed ?? '',
style: const TextStyle(
color: Color(0xFFBBBBBB),
fontSize: 14,
),
),
if (unreadMessages > 0) ...[
if (lastUsed != null) // Check if lastUsed is not null
Padding(
padding: const EdgeInsets.only(top: 4.0),
child: Container(
width: 20,
height: 20,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.primary,
shape: BoxShape.circle,
padding: const EdgeInsets.only(bottom: 4.0),
child: Text(
lastUsed!,
style: const TextStyle(
color: Color(0xFFBBBBBB),
fontSize: 14,
),
child: Center(
child: Text(
unreadMessages.toString(),
style: const TextStyle(
fontSize: 14,
),
),
),
if (unreadMessages > 0) ...[
Container(
width: 20,
height: 20,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.primary,
shape: BoxShape.circle,
),
child: Center(
child: Text(
unreadMessages.toString(),
style: const TextStyle(
fontSize: 14,
),
),
),
Expand Down
49 changes: 43 additions & 6 deletions packages/flutter_chat_view/lib/src/config/chat_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class ChatOptions {
this.userAvatarBuilder = _createUserAvatar,
this.groupAvatarBuilder = _createGroupAvatar,
this.noChatsPlaceholderBuilder = _createNoChatsPlaceholder,
this.noUsersPlaceholderBuilder = _createNoUsersPlaceholder,
});

/// Builder function for the new chat button.
Expand All @@ -43,6 +44,9 @@ class ChatOptions {

/// Builder function for the placeholder shown when no chats are available.
final NoChatsPlaceholderBuilder noChatsPlaceholderBuilder;

/// Builder function for the placeholder shown when no users are available.
final NoUsersPlaceholderBuilder noUsersPlaceholderBuilder;
}

Widget _createNewChatButton(
Expand All @@ -51,16 +55,23 @@ Widget _createNewChatButton(
ChatTranslations translations,
) =>
Padding(
padding: const EdgeInsets.all(24.0),
padding: const EdgeInsets.fromLTRB(5, 24, 5, 24),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.black,
minimumSize: const Size.fromHeight(50),
backgroundColor: const Color.fromRGBO(113, 198, 209, 1),
fixedSize: const Size(254, 44),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(56),
),
),
onPressed: onPressed,
child: Text(
translations.newChatButton,
style: const TextStyle(color: Colors.white),
style: const TextStyle(
color: Colors.white,
fontWeight: FontWeight.w800,
fontSize: 18,
),
),
),
);
Expand Down Expand Up @@ -112,7 +123,7 @@ Widget _createChatRowContainer(
) =>
Padding(
padding: const EdgeInsets.symmetric(
vertical: 15.0,
vertical: 12.0,
horizontal: 10.0,
),
child: chatRow,
Expand All @@ -126,9 +137,17 @@ Widget _createImagePickerContainer(
padding: const EdgeInsets.all(8.0),
color: Colors.white,
child: ImagePicker(
imagePickerTheme: ImagePickerTheme(
title: translations.imagePickerTitle,
titleTextSize: 16,
titleAlignment: TextAlign.center,
iconSize: 60.0,
makePhotoText: translations.takePicture,
selectImageText: translations.uploadFile,
),
customButton: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.black,
backgroundColor: const Color.fromRGBO(113, 198, 209, 1),
),
onPressed: onClose,
child: Text(
Expand Down Expand Up @@ -172,6 +191,20 @@ Widget _createGroupAvatar(

Widget _createNoChatsPlaceholder(
ChatTranslations translations,
) =>
Center(
child: Text(
translations.noChatsFound,
textAlign: TextAlign.center,
style: const TextStyle(
color: Colors.white,
fontSize: 18,
),
),
);

Widget _createNoUsersPlaceholder(
ChatTranslations translations,
) =>
Center(
child: Text(
Expand Down Expand Up @@ -224,3 +257,7 @@ typedef GroupAvatarBuilder = Widget Function(
typedef NoChatsPlaceholderBuilder = Widget Function(
ChatTranslations translations,
);

typedef NoUsersPlaceholderBuilder = Widget Function(
ChatTranslations translations,
);
Loading

0 comments on commit 3b443ee

Please sign in to comment.