Adds SMS processing settings

Adds a popup menu to SMS messages to allow access to processing settings.

This commit introduces the "Processing settings" option within a context menu
that appears when an SMS message is tapped. This prepares the UI for future
implementation of SMS processing configuration.
This commit is contained in:
2025-07-12 23:53:50 +03:00
parent 85daede4a9
commit c23a3db59d
6 changed files with 52 additions and 7 deletions
+2 -1
View File
@@ -51,5 +51,6 @@
"addTag": "Add tag",
"editTag": "Edit tag",
"loadSmsMessages": "Load SMS Messages",
"loadSmsMessagesDescription": "Load and process SMS messages to automatically create transactions"
"loadSmsMessagesDescription": "Load and process SMS messages to automatically create transactions",
"smsSettings": "Processing settings"
}
+6
View File
@@ -409,6 +409,12 @@ abstract class AppLocalizations {
/// In en, this message translates to:
/// **'Load and process SMS messages to automatically create transactions'**
String get loadSmsMessagesDescription;
/// No description provided for @smsSettings.
///
/// In en, this message translates to:
/// **'Processing settings'**
String get smsSettings;
}
class _AppLocalizationsDelegate
+3
View File
@@ -166,4 +166,7 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get loadSmsMessagesDescription =>
'Load and process SMS messages to automatically create transactions';
@override
String get smsSettings => 'Processing settings';
}
+3
View File
@@ -169,4 +169,7 @@ class AppLocalizationsRu extends AppLocalizations {
@override
String get loadSmsMessagesDescription =>
'Загрузить и обработать SMS-сообщения для автоматического создания транзакций';
@override
String get smsSettings => 'Настройка обработки';
}
+2 -1
View File
@@ -51,5 +51,6 @@
"addTag": "Добавить тег",
"editTag": "Редактировать тег",
"loadSmsMessages": "Загрузить SMS",
"loadSmsMessagesDescription": "Загрузить и обработать SMS-сообщения для автоматического создания транзакций"
"loadSmsMessagesDescription": "Загрузить и обработать SMS-сообщения для автоматического создания транзакций",
"smsSettings": "Настройка обработки"
}
+36 -5
View File
@@ -1,19 +1,50 @@
import 'package:budget_app/l10n/app_localizations.dart';
import 'package:budget_app/models/sms_message.dart';
import 'package:flutter/material.dart';
/// Виджет для отображения одного SMS сообщения.
///
/// При нажатии на виджет появляется контекстное меню.
class SmsMessageWidget extends StatelessWidget {
final SmsMessage message;
const SmsMessageWidget({super.key, required this.message});
// Функция для отображения всплывающего меню.
//
// [context] - Контекст сборки.
// [details] - Детали о событии нажатия.
void _showPopupMenu(BuildContext context, TapDownDetails details) {
final RenderBox overlay =
Overlay.of(context).context.findRenderObject() as RenderBox;
showMenu(
context: context,
position: RelativeRect.fromRect(
details.globalPosition & const Size(40, 40), // Размер области нажатия
Offset.zero & overlay.size,
),
items: [
PopupMenuItem(
child: Text(AppLocalizations.of(context)!.smsSettings),
onTap: () {
// TODO: Реализовать переход к настройкам обработки SMS
},
),
],
);
}
@override
Widget build(BuildContext context) {
return Card(
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Text(message.body ?? ''),
// Оборачиваем Card в GestureDetector для отслеживания нажатий.
return GestureDetector(
onTapDown: (details) => _showPopupMenu(context, details),
child: Card(
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Text(message.body ?? ''),
),
),
);
}