Skip to content

Commit 31eedc2

Browse files
fix: πŸ› Added support to hide/Un-hide image picker & camera icon #109 (#110)
Co-authored-by: Jaimin Rana <[email protected]>
1 parent 8f51995 commit 31eedc2

File tree

5 files changed

+49
-33
lines changed

5 files changed

+49
-33
lines changed

β€ŽCHANGELOG.mdβ€Ž

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
##(Unreleased)
1+
## [1.3.1]
22

33
* **Feat**: [105](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/105) Allow user
44
to get callback when image is picked so user can perform operation like crop. Allow user to pass
55
configuration like height, width, image quality and preferredCameraDevice.
66
* **Fix**: [95](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/95) Fix issue of
77
chat is added to bottom while `loadMoreData` callback.
8-
8+
* **Fix**: [109](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/109) Added
9+
support for the hiding/Un-hiding gallery and camera buttons
10+
911
## [1.3.0]
1012

1113
* **Feat**: [71](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/71) Added Callback

β€ŽREADME.mdβ€Ž

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,11 +369,13 @@ ChatView(
369369
)
370370
```
371371

372-
14. Add image picker icon configuration.
372+
14. Add image picker configuration.
373373
```dart
374374
ChatView(
375375
...
376376
sendMessageConfig: SendMessageConfiguration(
377+
enableCameraImagePicker: false,
378+
enableGalleryImagePicker: true,
377379
imagePickerIconsConfig: ImagePickerIconsConfiguration(
378380
cameraIconColor: Colors.black,
379381
galleryIconColor: Colors.black,

β€Žlib/src/models/send_message_configuration.dartβ€Ž

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ class SendMessageConfiguration {
5959
/// Enable/disable voice recording. Enabled by default.
6060
final bool allowRecordingVoice;
6161

62+
/// Enable/disable image picker from gallery. Enabled by default.
63+
final bool enableGalleryImagePicker;
64+
65+
/// Enable/disable send image from camera. Enabled by default.
66+
final bool enableCameraImagePicker;
67+
6268
/// Color of mic icon when replying to some voice message.
6369
final Color? micIconColor;
6470

@@ -77,6 +83,8 @@ class SendMessageConfiguration {
7783
this.replyMessageColor,
7884
this.closeIconColor,
7985
this.allowRecordingVoice = true,
86+
this.enableCameraImagePicker = true,
87+
this.enableGalleryImagePicker = true,
8088
this.voiceRecordingConfiguration,
8189
this.micIconColor,
8290
});

β€Žlib/src/widgets/chatui_textfield.dartβ€Ž

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -219,38 +219,42 @@ class _ChatUITextFieldState extends State<ChatUITextField> {
219219
return Row(
220220
children: [
221221
if (!isRecordingValue) ...[
222-
IconButton(
223-
constraints: const BoxConstraints(),
224-
onPressed: () => _onIconPressed(
225-
ImageSource.camera,
226-
config: widget
227-
.sendMessageConfig?.imagePickerConfiguration,
222+
if (sendMessageConfig?.enableCameraImagePicker ??
223+
true)
224+
IconButton(
225+
constraints: const BoxConstraints(),
226+
onPressed: () => _onIconPressed(
227+
ImageSource.camera,
228+
config:
229+
sendMessageConfig?.imagePickerConfiguration,
230+
),
231+
icon: imagePickerIconsConfig
232+
?.cameraImagePickerIcon ??
233+
Icon(
234+
Icons.camera_alt_outlined,
235+
color:
236+
imagePickerIconsConfig?.cameraIconColor,
237+
),
228238
),
229-
icon:
230-
imagePickerIconsConfig?.cameraImagePickerIcon ??
231-
Icon(
232-
Icons.camera_alt_outlined,
233-
color: imagePickerIconsConfig
234-
?.cameraIconColor,
235-
),
236-
),
237-
IconButton(
238-
constraints: const BoxConstraints(),
239-
onPressed: () => _onIconPressed(
240-
ImageSource.gallery,
241-
config: widget
242-
.sendMessageConfig?.imagePickerConfiguration,
239+
if (sendMessageConfig?.enableGalleryImagePicker ??
240+
true)
241+
IconButton(
242+
constraints: const BoxConstraints(),
243+
onPressed: () => _onIconPressed(
244+
ImageSource.gallery,
245+
config:
246+
sendMessageConfig?.imagePickerConfiguration,
247+
),
248+
icon: imagePickerIconsConfig
249+
?.galleryImagePickerIcon ??
250+
Icon(
251+
Icons.image,
252+
color: imagePickerIconsConfig
253+
?.galleryIconColor,
254+
),
243255
),
244-
icon: imagePickerIconsConfig
245-
?.galleryImagePickerIcon ??
246-
Icon(
247-
Icons.image,
248-
color:
249-
imagePickerIconsConfig?.galleryIconColor,
250-
),
251-
),
252256
],
253-
if (widget.sendMessageConfig?.allowRecordingVoice ??
257+
if (sendMessageConfig?.allowRecordingVoice ??
254258
true &&
255259
Platform.isIOS &&
256260
Platform.isAndroid &&

β€Žpubspec.yamlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: chatview
22
description: A Flutter package that allows you to integrate Chat View with highly customization options.
3-
version: 1.3.0
3+
version: 1.3.1
44
issue_tracker: https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues
55
repository: https://github.com/SimformSolutionsPvtLtd/flutter_chatview
66

0 commit comments

Comments
Β (0)