bugfix: add imageQuality with default 20 value to options of flutter chat.

This commit is contained in:
John Gorter 2025-03-04 14:42:20 +01:00 committed by FlutterJoey
parent ad4cf1e37b
commit c63efadd2c
2 changed files with 10 additions and 1 deletions

View file

@ -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.

View file

@ -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,