diff --git a/packages/flutter_chat/lib/src/config/chat_options.dart b/packages/flutter_chat/lib/src/config/chat_options.dart index bace1a3..c1c083c 100644 --- a/packages/flutter_chat/lib/src/config/chat_options.dart +++ b/packages/flutter_chat/lib/src/config/chat_options.dart @@ -26,6 +26,7 @@ class ChatOptions { this.iconDisabledColor, this.chatAlignment, this.onNoChats, + this.imageQuality = 20, this.imageProviderResolver = _defaultImageProviderResolver, ChatRepositoryInterface? chatRepository, UserRepositoryInterface? userRepository, @@ -98,6 +99,12 @@ class ChatOptions { /// [onNoChats] is a function that is triggered when there are no chats. final Function? onNoChats; + /// [imageQuality] sets the quality of the image to send over with chat image + /// messages. This should be a value between 1 and 100 where 1 is the worst + /// image quality and 100 is the best image quality. Note that the higher the + /// image quality is set, the larger te iage is, that is being sent over. + final int imageQuality; + /// If [imageProviderResolver] is set, it will be used to get the images for /// the images in the entire userstory. If not provided, CachedNetworkImage /// will be used. diff --git a/packages/flutter_chat/lib/src/screens/creation/widgets/default_image_picker.dart b/packages/flutter_chat/lib/src/screens/creation/widgets/default_image_picker.dart index 2960a3d..d830868 100644 --- a/packages/flutter_chat/lib/src/screens/creation/widgets/default_image_picker.dart +++ b/packages/flutter_chat/lib/src/screens/creation/widgets/default_image_picker.dart @@ -59,7 +59,9 @@ class DefaultImagePickerDialog extends StatelessWidget { padding: const EdgeInsets.all(8.0), color: Colors.white, child: ImagePicker( - config: const ImagePickerConfig(imageQuality: 20), + config: ImagePickerConfig( + imageQuality: options.imageQuality.clamp(0, 100), + ), theme: ImagePickerTheme( spaceBetweenIcons: 32.0, iconColor: theme.primaryColor,