Skip to content

Commit

Permalink
[TW-1472] Prevent user can select video in Change Avatar function (#1501
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Te-Z authored Feb 26, 2024
1 parent 2e5f258 commit e3764f7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
7 changes: 4 additions & 3 deletions lib/pages/chat_details/chat_details_edit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import 'package:linagora_design_flutter/images_picker/asset_counter.dart';
import 'package:linagora_design_flutter/images_picker/images_picker_grid.dart';
import 'package:matrix/matrix.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:photo_manager/photo_manager.dart';
import 'package:photo_manager/photo_manager.dart' as photo_manager;

class ChatDetailsEdit extends StatefulWidget {
final String roomId;
Expand Down Expand Up @@ -65,7 +65,7 @@ class ChatDetailsEditController extends State<ChatDetailsEdit>
Right(ChatDetailsUploadAvatarInitial()),
);
FilePickerResult? avatarFilePicker;
AssetEntity? avatarAssetEntity;
photo_manager.AssetEntity? avatarAssetEntity;

final MenuController menuController = MenuController();

Expand Down Expand Up @@ -138,6 +138,7 @@ class ChatDetailsEditController extends State<ChatDetailsEdit>
context,
currentPermissionPhotos,
imagePickerController,
type: photo_manager.RequestType.image,
);
}
}
Expand All @@ -149,7 +150,7 @@ class ChatDetailsEditController extends State<ChatDetailsEdit>

imagePickerController.addListener(() {
final selectedAsset = imagePickerController.selectedAssets.firstOrNull;
if (selectedAsset?.asset.type == AssetType.image) {
if (selectedAsset?.asset.type == photo_manager.AssetType.image) {
if (!imagePickerController.pickFromCamera()) {
Navigator.pop(context);
}
Expand Down
6 changes: 4 additions & 2 deletions lib/presentation/mixins/single_image_picker_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ mixin SingleImagePickerMixin on CommonMediaPickerMixin {
Future<void> showImagePickerBottomSheet(
BuildContext context,
PermissionStatus? permissionStatusPhotos,
ImagePickerGridController imagePickerController,
) async {
ImagePickerGridController imagePickerController, {
RequestType type = RequestType.image,
}) async {
if (permissionStatusPhotos != null) {
return await linagora_image_picker.ImagePicker.showImagesGridBottomSheet(
context: context,
Expand Down Expand Up @@ -63,6 +64,7 @@ mixin SingleImagePickerMixin on CommonMediaPickerMixin {
},
backgroundImage: const AssetImage("assets/verification.png"),
),
type: type,
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1470,7 +1470,7 @@ packages:
description:
path: "."
ref: master
resolved-ref: ea9d98ed3bab8f362a46cb0d48ff57eb1332630c
resolved-ref: "492b6a564e3df87dc7f0796c84e1641358460d49"
url: "[email protected]:linagora/linagora-design-flutter.git"
source: git
version: "0.0.1"
Expand Down

0 comments on commit e3764f7

Please sign in to comment.