diff --git a/lib/core/theme/theme_helper.dart b/lib/core/theme/theme_helper.dart index 3b2a063d..c0c0af29 100644 --- a/lib/core/theme/theme_helper.dart +++ b/lib/core/theme/theme_helper.dart @@ -202,6 +202,8 @@ class PrimaryColors { Color get darkGray => const Color(0XFFBBBCC0); Color get commentBg => const Color(0XFFFFFDD8); + + Color get cardNotificationsBG => const Color(0xFFA4A4A4); } PrimaryColors get appTheme => ThemeHelper().themeColor(); diff --git a/lib/features/menu/presentation/pages/notifications_settings_screen.dart b/lib/features/menu/presentation/pages/notifications_settings_screen.dart index 1c1065a3..e2afa516 100644 --- a/lib/features/menu/presentation/pages/notifications_settings_screen.dart +++ b/lib/features/menu/presentation/pages/notifications_settings_screen.dart @@ -3,9 +3,11 @@ import 'package:eatvio_app/core/theme/theme_helper.dart'; import 'package:eatvio_app/features/menu/models/notification_settings_model.dart'; import 'package:eatvio_app/features/menu/presentation/bloc/notification_settings_cubit/notification_settings_cubit.dart'; import 'package:eatvio_app/features/menu/presentation/bloc/notification_settings_cubit/notification_settings_state.dart'; +import 'package:eatvio_app/generated/l10n.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_svg/flutter_svg.dart'; class NotificationsSettingsScreen extends StatelessWidget { const NotificationsSettingsScreen({super.key}); @@ -21,8 +23,10 @@ class NotificationsSettingsContent extends StatelessWidget { @override Widget build(BuildContext context) { + final s = S.of(context); + return Scaffold( - appBar: AppBar(title: const Text('Уведомления')), + appBar: AppBar(title: Text(s.notifications)), body: BlocBuilder( builder: (context, state) { if (state is NotificationSettingsStateLoading) { @@ -58,7 +62,7 @@ class NotificationsSettingsContent extends StatelessWidget { _tile( padding: const EdgeInsets.symmetric(horizontal: 16), onTap: () {}, - title: 'Уведомление о новых обновлениях', + title: 'Новые обновления', subtitle: null, trailing: CupertinoSwitch( value: notificationSettings.newUpdatesNotification, @@ -72,7 +76,7 @@ class NotificationsSettingsContent extends StatelessWidget { _tile( padding: const EdgeInsets.symmetric(horizontal: 16), onTap: () {}, - title: 'Уведомления о взвешивании', + title: 'Напоминать о взвешивании', subtitle: null, trailing: CupertinoSwitch( value: notificationSettings.weightMeasurementsNotification, @@ -111,27 +115,29 @@ class NotificationsSettingsContent extends StatelessWidget { ), ), _divider(context), - const SizedBox(height: 16), _buildDiaryRemindersSection(context, notificationSettings.diaryReminderNotifications, cubit), ], ); } Widget _buildDiaryRemindersSection(BuildContext context, DiaryReminderNotifications diaryReminderNotifications, NotificationSettingsCubit cubit) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(16), - child: Text( - 'Напоминания о дневнике', - style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold, color: appTheme.blueA400), + return Padding( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Напоминание о заполнении дневника', + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: appTheme.cardNotificationsBG), ), - ), - _buildReminderTile(context, 'Первое напоминание', diaryReminderNotifications.firstReminder, 'first_reminder', cubit), - _buildReminderTile(context, 'Второе напоминание', diaryReminderNotifications.secondReminder, 'second_reminder', cubit), - _buildReminderTile(context, 'Третье напоминание', diaryReminderNotifications.thirdReminder, 'third_reminder', cubit), - ], + const SizedBox(height: 8), + _buildReminderTile(context, '№1 Напоминание о приеме пищи', diaryReminderNotifications.firstReminder, 'first_reminder', cubit), + const SizedBox(height: 8), + _buildReminderTile(context, '№2 Напоминание о приеме пищи', diaryReminderNotifications.secondReminder, 'second_reminder', cubit), + const SizedBox(height: 8), + _buildReminderTile(context, '№3 Напоминание о приеме пищи', diaryReminderNotifications.thirdReminder, 'third_reminder', cubit), + ], + ), ); } @@ -147,41 +153,58 @@ class NotificationsSettingsContent extends StatelessWidget { } Widget _buildReminderTile(BuildContext context, String title, ReminderSettings reminder, String reminderType, NotificationSettingsCubit cubit) { - return _tile( - padding: const EdgeInsets.symmetric(horizontal: 16), - onTap: reminder.enabled - ? () { - _showTimePicker(context, reminder, reminderType, cubit); - } - : null, - title: title, - subtitle: reminder.enabled - ? Row( - children: [ - Icon(Icons.access_time, size: 16, color: appTheme.blueA400), - const SizedBox(width: 8), - Text( - '${reminder.localTimeHours.toString().padLeft(2, '0')}:${reminder.localTimeMins.toString().padLeft(2, '0')}', - style: TextStyle(fontSize: 14, color: appTheme.blueA400, fontWeight: FontWeight.w500), - ), - const SizedBox(width: 4), - const Text('(нажмите для изменения)', style: TextStyle(fontSize: 12, color: Colors.grey)), - ], - ) - : null, - trailing: Row( - mainAxisSize: MainAxisSize.min, + return Container( + padding: const EdgeInsets.all(12), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: appTheme.dividerColor), + child: Column( children: [ - CupertinoSwitch( - value: reminder.enabled, - activeTrackColor: appTheme.blueA400, - onChanged: (newValue) { - _updateReminderSetting(cubit, reminderType, { - 'enabled': newValue, - 'local_time_hours': reminder.localTimeHours, - 'local_time_mins': reminder.localTimeMins, - }); - }, + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + reminderType == 'third_reminder' ? SvgPicture.asset('assets/icons/retire.svg') : SvgPicture.asset('assets/icons/wakeup.svg'), + const SizedBox(width: 8), + Text( + title, + style: const TextStyle(color: Color(0xFF323F4B), fontSize: 16, fontWeight: FontWeight.w500), + ), + ], + ), + const SizedBox(height: 8), + Row( + mainAxisSize: MainAxisSize.max, + children: [ + Expanded( + child: GestureDetector( + onTap: reminder.enabled + ? () { + _showTimePicker(context, reminder, reminderType, cubit); + } + : null, + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), + decoration: BoxDecoration(color: reminder.enabled ? Colors.white : Colors.white.withAlpha((255 * 0.7).toInt()), borderRadius: BorderRadius.circular(48)), + child: Center( + child: Text( + '${reminder.localTimeHours.toString().padLeft(2, '0')}:${reminder.localTimeMins.toString().padLeft(2, '0')}', + style: TextStyle(fontSize: 17, color: appTheme.gray, fontWeight: FontWeight.w500), + ), + ), + ), + ), + ), + const SizedBox(width: 8), + CupertinoSwitch( + value: reminder.enabled, + activeTrackColor: appTheme.blueA400, + onChanged: (newValue) { + _updateReminderSetting(cubit, reminderType, { + 'enabled': newValue, + 'local_time_hours': reminder.localTimeHours, + 'local_time_mins': reminder.localTimeMins, + }); + }, + ), + ], ), ], ), diff --git a/lib/generated/intl/messages_en.dart b/lib/generated/intl/messages_en.dart index 373b48eb..6403bc49 100644 --- a/lib/generated/intl/messages_en.dart +++ b/lib/generated/intl/messages_en.dart @@ -511,6 +511,7 @@ class MessageLookup extends MessageLookupByLibrary { "not_liked_groceries": MessageLookupByLibrary.simpleMessage( "Не любимые продукты", ), + "notifications": MessageLookupByLibrary.simpleMessage("Уведомления"), "ok": MessageLookupByLibrary.simpleMessage("Хорошо"), "one_option": MessageLookupByLibrary.simpleMessage("1 опция"), "option": MessageLookupByLibrary.simpleMessage("Опция"), diff --git a/lib/generated/intl/messages_ru.dart b/lib/generated/intl/messages_ru.dart index 82821c9a..b7db0a45 100644 --- a/lib/generated/intl/messages_ru.dart +++ b/lib/generated/intl/messages_ru.dart @@ -241,6 +241,7 @@ class MessageLookup extends MessageLookupByLibrary { ), "no": MessageLookupByLibrary.simpleMessage("Нет"), "no_account": MessageLookupByLibrary.simpleMessage("У меня нет аккаунта"), + "notifications": MessageLookupByLibrary.simpleMessage("Уведомления"), "one_option": MessageLookupByLibrary.simpleMessage("1 опция"), "option": MessageLookupByLibrary.simpleMessage("Опция"), "option_content": MessageLookupByLibrary.simpleMessage("Содержание опции"), diff --git a/lib/generated/l10n.dart b/lib/generated/l10n.dart index 25d71d68..105b40c7 100644 --- a/lib/generated/l10n.dart +++ b/lib/generated/l10n.dart @@ -28,10 +28,9 @@ class S { static const AppLocalizationDelegate delegate = AppLocalizationDelegate(); static Future load(Locale locale) { - final name = - (locale.countryCode?.isEmpty ?? false) - ? locale.languageCode - : locale.toString(); + final name = (locale.countryCode?.isEmpty ?? false) + ? locale.languageCode + : locale.toString(); final localeName = Intl.canonicalizedLocale(name); return initializeMessages(localeName).then((_) { Intl.defaultLocale = localeName; @@ -3469,6 +3468,16 @@ class S { args: [], ); } + + /// `Уведомления` + String get notifications { + return Intl.message( + 'Уведомления', + name: 'notifications', + desc: '', + args: [], + ); + } } class AppLocalizationDelegate extends LocalizationsDelegate { diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 7424fe87..c6898871 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -411,6 +411,7 @@ "itCantBeRecovered": "Его нельзя будет восстановить", "delete": "Удалить", "cannotDeleteAccount": "Не получилось удалить ваш аккаунт", - "resend": "Отправить повторно" + "resend": "Отправить повторно", + "notifications": "Уведомления" } diff --git a/lib/l10n/intl_ru.arb b/lib/l10n/intl_ru.arb index 221d36ff..b52f418f 100644 --- a/lib/l10n/intl_ru.arb +++ b/lib/l10n/intl_ru.arb @@ -213,5 +213,6 @@ "my_plans": "Мои планы", "from": "от", "user_data": "Данные пользователя", - "infoAboutOrder": "Информация о заказе" + "infoAboutOrder": "Информация о заказе", + "notifications": "Уведомления" }