Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions lib/src/components/organisms/chat/message_input.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class ZdsMessageInput extends StatefulWidget {
this.moreConfig,
this.inlineConfig,
this.moreOptionItemStyle = ZdsFilePickerOptionItemStyle.vertical,
this.addAttachment,
this.enforceSheet = true,
super.key,
}) : assert(
(allowVoiceNotes && voiceNoteFileName != null) || !allowVoiceNotes,
Expand Down Expand Up @@ -100,6 +102,12 @@ class ZdsMessageInput extends StatefulWidget {
/// The maximum pixel size of any image sent as an attachment.
final int maxPixelSize;

/// The value of Add Attachment in localised language.
final String? addAttachment;

/// The value of enforceSheet is used to show bottom sheet.
final bool enforceSheet;

/// Custom configuration for the file picker that appears when the attachment button is clicked.
///
/// If not provided, a default configuration will be used.
Expand Down Expand Up @@ -165,7 +173,9 @@ class ZdsMessageInput extends StatefulWidget {
..add(IterableProperty<ZdsFilePostProcessor>('postProcessors', postProcessors))
..add(DiagnosticsProperty<ZdsFilePickerConfig?>('moreConfig', moreConfig))
..add(DiagnosticsProperty<ZdsFilePickerConfig?>('inlineConfig', inlineConfig))
..add(EnumProperty<ZdsFilePickerOptionItemStyle>('optionItemStyle', moreOptionItemStyle));
..add(EnumProperty<ZdsFilePickerOptionItemStyle>('optionItemStyle', moreOptionItemStyle))
..add(StringProperty('addAttachment', addAttachment))
..add(DiagnosticsProperty<bool>('enforceSheet', enforceSheet));
}
}

Expand Down Expand Up @@ -443,7 +453,7 @@ class ZdsMessageInputState extends State<ZdsMessageInput> with SingleTickerProvi

unawaited(
showZdsBottomSheet<ZdsFileWrapper>(
enforceSheet: true,
enforceSheet: widget.enforceSheet,
backgroundColor: zetaColors.surfacePrimary,
context: context,
maxHeight: maxSheetHeight,
Expand All @@ -464,7 +474,7 @@ class ZdsMessageInputState extends State<ZdsMessageInput> with SingleTickerProvi
identifier: 'drawer_title',
container: true,
child: Text(
ComponentStrings.of(context).get('ADD_ATTACHMENTS', 'Add Attachments'),
widget.addAttachment ?? ComponentStrings.of(context).get('ADD', 'Add'),
style: ZetaTextStyles.h5,
overflow: TextOverflow.ellipsis,
),
Expand Down
2 changes: 2 additions & 0 deletions lib/src/utils/assets/icons.dart
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ const Map<String, IconData> _extensions = <String, IconData>{
'.png': ZdsIcons.file_image_o,
'.bmp': ZdsIcons.file_image_o,
'.ppt': ZdsIcons.file_powerpoint_o,
'.ppr': ZdsIcons.file_powerpoint_o,
'.pptx': ZdsIcons.file_powerpoint_o,
'.qt': ZdsIcons.file_o,
'.rar': ZdsIcons.file_archive_o,
Expand Down Expand Up @@ -408,6 +409,7 @@ Color iconColor(String ext, {BuildContext? context}) {

case '.pdf':
case '.ppt':
case '.ppr':
case '.pptx':
return colors?.red ?? const Color(0xFFDB0D00);

Expand Down