From a9cf3438a0d105c911ee1bb2344aa1335b1da96e Mon Sep 17 00:00:00 2001 From: --global Date: Tue, 28 May 2024 11:21:10 +0700 Subject: [PATCH] TW-1644: center the permission photo for text --- assets/l10n/intl_en.arb | 2 +- lib/pages/chat_details/chat_details.dart | 3 +-- lib/presentation/mixins/media_picker_mixin.dart | 15 +++++++++------ lib/presentation/mixins/media_picker_style.dart | 9 +++++++++ .../mixins/single_image_picker_mixin.dart | 15 +++++++++------ 5 files changed, 29 insertions(+), 15 deletions(-) create mode 100644 lib/presentation/mixins/media_picker_style.dart diff --git a/assets/l10n/intl_en.arb b/assets/l10n/intl_en.arb index ef763c4c9..f6316f9da 100644 --- a/assets/l10n/intl_en.arb +++ b/assets/l10n/intl_en.arb @@ -2690,7 +2690,7 @@ "@noImagesFound": {}, "captionForImagesIsNotSupportYet": "Caption for images is not support yet.", "@captionForImagesIsNotSupportYet": {}, - "tapToAllowAccessToYourGallery": "Tap to allow access to your Gallery", + "tapToAllowAccessToYourGallery": "Tap to allow gallery access", "@tapToAllowAccessToYourGallery": {}, "tapToAllowAccessToYourCamera": "You can enable camera access in the Settings app to make video calls in", "@tapToAllowAccessToYourCamera": {}, diff --git a/lib/pages/chat_details/chat_details.dart b/lib/pages/chat_details/chat_details.dart index 3b75981b6..6647e820b 100644 --- a/lib/pages/chat_details/chat_details.dart +++ b/lib/pages/chat_details/chat_details.dart @@ -156,8 +156,7 @@ class ChatDetailsController extends State void initValueNotifiers() { room = Matrix.of(context).client.getRoomById(roomId!); muteNotifier.value = room?.pushRuleState ?? PushRuleState.notify; - membersNotifier.value ??= - Matrix.of(context).client.getRoomById(roomId!)!.getParticipants(); + membersNotifier.value ??= room?.getParticipants(); } void _listenForRoomMembersChanged() { diff --git a/lib/presentation/mixins/media_picker_mixin.dart b/lib/presentation/mixins/media_picker_mixin.dart index 07243b220..91643334e 100644 --- a/lib/presentation/mixins/media_picker_mixin.dart +++ b/lib/presentation/mixins/media_picker_mixin.dart @@ -3,6 +3,7 @@ import 'package:fluffychat/pages/chat/input_bar/focus_suggestion_controller.dart import 'package:fluffychat/pages/chat/input_bar/input_bar.dart'; import 'package:fluffychat/pages/chat/item_actions_bottom_widget.dart'; import 'package:fluffychat/pages/chat/send_file_dialog/send_file_dialog_style.dart'; +import 'package:fluffychat/presentation/mixins/media_picker_style.dart'; import 'package:fluffychat/resource/image_paths.dart'; import 'package:fluffychat/utils/platform_infos.dart'; import 'package:flutter/material.dart'; @@ -236,18 +237,20 @@ mixin MediaPickerMixin on CommonMediaPickerMixin { ), ), goToSettingsWidget: Column( + mainAxisAlignment: MainAxisAlignment.center, children: [ SvgPicture.asset( ImagePaths.icPhotosSettingPermission, - width: 40, - height: 40, + width: MediaPickerStyle.photoPermissionIconSize, + height: MediaPickerStyle.photoPermissionIconSize, ), Text( L10n.of(context)!.tapToAllowAccessToYourGallery, - style: Theme.of(context) - .textTheme - .titleSmall - ?.copyWith(color: LinagoraRefColors.material().neutral), + style: Theme.of(context).textTheme.titleSmall?.copyWith( + color: LinagoraRefColors.material().neutral, + fontWeight: MediaPickerStyle.photoPermissionFontWeight, + fontSize: MediaPickerStyle.photoPermissionFontSize, + ), textAlign: TextAlign.center, ), ], diff --git a/lib/presentation/mixins/media_picker_style.dart b/lib/presentation/mixins/media_picker_style.dart new file mode 100644 index 000000000..10bc2e60f --- /dev/null +++ b/lib/presentation/mixins/media_picker_style.dart @@ -0,0 +1,9 @@ +import 'package:flutter/material.dart'; + +class MediaPickerStyle { + static double photoPermissionIconSize = 48.0; + + static double photoPermissionFontSize = 18; + + static FontWeight photoPermissionFontWeight = FontWeight.w600; +} diff --git a/lib/presentation/mixins/single_image_picker_mixin.dart b/lib/presentation/mixins/single_image_picker_mixin.dart index fc63f04bf..447721fdd 100644 --- a/lib/presentation/mixins/single_image_picker_mixin.dart +++ b/lib/presentation/mixins/single_image_picker_mixin.dart @@ -1,3 +1,4 @@ +import 'package:fluffychat/presentation/mixins/media_picker_style.dart'; import 'package:fluffychat/resource/image_paths.dart'; import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; @@ -37,18 +38,20 @@ mixin SingleImagePickerMixin on CommonMediaPickerMixin { expandedWidget: const SizedBox(height: 50), counterImageBuilder: (_) => const SizedBox.shrink(), goToSettingsWidget: Column( + mainAxisAlignment: MainAxisAlignment.center, children: [ SvgPicture.asset( ImagePaths.icPhotosSettingPermission, - width: 40, - height: 40, + width: MediaPickerStyle.photoPermissionIconSize, + height: MediaPickerStyle.photoPermissionIconSize, ), Text( L10n.of(context)!.tapToAllowAccessToYourGallery, - style: Theme.of(context) - .textTheme - .titleSmall - ?.copyWith(color: LinagoraRefColors.material().neutral), + style: Theme.of(context).textTheme.titleSmall?.copyWith( + color: LinagoraRefColors.material().neutral, + fontWeight: MediaPickerStyle.photoPermissionFontWeight, + fontSize: MediaPickerStyle.photoPermissionFontSize, + ), textAlign: TextAlign.center, ), ],