mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-07-24 15:05:22 -04:00
More UI Cleanup
This commit is contained in:
parent
3b1cb53b8a
commit
68e8d7fd39
17 changed files with 281 additions and 301 deletions
|
@ -69,7 +69,7 @@ Widget buildSettingsPageNotificationPreferences(
|
|||
softWrap: false,
|
||||
style: textTheme.labelMedium,
|
||||
textAlign: TextAlign.center,
|
||||
)));
|
||||
).fit(fit: BoxFit.scaleDown)));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
@ -108,170 +108,147 @@ Widget buildSettingsPageNotificationPreferences(
|
|||
return out;
|
||||
}
|
||||
|
||||
return InputDecorator(
|
||||
decoration: InputDecoration(
|
||||
labelText: translate('settings_page.notifications'),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8 * scaleConfig.borderRadiusScale),
|
||||
borderSide: BorderSide(width: 2, color: scale.primaryScale.border),
|
||||
),
|
||||
),
|
||||
child: Column(mainAxisSize: MainAxisSize.min, children: [
|
||||
// Display Beta Warning
|
||||
StyledCheckbox(
|
||||
label: translate('settings_page.display_beta_warning'),
|
||||
value: notificationsPreference.displayBetaWarning,
|
||||
onChanged: (value) async {
|
||||
final newNotificationsPreference =
|
||||
notificationsPreference.copyWith(displayBetaWarning: value);
|
||||
|
||||
await updatePreferences(newNotificationsPreference);
|
||||
}),
|
||||
// Enable Badge
|
||||
StyledCheckbox(
|
||||
label: translate('settings_page.enable_badge'),
|
||||
value: notificationsPreference.enableBadge,
|
||||
onChanged: (value) async {
|
||||
final newNotificationsPreference =
|
||||
notificationsPreference.copyWith(enableBadge: value);
|
||||
await updatePreferences(newNotificationsPreference);
|
||||
}),
|
||||
// Enable Notifications
|
||||
StyledCheckbox(
|
||||
label: translate('settings_page.enable_notifications'),
|
||||
value: notificationsPreference.enableNotifications,
|
||||
onChanged: (value) async {
|
||||
final newNotificationsPreference =
|
||||
notificationsPreference.copyWith(enableNotifications: value);
|
||||
await updatePreferences(newNotificationsPreference);
|
||||
}),
|
||||
StyledDropdown<MessageNotificationContent>(
|
||||
items: messageNotificationContentItems(),
|
||||
value: notificationsPreference.messageNotificationContent,
|
||||
decoratorLabel: translate('settings_page.message_notification_content'),
|
||||
onChanged: !notificationsPreference.enableNotifications
|
||||
? null
|
||||
: (value) async {
|
||||
final newNotificationsPreference = notificationsPreference
|
||||
.copyWith(messageNotificationContent: value);
|
||||
await updatePreferences(newNotificationsPreference);
|
||||
},
|
||||
).paddingLTRB(0, 4.scaled(context), 0, 4.scaled(context)),
|
||||
|
||||
// Notifications
|
||||
Table(
|
||||
defaultVerticalAlignment: TableCellVerticalAlignment.middle,
|
||||
// Invitation accepted
|
||||
Widget notificationSettingsItem(
|
||||
{required String title,
|
||||
required bool notificationsEnabled,
|
||||
NotificationMode? deliveryValue,
|
||||
SoundEffect? soundValue,
|
||||
Future<void> Function(NotificationMode)? onNotificationModeChanged,
|
||||
Future<void> Function(SoundEffect)? onSoundChanged}) =>
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 8.scaled(context),
|
||||
children: [
|
||||
TableRow(children: [
|
||||
Text(translate('settings_page.event'),
|
||||
textAlign: TextAlign.center,
|
||||
style: textTheme.titleMedium!.copyWith(
|
||||
color: scale.primaryScale.border,
|
||||
decorationColor: scale.primaryScale.border,
|
||||
decoration: TextDecoration.underline))
|
||||
.paddingAll(8.scaled(context)),
|
||||
Text(translate('settings_page.delivery'),
|
||||
textAlign: TextAlign.center,
|
||||
style: textTheme.titleMedium!.copyWith(
|
||||
color: scale.primaryScale.border,
|
||||
decorationColor: scale.primaryScale.border,
|
||||
decoration: TextDecoration.underline))
|
||||
.paddingAll(8.scaled(context)),
|
||||
Text(translate('settings_page.sound'),
|
||||
textAlign: TextAlign.center,
|
||||
style: textTheme.titleMedium!.copyWith(
|
||||
color: scale.primaryScale.border,
|
||||
decorationColor: scale.primaryScale.border,
|
||||
decoration: TextDecoration.underline))
|
||||
.paddingAll(8.scaled(context)),
|
||||
]),
|
||||
TableRow(children: [
|
||||
// Invitation accepted
|
||||
Text(
|
||||
textAlign: TextAlign.right,
|
||||
translate('settings_page.invitation_accepted'))
|
||||
.paddingAll(4.scaled(context)),
|
||||
StyledDropdown<NotificationMode>(
|
||||
items: notificationModeItems(),
|
||||
value: notificationsPreference.onInvitationAcceptedMode,
|
||||
onChanged: !notificationsPreference.enableNotifications
|
||||
? null
|
||||
: (value) async {
|
||||
final newNotificationsPreference =
|
||||
notificationsPreference.copyWith(
|
||||
onInvitationAcceptedMode: value);
|
||||
await updatePreferences(newNotificationsPreference);
|
||||
},
|
||||
).paddingAll(4.scaled(context)),
|
||||
StyledDropdown<SoundEffect>(
|
||||
items: soundEffectItems(),
|
||||
value: notificationsPreference.onInvitationAcceptedSound,
|
||||
onChanged: !notificationsPreference.enableNotifications
|
||||
? null
|
||||
: (value) async {
|
||||
final newNotificationsPreference =
|
||||
notificationsPreference.copyWith(
|
||||
onInvitationAcceptedSound: value);
|
||||
await updatePreferences(newNotificationsPreference);
|
||||
},
|
||||
).paddingLTRB(
|
||||
4.scaled(context), 4.scaled(context), 0, 4.scaled(context))
|
||||
]),
|
||||
Text('$title:', style: textTheme.titleMedium),
|
||||
Wrap(
|
||||
spacing: 8.scaled(context), // gap between adjacent chips
|
||||
runSpacing: 8.scaled(context), // gap between lines
|
||||
children: [
|
||||
if (deliveryValue != null)
|
||||
IntrinsicWidth(
|
||||
child: StyledDropdown<NotificationMode>(
|
||||
decoratorLabel: translate('settings_page.delivery'),
|
||||
items: notificationModeItems(),
|
||||
value: deliveryValue,
|
||||
onChanged: !notificationsEnabled
|
||||
? null
|
||||
: onNotificationModeChanged,
|
||||
)),
|
||||
if (soundValue != null)
|
||||
IntrinsicWidth(
|
||||
child: StyledDropdown<SoundEffect>(
|
||||
decoratorLabel: translate('settings_page.sound'),
|
||||
items: soundEffectItems(),
|
||||
value: soundValue,
|
||||
onChanged: !notificationsEnabled ? null : onSoundChanged,
|
||||
))
|
||||
])
|
||||
]).paddingAll(4.scaled(context));
|
||||
|
||||
return InputDecorator(
|
||||
decoration: InputDecoration(
|
||||
labelText: translate('settings_page.notifications'),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius:
|
||||
BorderRadius.circular(8 * scaleConfig.borderRadiusScale),
|
||||
borderSide: BorderSide(width: 2, color: scale.primaryScale.border),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 8.scaled(context),
|
||||
children: [
|
||||
// Display Beta Warning
|
||||
StyledCheckbox(
|
||||
label: translate('settings_page.display_beta_warning'),
|
||||
value: notificationsPreference.displayBetaWarning,
|
||||
onChanged: (value) async {
|
||||
final newNotificationsPreference = notificationsPreference
|
||||
.copyWith(displayBetaWarning: value);
|
||||
|
||||
await updatePreferences(newNotificationsPreference);
|
||||
}),
|
||||
// Enable Badge
|
||||
StyledCheckbox(
|
||||
label: translate('settings_page.enable_badge'),
|
||||
value: notificationsPreference.enableBadge,
|
||||
onChanged: (value) async {
|
||||
final newNotificationsPreference =
|
||||
notificationsPreference.copyWith(enableBadge: value);
|
||||
await updatePreferences(newNotificationsPreference);
|
||||
}),
|
||||
// Enable Notifications
|
||||
StyledCheckbox(
|
||||
label: translate('settings_page.enable_notifications'),
|
||||
value: notificationsPreference.enableNotifications,
|
||||
onChanged: (value) async {
|
||||
final newNotificationsPreference = notificationsPreference
|
||||
.copyWith(enableNotifications: value);
|
||||
await updatePreferences(newNotificationsPreference);
|
||||
}),
|
||||
StyledDropdown<MessageNotificationContent>(
|
||||
items: messageNotificationContentItems(),
|
||||
value: notificationsPreference.messageNotificationContent,
|
||||
decoratorLabel:
|
||||
translate('settings_page.message_notification_content'),
|
||||
onChanged: !notificationsPreference.enableNotifications
|
||||
? null
|
||||
: (value) async {
|
||||
final newNotificationsPreference = notificationsPreference
|
||||
.copyWith(messageNotificationContent: value);
|
||||
await updatePreferences(newNotificationsPreference);
|
||||
},
|
||||
).paddingAll(4.scaled(context)),
|
||||
|
||||
// Notifications
|
||||
|
||||
// Invitation accepted
|
||||
notificationSettingsItem(
|
||||
title: translate('settings_page.invitation_accepted'),
|
||||
notificationsEnabled:
|
||||
notificationsPreference.enableNotifications,
|
||||
deliveryValue: notificationsPreference.onInvitationAcceptedMode,
|
||||
soundValue: notificationsPreference.onInvitationAcceptedSound,
|
||||
onNotificationModeChanged: (value) async {
|
||||
final newNotificationsPreference = notificationsPreference
|
||||
.copyWith(onInvitationAcceptedMode: value);
|
||||
await updatePreferences(newNotificationsPreference);
|
||||
},
|
||||
onSoundChanged: (value) async {
|
||||
final newNotificationsPreference = notificationsPreference
|
||||
.copyWith(onInvitationAcceptedSound: value);
|
||||
await updatePreferences(newNotificationsPreference);
|
||||
}),
|
||||
|
||||
// Message received
|
||||
TableRow(children: [
|
||||
Text(
|
||||
textAlign: TextAlign.right,
|
||||
translate('settings_page.message_received'))
|
||||
.paddingAll(4.scaled(context)),
|
||||
StyledDropdown<NotificationMode>(
|
||||
items: notificationModeItems(),
|
||||
value: notificationsPreference.onMessageReceivedMode,
|
||||
onChanged: !notificationsPreference.enableNotifications
|
||||
? null
|
||||
: (value) async {
|
||||
final newNotificationsPreference =
|
||||
notificationsPreference.copyWith(
|
||||
onMessageReceivedMode: value);
|
||||
await updatePreferences(newNotificationsPreference);
|
||||
},
|
||||
).paddingAll(4),
|
||||
StyledDropdown<SoundEffect>(
|
||||
items: soundEffectItems(),
|
||||
value: notificationsPreference.onMessageReceivedSound,
|
||||
onChanged: !notificationsPreference.enableNotifications
|
||||
? null
|
||||
: (value) async {
|
||||
final newNotificationsPreference =
|
||||
notificationsPreference.copyWith(
|
||||
onMessageReceivedSound: value);
|
||||
await updatePreferences(newNotificationsPreference);
|
||||
},
|
||||
).paddingLTRB(
|
||||
4.scaled(context), 4.scaled(context), 0, 4.scaled(context))
|
||||
]),
|
||||
notificationSettingsItem(
|
||||
title: translate('settings_page.message_received'),
|
||||
notificationsEnabled:
|
||||
notificationsPreference.enableNotifications,
|
||||
deliveryValue: notificationsPreference.onMessageReceivedMode,
|
||||
soundValue: notificationsPreference.onMessageReceivedSound,
|
||||
onNotificationModeChanged: (value) async {
|
||||
final newNotificationsPreference = notificationsPreference
|
||||
.copyWith(onMessageReceivedMode: value);
|
||||
await updatePreferences(newNotificationsPreference);
|
||||
},
|
||||
onSoundChanged: (value) async {
|
||||
final newNotificationsPreference = notificationsPreference
|
||||
.copyWith(onMessageReceivedSound: value);
|
||||
await updatePreferences(newNotificationsPreference);
|
||||
}),
|
||||
|
||||
// Message sent
|
||||
TableRow(children: [
|
||||
Text(
|
||||
textAlign: TextAlign.right,
|
||||
translate('settings_page.message_sent'))
|
||||
.paddingAll(4.scaled(context)),
|
||||
const SizedBox.shrink(),
|
||||
StyledDropdown<SoundEffect>(
|
||||
items: soundEffectItems(),
|
||||
value: notificationsPreference.onMessageSentSound,
|
||||
onChanged: !notificationsPreference.enableNotifications
|
||||
? null
|
||||
: (value) async {
|
||||
final newNotificationsPreference =
|
||||
notificationsPreference.copyWith(
|
||||
onMessageSentSound: value);
|
||||
await updatePreferences(newNotificationsPreference);
|
||||
},
|
||||
).paddingLTRB(
|
||||
4.scaled(context), 4.scaled(context), 0, 4.scaled(context))
|
||||
]),
|
||||
])
|
||||
]).paddingAll(8.scaled(context)),
|
||||
);
|
||||
notificationSettingsItem(
|
||||
title: translate('settings_page.message_sent'),
|
||||
notificationsEnabled:
|
||||
notificationsPreference.enableNotifications,
|
||||
soundValue: notificationsPreference.onMessageSentSound,
|
||||
onSoundChanged: (value) async {
|
||||
final newNotificationsPreference = notificationsPreference
|
||||
.copyWith(onMessageSentSound: value);
|
||||
await updatePreferences(newNotificationsPreference);
|
||||
}),
|
||||
]).paddingAll(4.scaled(context)));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue