feat: translations

This commit is contained in:
Stein Milder 2022-11-08 09:29:21 +01:00
parent 2d36d02533
commit 7b03c934cf
18 changed files with 83 additions and 76 deletions

2
.gitignore vendored
View file

@ -32,3 +32,5 @@ migrate_working_dir/
.dart_tool/
.packages
build/
.flutter-plugins-dependencies
.flutter-plugins

View file

@ -1,13 +0,0 @@
# This is a generated file; do not edit or check into version control.
flutter_plugin_android_lifecycle=/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-2.0.7/
image_picker=/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/image_picker-0.8.6/
image_picker_android=/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/image_picker_android-0.8.5+3/
image_picker_for_web=/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/image_picker_for_web-2.1.10/
image_picker_ios=/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/image_picker_ios-0.8.6+1/
path_provider=/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.11/
path_provider_android=/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/path_provider_android-2.0.21/
path_provider_ios=/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/path_provider_ios-2.0.11/
path_provider_linux=/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-2.1.7/
path_provider_macos=/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-2.0.6/
path_provider_windows=/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.1.3/
sqflite=/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/sqflite-2.2.0+3/

View file

@ -1 +0,0 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"image_picker_ios","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/image_picker_ios-0.8.6+1/","native_build":true,"dependencies":[]},{"name":"path_provider_ios","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/path_provider_ios-2.0.11/","native_build":true,"dependencies":[]},{"name":"sqflite","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/sqflite-2.2.0+3/","native_build":true,"dependencies":[]}],"android":[{"name":"flutter_plugin_android_lifecycle","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-2.0.7/","native_build":true,"dependencies":[]},{"name":"image_picker_android","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/image_picker_android-0.8.5+3/","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"]},{"name":"path_provider_android","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/path_provider_android-2.0.21/","native_build":true,"dependencies":[]},{"name":"sqflite","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/sqflite-2.2.0+3/","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-2.0.6/","native_build":true,"dependencies":[]},{"name":"sqflite","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/sqflite-2.2.0+3/","native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-2.1.7/","native_build":false,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.1.3/","native_build":false,"dependencies":[]}],"web":[{"name":"image_picker_for_web","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/image_picker_for_web-2.1.10/","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"image_picker","dependencies":["image_picker_android","image_picker_for_web","image_picker_ios"]},{"name":"image_picker_android","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"image_picker_for_web","dependencies":[]},{"name":"image_picker_ios","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_ios","path_provider_linux","path_provider_macos","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_ios","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"sqflite","dependencies":[]}],"date_created":"2022-11-07 15:48:01.951577","version":"3.3.7"}

View file

@ -14,14 +14,16 @@ export 'package:flutter_community_chat_view/flutter_community_chat_view.dart';
class CommunityChat extends StatelessWidget {
const CommunityChat({
required this.dataProvider,
this.chatOptions = const ChatOptions(),
this.options = const ChatOptions(),
this.translations = const ChatTranslations(),
this.imagePickerTheme = const ImagePickerTheme(),
this.imagePickerConfig = const ImagePickerConfig(),
super.key,
});
final CommunityChatInterface dataProvider;
final ChatOptions chatOptions;
final ChatOptions options;
final ChatTranslations translations;
final ImagePickerTheme imagePickerTheme;
final ImagePickerConfig imagePickerConfig;
@ -34,7 +36,8 @@ class CommunityChat extends StatelessWidget {
dataProvider.getChatUsers().then((users) => _push(
context,
NewChatScreen(
chatOptions: chatOptions,
options: options,
translations: translations,
onPressCreateChat: (user) => dataProvider.createChat(
PersonalChatModel(user: user),
),
@ -45,7 +48,8 @@ class CommunityChat extends StatelessWidget {
Future<void> _onPressChat(BuildContext context, ChatModel chat) => _push(
context,
ChatDetailScreen(
chatOptions: chatOptions,
options: options,
translations: translations,
chat: chat,
chatMessages: dataProvider.getMessagesStream(chat),
onPressSelectImage: (ChatModel chat) =>
@ -58,12 +62,12 @@ class CommunityChat extends StatelessWidget {
Future<void> _onPressSelectImage(BuildContext context, ChatModel chat) =>
showModalBottomSheet<Uint8List?>(
context: context,
builder: (BuildContext context) =>
chatOptions.imagePickerContainerBuilder(
builder: (BuildContext context) => options.imagePickerContainerBuilder(
ImagePicker(
customButton: chatOptions.closeImagePickerButtonBuilder(
customButton: options.closeImagePickerButtonBuilder(
context,
() => Navigator.of(context).pop(),
translations,
),
imagePickerTheme: imagePickerTheme,
imagePickerConfig: imagePickerConfig,
@ -82,6 +86,7 @@ class CommunityChat extends StatelessWidget {
chats: dataProvider.getChatsStream(),
onPressStartChat: () => _onPressStartChat(context),
onPressChat: (chat) => _onPressChat(context, chat),
chatOptions: chatOptions,
options: options,
translations: translations,
);
}

View file

@ -188,7 +188,7 @@ packages:
description:
path: "packages/flutter_community_chat_view"
ref: HEAD
resolved-ref: bfca7ca229a0f9e6749d079a5b447e50bef6d56f
resolved-ref: "4af8360850b7d8d220f3052e4be25d6eb45ef963"
url: "https://github.com/Iconica-Development/flutter_community_chat.git"
source: git
version: "0.0.1"
@ -562,7 +562,7 @@ packages:
name: win32
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
version: "3.1.1"
xdg_directories:
dependency: transitive
description:

View file

@ -1,9 +0,0 @@
# This is a generated file; do not edit or check into version control.
cloud_firestore=/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-3.2.0/
cloud_firestore_web=/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/cloud_firestore_web-2.8.10/
firebase_auth=/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/firebase_auth-3.11.2/
firebase_auth_web=/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/firebase_auth_web-4.6.1/
firebase_core=/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.24.0/
firebase_core_web=/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/firebase_core_web-1.7.3/
firebase_storage=/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/firebase_storage-10.3.11/
firebase_storage_web=/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/firebase_storage_web-3.3.9/

View file

@ -1 +0,0 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"cloud_firestore","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-3.2.0/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_auth","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/firebase_auth-3.11.2/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_core","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.24.0/","native_build":true,"dependencies":[]},{"name":"firebase_storage","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/firebase_storage-10.3.11/","native_build":true,"dependencies":["firebase_core"]}],"android":[{"name":"cloud_firestore","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-3.2.0/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_auth","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/firebase_auth-3.11.2/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_core","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.24.0/","native_build":true,"dependencies":[]},{"name":"firebase_storage","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/firebase_storage-10.3.11/","native_build":true,"dependencies":["firebase_core"]}],"macos":[{"name":"cloud_firestore","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-3.2.0/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_auth","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/firebase_auth-3.11.2/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_core","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.24.0/","native_build":true,"dependencies":[]},{"name":"firebase_storage","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/firebase_storage-10.3.11/","native_build":true,"dependencies":["firebase_core"]}],"linux":[],"windows":[],"web":[{"name":"cloud_firestore_web","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/cloud_firestore_web-2.8.10/","dependencies":["firebase_core_web"]},{"name":"firebase_auth_web","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/firebase_auth_web-4.6.1/","dependencies":["firebase_core_web"]},{"name":"firebase_core_web","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/firebase_core_web-1.7.3/","dependencies":[]},{"name":"firebase_storage_web","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/firebase_storage_web-3.3.9/","dependencies":["firebase_core_web"]}]},"dependencyGraph":[{"name":"cloud_firestore","dependencies":["cloud_firestore_web","firebase_core"]},{"name":"cloud_firestore_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"firebase_auth","dependencies":["firebase_auth_web","firebase_core"]},{"name":"firebase_auth_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"firebase_core","dependencies":["firebase_core_web"]},{"name":"firebase_core_web","dependencies":[]},{"name":"firebase_storage","dependencies":["firebase_core","firebase_storage_web"]},{"name":"firebase_storage_web","dependencies":["firebase_core","firebase_core_web"]}],"date_created":"2022-11-07 15:48:03.926356","version":"3.3.7"}

View file

@ -1,8 +0,0 @@
# This is a generated file; do not edit or check into version control.
path_provider=/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.11/
path_provider_android=/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/path_provider_android-2.0.21/
path_provider_ios=/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/path_provider_ios-2.0.11/
path_provider_linux=/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-2.1.7/
path_provider_macos=/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-2.0.6/
path_provider_windows=/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.1.3/
sqflite=/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/sqflite-2.2.0+3/

View file

@ -1 +0,0 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider_ios","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/path_provider_ios-2.0.11/","native_build":true,"dependencies":[]},{"name":"sqflite","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/sqflite-2.2.0+3/","native_build":true,"dependencies":[]}],"android":[{"name":"path_provider_android","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/path_provider_android-2.0.21/","native_build":true,"dependencies":[]},{"name":"sqflite","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/sqflite-2.2.0+3/","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-2.0.6/","native_build":true,"dependencies":[]},{"name":"sqflite","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/sqflite-2.2.0+3/","native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-2.1.7/","native_build":false,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"/Users/steinmilder/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.1.3/","native_build":false,"dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"path_provider","dependencies":["path_provider_android","path_provider_ios","path_provider_linux","path_provider_macos","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_ios","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"sqflite","dependencies":[]}],"date_created":"2022-11-07 15:48:06.563678","version":"3.3.7"}

View file

@ -6,6 +6,7 @@ library flutter_community_chat_view;
export 'src/components/chat_row.dart';
export 'src/config/chat_options.dart';
export 'src/config/chat_translations.dart';
export 'src/screens/chat_detail_screen.dart';
export 'src/screens/chat_screen.dart';
export 'src/screens/new_chat_screen.dart';

View file

@ -11,6 +11,7 @@ class ChatBottom extends StatefulWidget {
required this.chat,
required this.onMessageSubmit,
required this.messageInputBuilder,
required this.translations,
this.onPressSelectImage,
super.key,
});
@ -18,8 +19,8 @@ class ChatBottom extends StatefulWidget {
final Future<void> Function(ChatModel chat, String text) onMessageSubmit;
final TextInputBuilder messageInputBuilder;
final Function(ChatModel)? onPressSelectImage;
final ChatModel chat;
final ChatTranslations translations;
@override
State<ChatBottom> createState() => _ChatBottomState();
@ -46,9 +47,7 @@ class _ChatBottomState extends State<ChatBottom> {
if (widget.onPressSelectImage != null)
IconButton(
onPressed: () => widget.onPressSelectImage!(widget.chat),
icon: const Icon(
Icons.image,
),
icon: const Icon(Icons.image),
),
IconButton(
onPressed: () {
@ -59,13 +58,12 @@ class _ChatBottomState extends State<ChatBottom> {
_textEditingController.clear();
}
},
icon: const Icon(
Icons.send,
),
icon: const Icon(Icons.send),
),
],
),
),
widget.translations,
),
),
);

View file

@ -58,9 +58,7 @@ class _ChatDetailRowState extends State<ChatDetailRow> {
child: widget.message is ChatTextMessageModel
? Text(
(widget.message as ChatTextMessageModel).text,
style: const TextStyle(
fontSize: 16,
),
style: const TextStyle(fontSize: 16),
overflow: TextOverflow.ellipsis,
maxLines: 999,
)

View file

@ -24,9 +24,7 @@ class ChatRow extends StatelessWidget {
children: [
Padding(
padding: const EdgeInsets.only(left: 10.0),
child: ChatImage(
image: image,
),
child: ChatImage(image: image),
),
Expanded(
child: Padding(

View file

@ -3,6 +3,7 @@
// SPDX-License-Identifier: BSD-3-Clause
import 'package:flutter/material.dart';
import 'package:flutter_community_chat_view/flutter_community_chat_view.dart';
class ChatOptions {
const ChatOptions({
@ -25,6 +26,7 @@ class ChatOptions {
Widget _createNewChatButton(
BuildContext context,
VoidCallback onPressed,
ChatTranslations translations,
) =>
Padding(
padding: const EdgeInsets.all(16.0),
@ -33,18 +35,19 @@ Widget _createNewChatButton(
minimumSize: const Size.fromHeight(50),
),
onPressed: onPressed,
child: const Text('Start chat'),
child: Text(translations.newChatButton),
),
);
Widget _createMessageInput(
TextEditingController textEditingController,
Widget suffixIcon,
ChatTranslations translations,
) =>
TextField(
controller: textEditingController,
decoration: InputDecoration(
hintText: 'Schrijf hier je bericht',
hintText: translations.messagePlaceholder,
suffixIcon: suffixIcon,
),
);
@ -72,10 +75,13 @@ Widget _createImagePickerContainer(
Widget _createCloseImagePickerButton(
BuildContext context,
VoidCallback onPressed,
ChatTranslations translations,
) =>
ElevatedButton(
onPressed: onPressed,
child: const Text('Annuleren'),
child: Text(
translations.cancelImagePickerBtn,
),
);
Scaffold _createScaffold(
@ -90,11 +96,13 @@ Scaffold _createScaffold(
typedef ButtonBuilder = Widget Function(
BuildContext context,
VoidCallback onPressed,
ChatTranslations translations,
);
typedef TextInputBuilder = Widget Function(
TextEditingController textEditingController,
Widget suffixIcon,
ChatTranslations translations,
);
typedef ContainerBuilder = Widget Function(

View file

@ -0,0 +1,23 @@
// SPDX-FileCopyrightText: 2022 Iconica
//
// SPDX-License-Identifier: BSD-3-Clause
class ChatTranslations {
const ChatTranslations({
this.chatsTitle = 'Chats',
this.newChatButton = 'Start chat',
this.newChatTitle = 'Start chat',
this.image = 'Image',
this.searchPlaceholder = 'Search...',
this.cancelImagePickerBtn = 'Cancel',
this.messagePlaceholder = 'Write your message here...',
});
final String chatsTitle;
final String newChatButton;
final String newChatTitle;
final String image;
final String searchPlaceholder;
final String cancelImagePickerBtn;
final String messagePlaceholder;
}

View file

@ -11,16 +11,18 @@ import 'package:flutter_community_chat_view/src/components/chat_image.dart';
class ChatDetailScreen extends StatelessWidget {
const ChatDetailScreen({
required this.chatOptions,
required this.options,
required this.chat,
required this.onMessageSubmit,
this.translations = const ChatTranslations(),
this.chatMessages,
this.onPressSelectImage,
super.key,
});
final ChatModel chat;
final ChatOptions chatOptions;
final ChatOptions options;
final ChatTranslations translations;
final Stream<List<ChatMessageModel>>? chatMessages;
final Function(ChatModel)? onPressSelectImage;
final Future<void> Function(ChatModel chat, String text) onMessageSubmit;
@ -81,9 +83,10 @@ class ChatDetailScreen extends StatelessWidget {
),
ChatBottom(
chat: chat,
messageInputBuilder: chatOptions.messageInputBuilder,
messageInputBuilder: options.messageInputBuilder,
onPressSelectImage: onPressSelectImage,
onMessageSubmit: onMessageSubmit,
translations: translations,
),
],
),

View file

@ -3,21 +3,22 @@
// SPDX-License-Identifier: BSD-3-Clause
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/services/date_formatter.dart';
class ChatScreen extends StatefulWidget {
const ChatScreen({
required this.chatOptions,
required this.options,
required this.chats,
required this.onPressStartChat,
required this.onPressChat,
this.translations = const ChatTranslations(),
super.key,
});
final ChatOptions chatOptions;
final ChatOptions options;
final ChatTranslations translations;
final Stream<List<ChatModel>> chats;
final VoidCallback? onPressStartChat;
final void Function(ChatModel chat) onPressChat;
@ -30,9 +31,9 @@ class _ChatScreenState extends State<ChatScreen> {
final DateFormatter _dateFormatter = DateFormatter();
@override
Widget build(BuildContext context) => widget.chatOptions.scaffoldBuilder(
Widget build(BuildContext context) => widget.options.scaffoldBuilder(
AppBar(
title: const Text('Chats'),
title: Text(widget.translations.chatsTitle),
),
Column(
children: [
@ -49,7 +50,7 @@ class _ChatScreenState extends State<ChatScreen> {
for (ChatModel chat in snapshot.data ?? [])
GestureDetector(
onTap: () => widget.onPressChat(chat),
child: widget.chatOptions.chatRowContainerBuilder(
child: widget.options.chatRowContainerBuilder(
ChatRow(
image: chat is PersonalChatModel
? chat.user.imageUrl
@ -62,7 +63,7 @@ class _ChatScreenState extends State<ChatScreen> {
? (chat.lastMessage!
as ChatTextMessageModel)
.text
: '📷 Afbeelding'
: '📷 ${widget.translations.image}'
: null,
lastUsed: chat.lastUsed != null
? _dateFormatter.format(
@ -79,9 +80,10 @@ class _ChatScreenState extends State<ChatScreen> {
),
),
if (widget.onPressStartChat != null)
widget.chatOptions.newChatButtonBuilder(
widget.options.newChatButtonBuilder(
context,
widget.onPressStartChat!,
widget.translations,
),
],
),

View file

@ -8,13 +8,15 @@ import 'package:flutter_community_chat_view/flutter_community_chat_view.dart';
class NewChatScreen extends StatefulWidget {
const NewChatScreen({
required this.chatOptions,
required this.options,
required this.users,
required this.onPressCreateChat,
this.translations = const ChatTranslations(),
super.key,
});
final ChatOptions chatOptions;
final ChatOptions options;
final ChatTranslations translations;
final List<ChatUserModel> users;
final Function(ChatUserModel) onPressCreateChat;
@ -51,12 +53,12 @@ class _NewChatScreenState extends State<NewChatScreen> {
child: TextField(
focusNode: _textFieldFocusNode,
onChanged: filterUsers,
decoration: const InputDecoration(
hintText: 'Zoeken...',
decoration: InputDecoration(
hintText: widget.translations.searchPlaceholder,
),
),
)
: const Text('Start een chat'),
: Text(widget.translations.newChatButton),
actions: [
IconButton(
onPressed: () {
@ -78,7 +80,7 @@ class _NewChatScreenState extends State<NewChatScreen> {
children: [
for (var user in _filteredUsers ?? widget.users)
GestureDetector(
child: widget.chatOptions.chatRowContainerBuilder(
child: widget.options.chatRowContainerBuilder(
ChatRow(
image: user.imageUrl,
title: user.name ?? '',