Change transaction create
This commit is contained in:
@@ -153,7 +153,7 @@ Future<void> initUserSpecificDependencies(String userId) async {
|
||||
if (getIt.isRegistered<SmsCubit>()) {
|
||||
await getIt.unregister<SmsCubit>();
|
||||
}
|
||||
getIt.registerFactory<SmsCubit>(() => SmsCubit(
|
||||
getIt.registerSingleton<SmsCubit>(SmsCubit(
|
||||
getIt<SmsService>(),
|
||||
getIt<ISmsMessageRepository>(),
|
||||
getIt<UserCubit>(),
|
||||
@@ -166,22 +166,22 @@ Future<void> initUserSpecificDependencies(String userId) async {
|
||||
if (getIt.isRegistered<CategoryCubit>()) {
|
||||
await getIt.unregister<CategoryCubit>();
|
||||
}
|
||||
getIt.registerFactory<CategoryCubit>(
|
||||
() => CategoryCubit(getIt()),
|
||||
getIt.registerSingleton<CategoryCubit>(
|
||||
CategoryCubit(getIt()),
|
||||
);
|
||||
|
||||
// Теги
|
||||
if (getIt.isRegistered<TagCubit>()) {
|
||||
await getIt.unregister<TagCubit>();
|
||||
}
|
||||
getIt.registerFactory<TagCubit>(() => TagCubit(getIt()));
|
||||
getIt.registerSingleton<TagCubit>(TagCubit(getIt()));
|
||||
|
||||
// Настройки обработки SMS
|
||||
if (getIt.isRegistered<SmsSettingsCubit>()) {
|
||||
await getIt.unregister<SmsSettingsCubit>();
|
||||
}
|
||||
getIt.registerFactory<SmsSettingsCubit>(
|
||||
() => SmsSettingsCubit(
|
||||
getIt.registerSingleton<SmsSettingsCubit>(
|
||||
SmsSettingsCubit(
|
||||
getIt<ISmsHandlerRepository>(),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -4,7 +4,7 @@ import 'package:budget_app/data/repositories/interfaces/isms_handler_repository.
|
||||
import 'package:budget_app/logic/transaction/transaction_bloc.dart';
|
||||
import 'package:budget_app/models/sms_handler_settings.dart';
|
||||
import 'package:budget_app/services/custom_sms_functions.dart';
|
||||
import 'package:budget_app/models/transaction_record.dart';
|
||||
|
||||
import 'package:budget_app/services/sms_service.dart';
|
||||
import 'package:budget_app/logic/user/user_cubit.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
@@ -31,8 +31,8 @@ class SmsLoaded extends SmsState {
|
||||
this.currentPage = 1,
|
||||
this.statusFilter,
|
||||
this.monthFilter,
|
||||
DateTime? selectedMonth,
|
||||
}) : super(selectedMonth: selectedMonth);
|
||||
super.selectedMonth,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object> get props => [messages, hasMore, currentPage, statusFilter ?? '', monthFilter ?? ''];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
import 'package:budget_app/services/custom_sms_functions.dart';
|
||||
|
||||
import 'package:hive_ce/hive.dart';
|
||||
|
||||
import '/utils/id_generator.dart';
|
||||
|
||||
@@ -29,7 +29,7 @@ class CategoryListItem extends StatelessWidget {
|
||||
children: [
|
||||
// Аватар категории
|
||||
CircleAvatar(
|
||||
backgroundColor: category.color.withOpacity(0.2),
|
||||
backgroundColor: category.color.withAlpha(51),
|
||||
radius: 24,
|
||||
child: Icon(
|
||||
category.icon,
|
||||
|
||||
@@ -66,8 +66,9 @@ class _HomePageState extends State<HomePage> {
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
builder: (BuildContext context) {
|
||||
return const AddTransactionDialog();
|
||||
},
|
||||
|
||||
@@ -201,7 +201,7 @@ class _SummaryWidgetState extends State<SummaryWidget> {
|
||||
Text(
|
||||
_formatMonth(context, month),
|
||||
style: theme.textTheme.titleMedium?.copyWith(
|
||||
color: theme.colorScheme.onSurface.withOpacity(0.7),
|
||||
color: theme.colorScheme.onSurface.withAlpha(178),
|
||||
),
|
||||
),
|
||||
// Удаление: Индикатор перенесен из страницы.
|
||||
|
||||
@@ -18,87 +18,90 @@ class TransactionItem extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final localizations = AppLocalizations.of(context)!;
|
||||
final theme = Theme.of(context);
|
||||
final formattedDate = DateFormat.yMMMd(localizations.localeName).format(transaction.dateTime);
|
||||
final formattedDate = DateFormat.yMMMd(
|
||||
localizations.localeName,
|
||||
).format(transaction.dateTime);
|
||||
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Future.delayed(const Duration(milliseconds: 100), () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AddTransactionDialog(transaction: transaction),
|
||||
);
|
||||
});
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AddTransactionDialog(transaction: transaction),
|
||||
);
|
||||
},
|
||||
highlightColor: Theme.of(context).primaryColor.withOpacity(0.1),
|
||||
splashColor: Theme.of(context).primaryColor.withOpacity(0.2),
|
||||
highlightColor: Theme.of(context).primaryColor.withAlpha(26),
|
||||
splashColor: Theme.of(context).primaryColor.withAlpha(51),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
radius: 300,
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 8.0,
|
||||
horizontal: 16.0,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
transaction.vendor,
|
||||
style: theme.textTheme.titleSmall?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'${transaction.isIncome ? '+' : '-'}${transaction.amount.abs().toStringAsFixed(2)} ${transaction.currency}',
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
transaction.vendor,
|
||||
style: theme.textTheme.titleSmall?.copyWith(
|
||||
color: transaction.isIncome
|
||||
? theme.colorScheme.primary
|
||||
: theme.colorScheme.error,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8.0),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
transaction.category.icon,
|
||||
color: transaction.category.color,
|
||||
size: 20.0,
|
||||
),
|
||||
Text(
|
||||
'${transaction.isIncome ? '+' : '-'}${transaction.amount.abs().toStringAsFixed(2)} ${transaction.currency}',
|
||||
style: theme.textTheme.titleSmall?.copyWith(
|
||||
color: transaction.isIncome
|
||||
? theme.colorScheme.primary
|
||||
: theme.colorScheme.error,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
const SizedBox(width: 8.0),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8.0),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
transaction.category.icon,
|
||||
color: transaction.category.color,
|
||||
size: 20.0,
|
||||
),
|
||||
const SizedBox(width: 8.0),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
transaction.category.name,
|
||||
style: theme.textTheme.bodySmall,
|
||||
),
|
||||
if (transaction.tag != null)
|
||||
Text(
|
||||
transaction.category.name,
|
||||
style: theme.textTheme.bodySmall,
|
||||
),
|
||||
if (transaction.tag != null)
|
||||
Text(
|
||||
'#${transaction.tag!.name}',
|
||||
style: theme.textTheme.bodySmall?.copyWith(
|
||||
color: theme.colorScheme.onSurface.withOpacity(0.6),
|
||||
),
|
||||
'#${transaction.tag!.name}',
|
||||
style: theme.textTheme.bodySmall?.copyWith(
|
||||
color: theme.colorScheme.onSurface.withAlpha(153),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
formattedDate,
|
||||
style: theme.textTheme.bodySmall?.copyWith(
|
||||
color: theme.colorScheme.onSurface.withOpacity(0.5),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
formattedDate,
|
||||
style: theme.textTheme.bodySmall?.copyWith(
|
||||
color: theme.colorScheme.onSurface.withAlpha(128),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const Divider(height: 1, thickness: 1, indent: 16, endIndent: 16),
|
||||
|
||||
Reference in New Issue
Block a user