Skip to content

Commit

Permalink
TW-2085 Change texts in settings screen
Browse files Browse the repository at this point in the history
  • Loading branch information
KhaledNjim committed Oct 15, 2024
1 parent 01efcc1 commit de3ffe1
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 120 deletions.
23 changes: 3 additions & 20 deletions assets/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -1350,11 +1350,6 @@
"type": "text",
"placeholders": {}
},
"notificationsEnabledForThisAccount": "Notifications enabled for this account",
"@notificationsEnabledForThisAccount": {
"type": "text",
"placeholders": {}
},
"numUsersTyping": "{count} users are typing",
"@numUsersTyping": {
"type": "text",
Expand Down Expand Up @@ -2847,20 +2842,6 @@
"@appLanguage": {},
"chatFolders": "Chat Folders",
"@chatFolders": {},
"settingsChatSubtitle": "Appearance, themes, wallpaper, chat history.",
"@settingsChatSubtitle": {},
"settingsPrivacyAndSecuritySubtitle": "Block contacts, disappearing messages.",
"@settingsPrivacyAndSecuritySubtitle": {},
"settingsNotificationAndSoundsSubtitle": "Custom how you get notifications from Twake such as previewing messages, sounds, time,...",
"@settingsNotificationAndSoundsSubtitle": {},
"settingsChatFoldersSubtitle": "Create and manage folders for different groups of chats and quickly switch between them.",
"@settingsChatFoldersSubtitle": {},
"settingsAppLanguageSubtitle": "Choose in which language you want to use Twake Chat.",
"@settingsAppLanguageSubtitle": {},
"settingsDevicesSubtitle": "Control your sign in and sign out on any device.",
"@settingsDevicesSubtitle": {},
"settingsHelpSubtitle": "Help center, contact us, privacy policy.",
"@settingsHelpSubtitle": {},
"displayName": "Display Name",
"@displayName": {},
"bio": "Bio (optional)",
Expand Down Expand Up @@ -3112,5 +3093,7 @@
"type": "int"
}
}
}
},
"enable_notifications":"Enable notifications",
"disable_notifications":"Disable notifications"
}
105 changes: 45 additions & 60 deletions lib/pages/settings_dashboard/settings/settings_item_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:linagora_design_flutter/linagora_design_flutter.dart';

class SettingsItemBuilder extends StatelessWidget {
final String title;
final String subtitle;
final IconData leading;
final VoidCallback onTap;
final bool isHideTrailingIcon;
Expand All @@ -13,7 +12,6 @@ class SettingsItemBuilder extends StatelessWidget {
const SettingsItemBuilder({
super.key,
required this.title,
required this.subtitle,
required this.leading,
required this.onTap,
this.isHideTrailingIcon = false,
Expand All @@ -30,74 +28,61 @@ class SettingsItemBuilder extends StatelessWidget {
: LinagoraSysColors.material().onPrimary,
child: InkWell(
onTap: onTap,
child: Padding(
padding: SettingsViewStyle.itemBuilderPadding,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: SettingsViewStyle.leadingItemBuilderPadding,
child: Icon(
leading,
size: SettingsViewStyle.iconSize,
color: isHideTrailingIcon
? Theme.of(context).colorScheme.error
: LinagoraRefColors.material().tertiary[30],
child: SizedBox(
height: SettingsViewStyle.settingsItemHeight,
child: Padding(
padding: SettingsViewStyle.itemBuilderPadding,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: SettingsViewStyle.leadingItemBuilderPadding,
child: Icon(
leading,
size: SettingsViewStyle.iconSize,
color: isHideTrailingIcon
? Theme.of(context).colorScheme.error
: LinagoraRefColors.material().tertiary[30],
),
),
),
Expanded(
child: Row(
crossAxisAlignment: subtitle.isEmpty
? CrossAxisAlignment.start
: CrossAxisAlignment.center,
children: [
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: Theme.of(context)
.textTheme
.titleMedium
?.copyWith(
color: isHideTrailingIcon
? Theme.of(context).colorScheme.error
: Theme.of(context).colorScheme.onSurface,
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
Padding(
padding:
SettingsViewStyle.subtitleItemBuilderPadding,
child: Text(
subtitle,
Expanded(
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: Theme.of(context)
.textTheme
.bodySmall
.titleMedium
?.copyWith(
color: LinagoraRefColors.material()
.neutral[40],
color: isHideTrailingIcon
? Theme.of(context).colorScheme.error
: Theme.of(context)
.colorScheme
.onSurface,
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
),
],
],
),
),
),
if (!isHideTrailingIcon)
Icon(
Icons.chevron_right_outlined,
size: SettingsViewStyle.iconSize,
color: LinagoraRefColors.material().tertiary[30],
),
],
if (!isHideTrailingIcon)
Icon(
Icons.chevron_right_outlined,
size: SettingsViewStyle.iconSize,
color: LinagoraRefColors.material().tertiary[30],
),
],
),
),
),
],
],
),
),
),
),
Expand Down
1 change: 0 additions & 1 deletion lib/pages/settings_dashboard/settings/settings_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ class SettingsView extends StatelessWidget {
padding: SettingsViewStyle.bodySettingsScreenPadding,
child: SettingsItemBuilder(
title: item.titleSettings(context),
subtitle: item.subtitleSettings(context),
leading: item.iconLeading(),
onTap: () => controller.onClickToSettingsItem(item),
isHideTrailingIcon: item.isHideTrailingIcon,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,5 @@ class SettingsViewStyle {
right: responsiveUtils.isMobile(context) ? 0 : 16.0,
);
static const double titleLineHeightMobile = 24 / 17;
static const double settingsItemHeight = 80;
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ class SettingsAppLanguageView extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
L10n.of(context)!.settingsLanguageDescription,
style: Theme.of(context).textTheme.bodyMedium,
),
ListView.separated(
padding: SettingsAppLanguageViewStyle.paddingListItems,
shrinkWrap: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ import 'package:fluffychat/utils/dialog/twake_dialog.dart';
import 'package:fluffychat/utils/localized_exception_extension.dart';
import 'package:fluffychat/widgets/matrix.dart';
import 'package:flutter/material.dart';

import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:linagora_design_flutter/linagora_design_flutter.dart';

import 'package:matrix/matrix.dart';

import 'package:fluffychat/widgets/layouts/max_width_body.dart';
import 'settings_notifications.dart';

Expand Down Expand Up @@ -39,7 +37,9 @@ class SettingsNotificationsView extends StatelessWidget {
SwitchListTile.adaptive(
value: !Matrix.of(context).client.allPushNotificationsMuted,
title: Text(
L10n.of(context)!.notificationsEnabledForThisAccount,
Matrix.of(context).client.allPushNotificationsMuted
? L10n.of(context)!.enable_notifications
: L10n.of(context)!.disable_notifications,
),
onChanged: (_) =>
TwakeDialog.showFutureLoadingDialogFullScreen(
Expand All @@ -55,9 +55,8 @@ class SettingsNotificationsView extends StatelessWidget {
ListTile(
title: Text(
L10n.of(context)!.pushRules,
style: TextStyle(
color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold,
style: ListItemStyle.titleTextStyle(
fontFamily: GoogleFonts.inter().fontFamily ?? 'Inter',
),
),
),
Expand All @@ -73,9 +72,8 @@ class SettingsNotificationsView extends StatelessWidget {
ListTile(
title: Text(
L10n.of(context)!.devices,
style: TextStyle(
color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold,
style: ListItemStyle.titleTextStyle(
fontFamily: GoogleFonts.inter().fontFamily ?? 'Inter',
),
),
),
Expand Down
23 changes: 1 addition & 22 deletions lib/presentation/enum/settings/settings_enum.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ enum SettingEnum {
case SettingEnum.privacyAndSecurity:
return L10n.of(context)!.privacyAndSecurity;
case SettingEnum.notificationAndSounds:
return L10n.of(context)!.notificationAndSounds;
return L10n.of(context)!.notifications;
case SettingEnum.chatFolders:
return L10n.of(context)!.chatFolders;
case SettingEnum.appLanguage:
Expand All @@ -38,27 +38,6 @@ enum SettingEnum {
}
}

String subtitleSettings(BuildContext context) {
switch (this) {
case SettingEnum.chatSettings:
return L10n.of(context)!.settingsChatSubtitle;
case SettingEnum.privacyAndSecurity:
return L10n.of(context)!.settingsPrivacyAndSecuritySubtitle;
case SettingEnum.notificationAndSounds:
return L10n.of(context)!.settingsNotificationAndSoundsSubtitle;
case SettingEnum.chatFolders:
return L10n.of(context)!.settingsChatFoldersSubtitle;
case SettingEnum.appLanguage:
return L10n.of(context)!.settingsAppLanguageSubtitle;
case SettingEnum.devices:
return L10n.of(context)!.settingsDevicesSubtitle;
case SettingEnum.help:
return L10n.of(context)!.settingsHelpSubtitle;
default:
return '';
}
}

IconData iconLeading() {
switch (this) {
case SettingEnum.chatSettings:
Expand Down
9 changes: 6 additions & 3 deletions lib/widgets/twake_components/twake_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,12 @@ class _TwakeHeaderState extends State<TwakeHeader>
: TwakeHeaderStyle.paddingTitleHeader,
child: Text(
L10n.of(context)!.chats,
style: Theme.of(context).textTheme.titleLarge?.copyWith(
color: Theme.of(context).colorScheme.onSurface,
),
style: responsive.isMobile(context)
? LinagoraTextStyle.material().bodyLarge1.copyWith(
color: Theme.of(context).colorScheme.onSurface,
height: TwakeHeaderStyle.titleLineHeightMobile,
)
: Theme.of(context).textTheme.headlineSmall,
),
),
] else ...[
Expand Down
1 change: 1 addition & 0 deletions lib/widgets/twake_components/twake_header_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class TwakeHeaderStyle {
static const int flexTitle = 6;
static const int flexActions = 3;
static const double avatarSize = 36;
static const double titleLineHeightMobile = 24 / 17;

static double get avatarFontSizeInAppBar => 14.0;
static const double avatarOfMultipleAccountSize = 48.0;
Expand Down

0 comments on commit de3ffe1

Please sign in to comment.