Skip to content
Open
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
4 changes: 2 additions & 2 deletions app/lib/desktop/pages/settings/desktop_profile_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ class _DesktopProfilePageState extends State<DesktopProfilePage> with TickerProv
children: [
OmiSettingsTile(
title: SharedPreferencesUtil().givenName.isEmpty ? context.l10n.setYourName : context.l10n.changeYourName,
subtitle: SharedPreferencesUtil().givenName.isEmpty ? context.l10n.notSet : SharedPreferencesUtil().givenName,
value: SharedPreferencesUtil().givenName.isEmpty ? context.l10n.notSet : SharedPreferencesUtil().givenName,
icon: FontAwesomeIcons.user,
onTap: () async {
MixpanelManager().pageOpened('Profile Change Name');
Expand All @@ -317,7 +317,7 @@ class _DesktopProfilePageState extends State<DesktopProfilePage> with TickerProv

return OmiSettingsTile(
title: context.l10n.primaryLanguage,
subtitle: languageName,
value: languageName,
icon: FontAwesomeIcons.language,
onTap: () async {
MixpanelManager().pageOpened('Profile Change Language');
Expand Down
32 changes: 26 additions & 6 deletions app/lib/desktop/pages/settings/desktop_settings_modal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ class _DesktopSettingsModalState extends State<DesktopSettingsModal> {
children: [
_buildSettingsRow(
title: context.l10n.name,
subtitle:
value:
SharedPreferencesUtil().givenName.isEmpty ? context.l10n.notSet : SharedPreferencesUtil().givenName,
onTap: () async {
MixpanelManager().pageOpened('Profile Change Name');
Expand All @@ -654,7 +654,7 @@ class _DesktopSettingsModalState extends State<DesktopSettingsModal> {
),
_buildSettingsRow(
title: context.l10n.email,
subtitle: SharedPreferencesUtil().email.isEmpty ? context.l10n.notSet : SharedPreferencesUtil().email,
value: SharedPreferencesUtil().email.isEmpty ? context.l10n.notSet : SharedPreferencesUtil().email,
onTap: () {},
showChevron: false,
),
Expand All @@ -670,7 +670,7 @@ class _DesktopSettingsModalState extends State<DesktopSettingsModal> {

return _buildSettingsRow(
title: context.l10n.language,
subtitle: languageName,
value: languageName,
onTap: () async {
MixpanelManager().pageOpened('Profile Change Language');
await LanguageSelectionDialog.show(context, isRequired: false, forceShow: true);
Expand Down Expand Up @@ -752,7 +752,7 @@ class _DesktopSettingsModalState extends State<DesktopSettingsModal> {
uid.length > 6 ? '${uid.substring(0, 3)}•••••${uid.substring(uid.length - 3)}' : uid;
return _buildSettingsRow(
title: context.l10n.userId,
subtitle: truncatedUid,
value: truncatedUid,
onTap: () {
Clipboard.setData(ClipboardData(text: uid));
ScaffoldMessenger.of(context).showSnackBar(
Expand Down Expand Up @@ -2341,7 +2341,7 @@ class _DesktopSettingsModalState extends State<DesktopSettingsModal> {
children: [
_buildSettingsRow(
title: context.l10n.userId,
subtitle: SharedPreferencesUtil().uid,
value: SharedPreferencesUtil().uid,
trailing: OmiIconButton(
icon: FontAwesomeIcons.copy,
style: OmiIconButtonStyle.neutral,
Expand Down Expand Up @@ -2418,6 +2418,7 @@ class _DesktopSettingsModalState extends State<DesktopSettingsModal> {
Widget _buildSettingsRow({
required String title,
String? subtitle,
String? value,
Widget? trailing,
VoidCallback? onTap,
bool isDestructive = false,
Expand Down Expand Up @@ -2458,7 +2459,26 @@ class _DesktopSettingsModalState extends State<DesktopSettingsModal> {
],
),
),
if (trailing != null) trailing,
if (value != null) ...[
Container(
constraints: const BoxConstraints(maxWidth: 200),
child: Text(
value,
style: const TextStyle(
fontSize: 14,
color: ResponsiveHelper.textSecondary,
),
overflow: TextOverflow.ellipsis,
maxLines: 1,
textAlign: TextAlign.end,
),
),
if (trailing == null && showChevron) const SizedBox(width: 8),
],
if (trailing != null) ...[
if (value != null) const SizedBox(width: 8),
trailing,
],
if (onTap != null && trailing == null && showChevron)
const Icon(
FontAwesomeIcons.chevronRight,
Expand Down
55 changes: 38 additions & 17 deletions app/lib/ui/atoms/omi_settings_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import 'package:omi/utils/responsive/responsive_helper.dart';

class OmiSettingsTile extends AdaptiveWidget {
final String title;
final String subtitle;
final String? subtitle;
final String? value;
final IconData icon;
final VoidCallback onTap;
final Color? iconColor;
Expand All @@ -18,7 +19,8 @@ class OmiSettingsTile extends AdaptiveWidget {
const OmiSettingsTile({
super.key,
required this.title,
required this.subtitle,
this.subtitle,
this.value,
required this.icon,
required this.onTap,
this.iconColor,
Expand Down Expand Up @@ -78,26 +80,45 @@ class OmiSettingsTile extends AdaptiveWidget {
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 4),
Text(
subtitle,
style: const TextStyle(
color: ResponsiveHelper.textTertiary,
fontSize: 13,
if (subtitle != null) ...[
const SizedBox(height: 4),
Text(
subtitle!,
style: const TextStyle(
color: ResponsiveHelper.textTertiary,
fontSize: 13,
),
),
),
],
],
),
),
const SizedBox(width: 16),
trailing ??
(showArrow
? const Icon(
FontAwesomeIcons.chevronRight,
size: 12,
color: ResponsiveHelper.textTertiary,
)
: const SizedBox.shrink()),
if (value != null)
Container(
constraints: const BoxConstraints(maxWidth: 200),
child: Text(
value!,
style: const TextStyle(
color: ResponsiveHelper.textTertiary,
fontSize: 14,
),
overflow: TextOverflow.ellipsis,
maxLines: 1,
textAlign: TextAlign.end,
),
),
if (trailing != null) ...[
if (value != null) const SizedBox(width: 16),
trailing!,
] else if (showArrow) ...[
if (value != null) const SizedBox(width: 16),
const Icon(
FontAwesomeIcons.chevronRight,
size: 12,
color: ResponsiveHelper.textTertiary,
),
],
],
),
),
Expand Down