diff --git a/.idea/caches/deviceStreaming.xml b/.idea/caches/deviceStreaming.xml
index 22baa42..1e61a6b 100644
--- a/.idea/caches/deviceStreaming.xml
+++ b/.idea/caches/deviceStreaming.xml
@@ -428,6 +428,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.idea/libraries/Dart_Packages.xml b/.idea/libraries/Dart_Packages.xml
index e1ae06e..b1a0f01 100644
--- a/.idea/libraries/Dart_Packages.xml
+++ b/.idea/libraries/Dart_Packages.xml
@@ -12,7 +12,7 @@
-
+
@@ -247,6 +247,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -271,7 +285,7 @@
-
+
@@ -478,6 +492,55 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -621,7 +684,7 @@
-
+
@@ -652,8 +715,9 @@
+
-
+
@@ -685,10 +749,11 @@
+
-
+
@@ -718,6 +783,13 @@
+
+
+
+
+
+
+
@@ -737,7 +809,7 @@
-
+
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 639900d..7134f8d 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/finance_app/android/build.gradle.kts b/finance_app/android/build.gradle.kts
index 89176ef..45317db 100644
--- a/finance_app/android/build.gradle.kts
+++ b/finance_app/android/build.gradle.kts
@@ -19,3 +19,4 @@ subprojects {
tasks.register("clean") {
delete(rootProject.layout.buildDirectory)
}
+
diff --git a/finance_app/lib/auth/telegram_auth.dart b/finance_app/lib/auth/telegram_auth.dart
index 33bb643..d149183 100644
--- a/finance_app/lib/auth/telegram_auth.dart
+++ b/finance_app/lib/auth/telegram_auth.dart
@@ -1,8 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_web_auth/flutter_web_auth.dart'; // Для аутентификации через веб
import 'package:shared_preferences/shared_preferences.dart'; // Импортируем для работы с локальным хранилищем
-import 'package:shared_preferences/shared_preferences.dart'; // Импортируем для работы с локальным хранилищем
-import 'package:flutter_web_auth/flutter_web_auth.dart'; // Для аутентификации через веб
import 'package:http/http.dart' as http; // Для HTTP запросов
import 'dart:convert'; // Для работы с JSON
diff --git a/finance_app/lib/database/database.g.dart b/finance_app/lib/database/database.g.dart
index 223db59..a516700 100644
--- a/finance_app/lib/database/database.g.dart
+++ b/finance_app/lib/database/database.g.dart
@@ -41,6 +41,15 @@ class $CategoriesTable extends Categories
type: DriftSqlType.string,
requiredDuringInsert: true,
);
+ static const VerificationMeta _userIdMeta = const VerificationMeta('userId');
+ @override
+ late final GeneratedColumn userId = GeneratedColumn(
+ 'user_id',
+ aliasedName,
+ true,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ );
static const VerificationMeta _colorMeta = const VerificationMeta('color');
@override
late final GeneratedColumn color = GeneratedColumn(
@@ -51,7 +60,7 @@ class $CategoriesTable extends Categories
requiredDuringInsert: true,
);
@override
- List get $columns => [id, name, icon, color];
+ List get $columns => [id, name, icon, userId, color];
@override
String get aliasedName => _alias ?? actualTableName;
@override
@@ -83,6 +92,12 @@ class $CategoriesTable extends Categories
} else if (isInserting) {
context.missing(_iconMeta);
}
+ if (data.containsKey('user_id')) {
+ context.handle(
+ _userIdMeta,
+ userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta),
+ );
+ }
if (data.containsKey('color')) {
context.handle(
_colorMeta,
@@ -115,6 +130,10 @@ class $CategoriesTable extends Categories
DriftSqlType.string,
data['${effectivePrefix}icon'],
)!,
+ userId: attachedDatabase.typeMapping.read(
+ DriftSqlType.int,
+ data['${effectivePrefix}user_id'],
+ ),
color:
attachedDatabase.typeMapping.read(
DriftSqlType.int,
@@ -133,11 +152,13 @@ class CategoryDb extends DataClass implements Insertable {
final int id;
final String name;
final String icon;
+ final int? userId;
final int color;
const CategoryDb({
required this.id,
required this.name,
required this.icon,
+ this.userId,
required this.color,
});
@override
@@ -146,6 +167,9 @@ class CategoryDb extends DataClass implements Insertable {
map['id'] = Variable(id);
map['name'] = Variable(name);
map['icon'] = Variable(icon);
+ if (!nullToAbsent || userId != null) {
+ map['user_id'] = Variable(userId);
+ }
map['color'] = Variable(color);
return map;
}
@@ -155,6 +179,8 @@ class CategoryDb extends DataClass implements Insertable {
id: Value(id),
name: Value(name),
icon: Value(icon),
+ userId:
+ userId == null && nullToAbsent ? const Value.absent() : Value(userId),
color: Value(color),
);
}
@@ -168,6 +194,7 @@ class CategoryDb extends DataClass implements Insertable {
id: serializer.fromJson(json['id']),
name: serializer.fromJson(json['name']),
icon: serializer.fromJson(json['icon']),
+ userId: serializer.fromJson(json['userId']),
color: serializer.fromJson(json['color']),
);
}
@@ -178,22 +205,30 @@ class CategoryDb extends DataClass implements Insertable {
'id': serializer.toJson(id),
'name': serializer.toJson(name),
'icon': serializer.toJson(icon),
+ 'userId': serializer.toJson(userId),
'color': serializer.toJson(color),
};
}
- CategoryDb copyWith({int? id, String? name, String? icon, int? color}) =>
- CategoryDb(
- id: id ?? this.id,
- name: name ?? this.name,
- icon: icon ?? this.icon,
- color: color ?? this.color,
- );
+ CategoryDb copyWith({
+ int? id,
+ String? name,
+ String? icon,
+ Value userId = const Value.absent(),
+ int? color,
+ }) => CategoryDb(
+ id: id ?? this.id,
+ name: name ?? this.name,
+ icon: icon ?? this.icon,
+ userId: userId.present ? userId.value : this.userId,
+ color: color ?? this.color,
+ );
CategoryDb copyWithCompanion(CategoriesCompanion data) {
return CategoryDb(
id: data.id.present ? data.id.value : this.id,
name: data.name.present ? data.name.value : this.name,
icon: data.icon.present ? data.icon.value : this.icon,
+ userId: data.userId.present ? data.userId.value : this.userId,
color: data.color.present ? data.color.value : this.color,
);
}
@@ -204,13 +239,14 @@ class CategoryDb extends DataClass implements Insertable {
..write('id: $id, ')
..write('name: $name, ')
..write('icon: $icon, ')
+ ..write('userId: $userId, ')
..write('color: $color')
..write(')'))
.toString();
}
@override
- int get hashCode => Object.hash(id, name, icon, color);
+ int get hashCode => Object.hash(id, name, icon, userId, color);
@override
bool operator ==(Object other) =>
identical(this, other) ||
@@ -218,6 +254,7 @@ class CategoryDb extends DataClass implements Insertable {
other.id == this.id &&
other.name == this.name &&
other.icon == this.icon &&
+ other.userId == this.userId &&
other.color == this.color);
}
@@ -225,17 +262,20 @@ class CategoriesCompanion extends UpdateCompanion {
final Value id;
final Value name;
final Value icon;
+ final Value userId;
final Value color;
const CategoriesCompanion({
this.id = const Value.absent(),
this.name = const Value.absent(),
this.icon = const Value.absent(),
+ this.userId = const Value.absent(),
this.color = const Value.absent(),
});
CategoriesCompanion.insert({
this.id = const Value.absent(),
required String name,
required String icon,
+ this.userId = const Value.absent(),
required int color,
}) : name = Value(name),
icon = Value(icon),
@@ -244,12 +284,14 @@ class CategoriesCompanion extends UpdateCompanion {
Expression? id,
Expression? name,
Expression? icon,
+ Expression? userId,
Expression? color,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (name != null) 'name': name,
if (icon != null) 'icon': icon,
+ if (userId != null) 'user_id': userId,
if (color != null) 'color': color,
});
}
@@ -258,12 +300,14 @@ class CategoriesCompanion extends UpdateCompanion {
Value? id,
Value? name,
Value? icon,
+ Value? userId,
Value? color,
}) {
return CategoriesCompanion(
id: id ?? this.id,
name: name ?? this.name,
icon: icon ?? this.icon,
+ userId: userId ?? this.userId,
color: color ?? this.color,
);
}
@@ -280,6 +324,9 @@ class CategoriesCompanion extends UpdateCompanion {
if (icon.present) {
map['icon'] = Variable(icon.value);
}
+ if (userId.present) {
+ map['user_id'] = Variable(userId.value);
+ }
if (color.present) {
map['color'] = Variable(color.value);
}
@@ -292,6 +339,7 @@ class CategoriesCompanion extends UpdateCompanion {
..write('id: $id, ')
..write('name: $name, ')
..write('icon: $icon, ')
+ ..write('userId: $userId, ')
..write('color: $color')
..write(')'))
.toString();
@@ -357,6 +405,15 @@ class $TransactionsTable extends Transactions
type: DriftSqlType.string,
requiredDuringInsert: true,
);
+ static const VerificationMeta _userIdMeta = const VerificationMeta('userId');
+ @override
+ late final GeneratedColumn userId = GeneratedColumn(
+ 'user_id',
+ aliasedName,
+ true,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ );
static const VerificationMeta _typeMeta = const VerificationMeta('type');
@override
late final GeneratedColumn type = GeneratedColumn(
@@ -374,6 +431,7 @@ class $TransactionsTable extends Transactions
amount,
date,
merchant,
+ userId,
type,
];
@override
@@ -426,6 +484,12 @@ class $TransactionsTable extends Transactions
} else if (isInserting) {
context.missing(_merchantMeta);
}
+ if (data.containsKey('user_id')) {
+ context.handle(
+ _userIdMeta,
+ userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta),
+ );
+ }
if (data.containsKey('type')) {
context.handle(
_typeMeta,
@@ -466,6 +530,10 @@ class $TransactionsTable extends Transactions
DriftSqlType.string,
data['${effectivePrefix}merchant'],
)!,
+ userId: attachedDatabase.typeMapping.read(
+ DriftSqlType.int,
+ data['${effectivePrefix}user_id'],
+ ),
type:
attachedDatabase.typeMapping.read(
DriftSqlType.string,
@@ -486,6 +554,7 @@ class Transaction extends DataClass implements Insertable {
final double amount;
final DateTime date;
final String merchant;
+ final int? userId;
final String type;
const Transaction({
required this.id,
@@ -493,6 +562,7 @@ class Transaction extends DataClass implements Insertable {
required this.amount,
required this.date,
required this.merchant,
+ this.userId,
required this.type,
});
@override
@@ -503,6 +573,9 @@ class Transaction extends DataClass implements Insertable {
map['amount'] = Variable(amount);
map['date'] = Variable(date);
map['merchant'] = Variable(merchant);
+ if (!nullToAbsent || userId != null) {
+ map['user_id'] = Variable(userId);
+ }
map['type'] = Variable(type);
return map;
}
@@ -514,6 +587,8 @@ class Transaction extends DataClass implements Insertable {
amount: Value(amount),
date: Value(date),
merchant: Value(merchant),
+ userId:
+ userId == null && nullToAbsent ? const Value.absent() : Value(userId),
type: Value(type),
);
}
@@ -529,6 +604,7 @@ class Transaction extends DataClass implements Insertable {
amount: serializer.fromJson(json['amount']),
date: serializer.fromJson(json['date']),
merchant: serializer.fromJson(json['merchant']),
+ userId: serializer.fromJson(json['userId']),
type: serializer.fromJson(json['type']),
);
}
@@ -541,6 +617,7 @@ class Transaction extends DataClass implements Insertable {
'amount': serializer.toJson(amount),
'date': serializer.toJson(date),
'merchant': serializer.toJson(merchant),
+ 'userId': serializer.toJson(userId),
'type': serializer.toJson(type),
};
}
@@ -551,6 +628,7 @@ class Transaction extends DataClass implements Insertable {
double? amount,
DateTime? date,
String? merchant,
+ Value userId = const Value.absent(),
String? type,
}) => Transaction(
id: id ?? this.id,
@@ -558,6 +636,7 @@ class Transaction extends DataClass implements Insertable {
amount: amount ?? this.amount,
date: date ?? this.date,
merchant: merchant ?? this.merchant,
+ userId: userId.present ? userId.value : this.userId,
type: type ?? this.type,
);
Transaction copyWithCompanion(TransactionsCompanion data) {
@@ -570,6 +649,7 @@ class Transaction extends DataClass implements Insertable {
amount: data.amount.present ? data.amount.value : this.amount,
date: data.date.present ? data.date.value : this.date,
merchant: data.merchant.present ? data.merchant.value : this.merchant,
+ userId: data.userId.present ? data.userId.value : this.userId,
type: data.type.present ? data.type.value : this.type,
);
}
@@ -582,6 +662,7 @@ class Transaction extends DataClass implements Insertable {
..write('amount: $amount, ')
..write('date: $date, ')
..write('merchant: $merchant, ')
+ ..write('userId: $userId, ')
..write('type: $type')
..write(')'))
.toString();
@@ -589,7 +670,7 @@ class Transaction extends DataClass implements Insertable {
@override
int get hashCode =>
- Object.hash(id, categoryName, amount, date, merchant, type);
+ Object.hash(id, categoryName, amount, date, merchant, userId, type);
@override
bool operator ==(Object other) =>
identical(this, other) ||
@@ -599,6 +680,7 @@ class Transaction extends DataClass implements Insertable {
other.amount == this.amount &&
other.date == this.date &&
other.merchant == this.merchant &&
+ other.userId == this.userId &&
other.type == this.type);
}
@@ -608,6 +690,7 @@ class TransactionsCompanion extends UpdateCompanion {
final Value amount;
final Value date;
final Value merchant;
+ final Value userId;
final Value type;
const TransactionsCompanion({
this.id = const Value.absent(),
@@ -615,6 +698,7 @@ class TransactionsCompanion extends UpdateCompanion {
this.amount = const Value.absent(),
this.date = const Value.absent(),
this.merchant = const Value.absent(),
+ this.userId = const Value.absent(),
this.type = const Value.absent(),
});
TransactionsCompanion.insert({
@@ -623,6 +707,7 @@ class TransactionsCompanion extends UpdateCompanion {
required double amount,
required DateTime date,
required String merchant,
+ this.userId = const Value.absent(),
this.type = const Value.absent(),
}) : categoryName = Value(categoryName),
amount = Value(amount),
@@ -634,6 +719,7 @@ class TransactionsCompanion extends UpdateCompanion {
Expression? amount,
Expression? date,
Expression? merchant,
+ Expression? userId,
Expression? type,
}) {
return RawValuesInsertable({
@@ -642,6 +728,7 @@ class TransactionsCompanion extends UpdateCompanion {
if (amount != null) 'amount': amount,
if (date != null) 'date': date,
if (merchant != null) 'merchant': merchant,
+ if (userId != null) 'user_id': userId,
if (type != null) 'type': type,
});
}
@@ -652,6 +739,7 @@ class TransactionsCompanion extends UpdateCompanion {
Value? amount,
Value? date,
Value? merchant,
+ Value? userId,
Value? type,
}) {
return TransactionsCompanion(
@@ -660,6 +748,7 @@ class TransactionsCompanion extends UpdateCompanion {
amount: amount ?? this.amount,
date: date ?? this.date,
merchant: merchant ?? this.merchant,
+ userId: userId ?? this.userId,
type: type ?? this.type,
);
}
@@ -682,6 +771,9 @@ class TransactionsCompanion extends UpdateCompanion {
if (merchant.present) {
map['merchant'] = Variable(merchant.value);
}
+ if (userId.present) {
+ map['user_id'] = Variable(userId.value);
+ }
if (type.present) {
map['type'] = Variable(type.value);
}
@@ -696,17 +788,320 @@ class TransactionsCompanion extends UpdateCompanion {
..write('amount: $amount, ')
..write('date: $date, ')
..write('merchant: $merchant, ')
+ ..write('userId: $userId, ')
..write('type: $type')
..write(')'))
.toString();
}
}
+class $UsersTable extends Users with TableInfo<$UsersTable, User> {
+ @override
+ final GeneratedDatabase attachedDatabase;
+ final String? _alias;
+ $UsersTable(this.attachedDatabase, [this._alias]);
+ static const VerificationMeta _idMeta = const VerificationMeta('id');
+ @override
+ late final GeneratedColumn id = GeneratedColumn(
+ 'id',
+ aliasedName,
+ false,
+ hasAutoIncrement: true,
+ type: DriftSqlType.int,
+ requiredDuringInsert: false,
+ defaultConstraints: GeneratedColumn.constraintIsAlways(
+ 'PRIMARY KEY AUTOINCREMENT',
+ ),
+ );
+ static const VerificationMeta _nameMeta = const VerificationMeta('name');
+ @override
+ late final GeneratedColumn name = GeneratedColumn(
+ 'name',
+ aliasedName,
+ false,
+ additionalChecks: GeneratedColumn.checkTextLength(
+ minTextLength: 1,
+ maxTextLength: 50,
+ ),
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ );
+ static const VerificationMeta _emailMeta = const VerificationMeta('email');
+ @override
+ late final GeneratedColumn email = GeneratedColumn(
+ 'email',
+ aliasedName,
+ false,
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ defaultConstraints: GeneratedColumn.constraintIsAlways('UNIQUE'),
+ );
+ static const VerificationMeta _passwordMeta = const VerificationMeta(
+ 'password',
+ );
+ @override
+ late final GeneratedColumn password = GeneratedColumn(
+ 'password',
+ aliasedName,
+ false,
+ additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 6),
+ type: DriftSqlType.string,
+ requiredDuringInsert: true,
+ );
+ @override
+ List get $columns => [id, name, email, password];
+ @override
+ String get aliasedName => _alias ?? actualTableName;
+ @override
+ String get actualTableName => $name;
+ static const String $name = 'users';
+ @override
+ VerificationContext validateIntegrity(
+ Insertable instance, {
+ bool isInserting = false,
+ }) {
+ final context = VerificationContext();
+ final data = instance.toColumns(true);
+ if (data.containsKey('id')) {
+ context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
+ }
+ if (data.containsKey('name')) {
+ context.handle(
+ _nameMeta,
+ name.isAcceptableOrUnknown(data['name']!, _nameMeta),
+ );
+ } else if (isInserting) {
+ context.missing(_nameMeta);
+ }
+ if (data.containsKey('email')) {
+ context.handle(
+ _emailMeta,
+ email.isAcceptableOrUnknown(data['email']!, _emailMeta),
+ );
+ } else if (isInserting) {
+ context.missing(_emailMeta);
+ }
+ if (data.containsKey('password')) {
+ context.handle(
+ _passwordMeta,
+ password.isAcceptableOrUnknown(data['password']!, _passwordMeta),
+ );
+ } else if (isInserting) {
+ context.missing(_passwordMeta);
+ }
+ return context;
+ }
+
+ @override
+ Set get $primaryKey => {id};
+ @override
+ User map(Map data, {String? tablePrefix}) {
+ final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
+ return User(
+ id:
+ attachedDatabase.typeMapping.read(
+ DriftSqlType.int,
+ data['${effectivePrefix}id'],
+ )!,
+ name:
+ attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}name'],
+ )!,
+ email:
+ attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}email'],
+ )!,
+ password:
+ attachedDatabase.typeMapping.read(
+ DriftSqlType.string,
+ data['${effectivePrefix}password'],
+ )!,
+ );
+ }
+
+ @override
+ $UsersTable createAlias(String alias) {
+ return $UsersTable(attachedDatabase, alias);
+ }
+}
+
+class User extends DataClass implements Insertable {
+ final int id;
+ final String name;
+ final String email;
+ final String password;
+ const User({
+ required this.id,
+ required this.name,
+ required this.email,
+ required this.password,
+ });
+ @override
+ Map toColumns(bool nullToAbsent) {
+ final map = {};
+ map['id'] = Variable(id);
+ map['name'] = Variable(name);
+ map['email'] = Variable(email);
+ map['password'] = Variable(password);
+ return map;
+ }
+
+ UsersCompanion toCompanion(bool nullToAbsent) {
+ return UsersCompanion(
+ id: Value(id),
+ name: Value(name),
+ email: Value(email),
+ password: Value(password),
+ );
+ }
+
+ factory User.fromJson(
+ Map json, {
+ ValueSerializer? serializer,
+ }) {
+ serializer ??= driftRuntimeOptions.defaultSerializer;
+ return User(
+ id: serializer.fromJson(json['id']),
+ name: serializer.fromJson(json['name']),
+ email: serializer.fromJson(json['email']),
+ password: serializer.fromJson(json['password']),
+ );
+ }
+ @override
+ Map toJson({ValueSerializer? serializer}) {
+ serializer ??= driftRuntimeOptions.defaultSerializer;
+ return {
+ 'id': serializer.toJson(id),
+ 'name': serializer.toJson(name),
+ 'email': serializer.toJson(email),
+ 'password': serializer.toJson(password),
+ };
+ }
+
+ User copyWith({int? id, String? name, String? email, String? password}) =>
+ User(
+ id: id ?? this.id,
+ name: name ?? this.name,
+ email: email ?? this.email,
+ password: password ?? this.password,
+ );
+ User copyWithCompanion(UsersCompanion data) {
+ return User(
+ id: data.id.present ? data.id.value : this.id,
+ name: data.name.present ? data.name.value : this.name,
+ email: data.email.present ? data.email.value : this.email,
+ password: data.password.present ? data.password.value : this.password,
+ );
+ }
+
+ @override
+ String toString() {
+ return (StringBuffer('User(')
+ ..write('id: $id, ')
+ ..write('name: $name, ')
+ ..write('email: $email, ')
+ ..write('password: $password')
+ ..write(')'))
+ .toString();
+ }
+
+ @override
+ int get hashCode => Object.hash(id, name, email, password);
+ @override
+ bool operator ==(Object other) =>
+ identical(this, other) ||
+ (other is User &&
+ other.id == this.id &&
+ other.name == this.name &&
+ other.email == this.email &&
+ other.password == this.password);
+}
+
+class UsersCompanion extends UpdateCompanion {
+ final Value id;
+ final Value name;
+ final Value email;
+ final Value password;
+ const UsersCompanion({
+ this.id = const Value.absent(),
+ this.name = const Value.absent(),
+ this.email = const Value.absent(),
+ this.password = const Value.absent(),
+ });
+ UsersCompanion.insert({
+ this.id = const Value.absent(),
+ required String name,
+ required String email,
+ required String password,
+ }) : name = Value(name),
+ email = Value(email),
+ password = Value(password);
+ static Insertable custom({
+ Expression? id,
+ Expression? name,
+ Expression? email,
+ Expression? password,
+ }) {
+ return RawValuesInsertable({
+ if (id != null) 'id': id,
+ if (name != null) 'name': name,
+ if (email != null) 'email': email,
+ if (password != null) 'password': password,
+ });
+ }
+
+ UsersCompanion copyWith({
+ Value? id,
+ Value? name,
+ Value? email,
+ Value? password,
+ }) {
+ return UsersCompanion(
+ id: id ?? this.id,
+ name: name ?? this.name,
+ email: email ?? this.email,
+ password: password ?? this.password,
+ );
+ }
+
+ @override
+ Map toColumns(bool nullToAbsent) {
+ final map = {};
+ if (id.present) {
+ map['id'] = Variable(id.value);
+ }
+ if (name.present) {
+ map['name'] = Variable(name.value);
+ }
+ if (email.present) {
+ map['email'] = Variable(email.value);
+ }
+ if (password.present) {
+ map['password'] = Variable(password.value);
+ }
+ return map;
+ }
+
+ @override
+ String toString() {
+ return (StringBuffer('UsersCompanion(')
+ ..write('id: $id, ')
+ ..write('name: $name, ')
+ ..write('email: $email, ')
+ ..write('password: $password')
+ ..write(')'))
+ .toString();
+ }
+}
+
abstract class _$AppDatabase extends GeneratedDatabase {
_$AppDatabase(QueryExecutor e) : super(e);
$AppDatabaseManager get managers => $AppDatabaseManager(this);
late final $CategoriesTable categories = $CategoriesTable(this);
late final $TransactionsTable transactions = $TransactionsTable(this);
+ late final $UsersTable users = $UsersTable(this);
@override
Iterable> get allTables =>
allSchemaEntities.whereType>();
@@ -714,6 +1109,7 @@ abstract class _$AppDatabase extends GeneratedDatabase {
List get allSchemaEntities => [
categories,
transactions,
+ users,
];
}
@@ -722,6 +1118,7 @@ typedef $$CategoriesTableCreateCompanionBuilder =
Value id,
required String name,
required String icon,
+ Value userId,
required int color,
});
typedef $$CategoriesTableUpdateCompanionBuilder =
@@ -729,6 +1126,7 @@ typedef $$CategoriesTableUpdateCompanionBuilder =
Value id,
Value name,
Value icon,
+ Value userId,
Value color,
});
@@ -756,6 +1154,11 @@ class $$CategoriesTableFilterComposer
builder: (column) => ColumnFilters(column),
);
+ ColumnFilters get userId => $composableBuilder(
+ column: $table.userId,
+ builder: (column) => ColumnFilters(column),
+ );
+
ColumnFilters get color => $composableBuilder(
column: $table.color,
builder: (column) => ColumnFilters(column),
@@ -786,6 +1189,11 @@ class $$CategoriesTableOrderingComposer
builder: (column) => ColumnOrderings(column),
);
+ ColumnOrderings get userId => $composableBuilder(
+ column: $table.userId,
+ builder: (column) => ColumnOrderings(column),
+ );
+
ColumnOrderings get color => $composableBuilder(
column: $table.color,
builder: (column) => ColumnOrderings(column),
@@ -810,6 +1218,9 @@ class $$CategoriesTableAnnotationComposer
GeneratedColumn get icon =>
$composableBuilder(column: $table.icon, builder: (column) => column);
+ GeneratedColumn get userId =>
+ $composableBuilder(column: $table.userId, builder: (column) => column);
+
GeneratedColumn get color =>
$composableBuilder(column: $table.color, builder: (column) => column);
}
@@ -848,11 +1259,13 @@ class $$CategoriesTableTableManager
Value id = const Value.absent(),
Value name = const Value.absent(),
Value icon = const Value.absent(),
+ Value userId = const Value.absent(),
Value color = const Value.absent(),
}) => CategoriesCompanion(
id: id,
name: name,
icon: icon,
+ userId: userId,
color: color,
),
createCompanionCallback:
@@ -860,11 +1273,13 @@ class $$CategoriesTableTableManager
Value id = const Value.absent(),
required String name,
required String icon,
+ Value userId = const Value.absent(),
required int color,
}) => CategoriesCompanion.insert(
id: id,
name: name,
icon: icon,
+ userId: userId,
color: color,
),
withReferenceMapper:
@@ -903,6 +1318,7 @@ typedef $$TransactionsTableCreateCompanionBuilder =
required double amount,
required DateTime date,
required String merchant,
+ Value userId,
Value type,
});
typedef $$TransactionsTableUpdateCompanionBuilder =
@@ -912,6 +1328,7 @@ typedef $$TransactionsTableUpdateCompanionBuilder =
Value amount,
Value date,
Value merchant,
+ Value userId,
Value type,
});
@@ -949,6 +1366,11 @@ class $$TransactionsTableFilterComposer
builder: (column) => ColumnFilters(column),
);
+ ColumnFilters get userId => $composableBuilder(
+ column: $table.userId,
+ builder: (column) => ColumnFilters(column),
+ );
+
ColumnFilters get type => $composableBuilder(
column: $table.type,
builder: (column) => ColumnFilters(column),
@@ -989,6 +1411,11 @@ class $$TransactionsTableOrderingComposer
builder: (column) => ColumnOrderings(column),
);
+ ColumnOrderings get userId => $composableBuilder(
+ column: $table.userId,
+ builder: (column) => ColumnOrderings(column),
+ );
+
ColumnOrderings get type => $composableBuilder(
column: $table.type,
builder: (column) => ColumnOrderings(column),
@@ -1021,6 +1448,9 @@ class $$TransactionsTableAnnotationComposer
GeneratedColumn get merchant =>
$composableBuilder(column: $table.merchant, builder: (column) => column);
+ GeneratedColumn get userId =>
+ $composableBuilder(column: $table.userId, builder: (column) => column);
+
GeneratedColumn get type =>
$composableBuilder(column: $table.type, builder: (column) => column);
}
@@ -1062,6 +1492,7 @@ class $$TransactionsTableTableManager
Value amount = const Value.absent(),
Value date = const Value.absent(),
Value merchant = const Value.absent(),
+ Value userId = const Value.absent(),
Value type = const Value.absent(),
}) => TransactionsCompanion(
id: id,
@@ -1069,6 +1500,7 @@ class $$TransactionsTableTableManager
amount: amount,
date: date,
merchant: merchant,
+ userId: userId,
type: type,
),
createCompanionCallback:
@@ -1078,6 +1510,7 @@ class $$TransactionsTableTableManager
required double amount,
required DateTime date,
required String merchant,
+ Value userId = const Value.absent(),
Value type = const Value.absent(),
}) => TransactionsCompanion.insert(
id: id,
@@ -1085,6 +1518,7 @@ class $$TransactionsTableTableManager
amount: amount,
date: date,
merchant: merchant,
+ userId: userId,
type: type,
),
withReferenceMapper:
@@ -1119,6 +1553,181 @@ typedef $$TransactionsTableProcessedTableManager =
Transaction,
PrefetchHooks Function()
>;
+typedef $$UsersTableCreateCompanionBuilder =
+ UsersCompanion Function({
+ Value id,
+ required String name,
+ required String email,
+ required String password,
+ });
+typedef $$UsersTableUpdateCompanionBuilder =
+ UsersCompanion Function({
+ Value id,
+ Value name,
+ Value email,
+ Value password,
+ });
+
+class $$UsersTableFilterComposer extends Composer<_$AppDatabase, $UsersTable> {
+ $$UsersTableFilterComposer({
+ required super.$db,
+ required super.$table,
+ super.joinBuilder,
+ super.$addJoinBuilderToRootComposer,
+ super.$removeJoinBuilderFromRootComposer,
+ });
+ ColumnFilters get id => $composableBuilder(
+ column: $table.id,
+ builder: (column) => ColumnFilters(column),
+ );
+
+ ColumnFilters get name => $composableBuilder(
+ column: $table.name,
+ builder: (column) => ColumnFilters(column),
+ );
+
+ ColumnFilters get email => $composableBuilder(
+ column: $table.email,
+ builder: (column) => ColumnFilters(column),
+ );
+
+ ColumnFilters get password => $composableBuilder(
+ column: $table.password,
+ builder: (column) => ColumnFilters(column),
+ );
+}
+
+class $$UsersTableOrderingComposer
+ extends Composer<_$AppDatabase, $UsersTable> {
+ $$UsersTableOrderingComposer({
+ required super.$db,
+ required super.$table,
+ super.joinBuilder,
+ super.$addJoinBuilderToRootComposer,
+ super.$removeJoinBuilderFromRootComposer,
+ });
+ ColumnOrderings get id => $composableBuilder(
+ column: $table.id,
+ builder: (column) => ColumnOrderings(column),
+ );
+
+ ColumnOrderings get name => $composableBuilder(
+ column: $table.name,
+ builder: (column) => ColumnOrderings(column),
+ );
+
+ ColumnOrderings get email => $composableBuilder(
+ column: $table.email,
+ builder: (column) => ColumnOrderings(column),
+ );
+
+ ColumnOrderings get password => $composableBuilder(
+ column: $table.password,
+ builder: (column) => ColumnOrderings(column),
+ );
+}
+
+class $$UsersTableAnnotationComposer
+ extends Composer<_$AppDatabase, $UsersTable> {
+ $$UsersTableAnnotationComposer({
+ required super.$db,
+ required super.$table,
+ super.joinBuilder,
+ super.$addJoinBuilderToRootComposer,
+ super.$removeJoinBuilderFromRootComposer,
+ });
+ GeneratedColumn get id =>
+ $composableBuilder(column: $table.id, builder: (column) => column);
+
+ GeneratedColumn get name =>
+ $composableBuilder(column: $table.name, builder: (column) => column);
+
+ GeneratedColumn get email =>
+ $composableBuilder(column: $table.email, builder: (column) => column);
+
+ GeneratedColumn get password =>
+ $composableBuilder(column: $table.password, builder: (column) => column);
+}
+
+class $$UsersTableTableManager
+ extends
+ RootTableManager<
+ _$AppDatabase,
+ $UsersTable,
+ User,
+ $$UsersTableFilterComposer,
+ $$UsersTableOrderingComposer,
+ $$UsersTableAnnotationComposer,
+ $$UsersTableCreateCompanionBuilder,
+ $$UsersTableUpdateCompanionBuilder,
+ (User, BaseReferences<_$AppDatabase, $UsersTable, User>),
+ User,
+ PrefetchHooks Function()
+ > {
+ $$UsersTableTableManager(_$AppDatabase db, $UsersTable table)
+ : super(
+ TableManagerState(
+ db: db,
+ table: table,
+ createFilteringComposer:
+ () => $$UsersTableFilterComposer($db: db, $table: table),
+ createOrderingComposer:
+ () => $$UsersTableOrderingComposer($db: db, $table: table),
+ createComputedFieldComposer:
+ () => $$UsersTableAnnotationComposer($db: db, $table: table),
+ updateCompanionCallback:
+ ({
+ Value id = const Value.absent(),
+ Value name = const Value.absent(),
+ Value email = const Value.absent(),
+ Value password = const Value.absent(),
+ }) => UsersCompanion(
+ id: id,
+ name: name,
+ email: email,
+ password: password,
+ ),
+ createCompanionCallback:
+ ({
+ Value id = const Value.absent(),
+ required String name,
+ required String email,
+ required String password,
+ }) => UsersCompanion.insert(
+ id: id,
+ name: name,
+ email: email,
+ password: password,
+ ),
+ withReferenceMapper:
+ (p0) =>
+ p0
+ .map(
+ (e) => (
+ e.readTable(table),
+ BaseReferences(db, table, e),
+ ),
+ )
+ .toList(),
+ prefetchHooksCallback: null,
+ ),
+ );
+}
+
+typedef $$UsersTableProcessedTableManager =
+ ProcessedTableManager<
+ _$AppDatabase,
+ $UsersTable,
+ User,
+ $$UsersTableFilterComposer,
+ $$UsersTableOrderingComposer,
+ $$UsersTableAnnotationComposer,
+ $$UsersTableCreateCompanionBuilder,
+ $$UsersTableUpdateCompanionBuilder,
+ (User, BaseReferences<_$AppDatabase, $UsersTable, User>),
+ User,
+ PrefetchHooks Function()
+ >;
class $AppDatabaseManager {
final _$AppDatabase _db;
@@ -1127,4 +1736,6 @@ class $AppDatabaseManager {
$$CategoriesTableTableManager(_db, _db.categories);
$$TransactionsTableTableManager get transactions =>
$$TransactionsTableTableManager(_db, _db.transactions);
+ $$UsersTableTableManager get users =>
+ $$UsersTableTableManager(_db, _db.users);
}
diff --git a/finance_app/lib/models/transaction_record.dart b/finance_app/lib/models/transaction_record.dart
index b1d863a..096ceaf 100644
--- a/finance_app/lib/models/transaction_record.dart
+++ b/finance_app/lib/models/transaction_record.dart
@@ -5,7 +5,6 @@ class TransactionRecord {
final int id;
final String type; // 'income' or 'expense'
final int? userId; // Добавляем ссылку на пользователя
- final int? userId; // Добавляем ссылку на пользователя
final double amount;
final Category? category; // Reference to category (null for income)
final DateTime date;
diff --git a/finance_app/lib/screens/settings_menu_screen.dart b/finance_app/lib/screens/settings_menu_screen.dart
index 76d23c5..0c9d6ea 100644
--- a/finance_app/lib/screens/settings_menu_screen.dart
+++ b/finance_app/lib/screens/settings_menu_screen.dart
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import '../database/database.dart' as db;
-import 'category_settings_screen.dart'; // Импортируем переименованный экран
+import 'settings_screen.dart'; // Импортируем переименованный экран
class SettingsMenuScreen extends StatelessWidget {
final db.AppDatabase database;
diff --git a/finance_app/lib/utils/category_utils.dart b/finance_app/lib/utils/category_utils.dart
index 704245e..0208e5d 100644
--- a/finance_app/lib/utils/category_utils.dart
+++ b/finance_app/lib/utils/category_utils.dart
@@ -237,11 +237,11 @@ class CategoryUtils {
Colors.yellowAccent, Colors.amberAccent, Colors.orangeAccent, Colors.deepOrangeAccent,
// Shade variations (More subtle options)
- Colors.red.shade300, Colors.pink.shade200, Colors.purple.shade300,
+ /* Colors.red.shade300, Colors.pink.shade200, Colors.purple.shade300,
Colors.indigo.shade300, Colors.blue.shade300, Colors.lightBlue.shade300,
Colors.cyan.shade300, Colors.teal.shade300, Colors.green.shade300,
Colors.lightGreen.shade300, Colors.lime.shade300, Colors.yellow.shade600, // Darker yellow
Colors.amber.shade300, Colors.orange.shade300, Colors.deepOrange.shade300,
- Colors.brown.shade300, Colors.grey.shade400, Colors.blueGrey.shade300,
+ Colors.brown.shade300, Colors.grey.shade400, Colors.blueGrey.shade300,*/
];
}
diff --git a/finance_app/macos/Flutter/GeneratedPluginRegistrant.swift b/finance_app/macos/Flutter/GeneratedPluginRegistrant.swift
index 14fa8bc..d24cdf2 100644
--- a/finance_app/macos/Flutter/GeneratedPluginRegistrant.swift
+++ b/finance_app/macos/Flutter/GeneratedPluginRegistrant.swift
@@ -5,10 +5,14 @@
import FlutterMacOS
import Foundation
+import flutter_web_auth
import path_provider_foundation
+import shared_preferences_foundation
import sqlite3_flutter_libs
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
+ FlutterWebAuthPlugin.register(with: registry.registrar(forPlugin: "FlutterWebAuthPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
+ SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
Sqlite3FlutterLibsPlugin.register(with: registry.registrar(forPlugin: "Sqlite3FlutterLibsPlugin"))
}
diff --git a/finance_app/pubspec.lock b/finance_app/pubspec.lock
index 1a7bb71..2032265 100644
--- a/finance_app/pubspec.lock
+++ b/finance_app/pubspec.lock
@@ -13,10 +13,10 @@ packages:
dependency: transitive
description:
name: analyzer
- sha256: "13c1e6c6fd460522ea840abec3f677cc226f5fec7872c04ad7b425517ccf54f7"
+ sha256: "904ae5bb474d32c38fb9482e2d925d5454cda04ddd0e55d2e6826bc72f6ba8c0"
url: "https://pub.dev"
source: hosted
- version: "7.4.4"
+ version: "7.4.5"
args:
dependency: transitive
description:
@@ -275,6 +275,19 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
+ flutter_web_auth:
+ dependency: "direct main"
+ description:
+ name: flutter_web_auth
+ sha256: "95e4856e24fb6ac1678f5ff334743b63f782d839ab324543d29ccbd295176209"
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.6.0"
+ flutter_web_plugins:
+ dependency: transitive
+ description: flutter
+ source: sdk
+ version: "0.0.0"
frontend_server_client:
dependency: transitive
description:
@@ -303,10 +316,10 @@ packages:
dependency: transitive
description:
name: http
- sha256: fe7ab022b76f3034adc518fb6ea04a82387620e19977665ea18d30a1cf43442f
+ sha256: "2c11f3f94c687ee9bad77c171151672986360b2b001d109814ee7140b2cf261b"
url: "https://pub.dev"
source: hosted
- version: "1.3.0"
+ version: "1.4.0"
http_multi_server:
dependency: transitive
description:
@@ -539,6 +552,62 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.1.0"
+ shared_preferences:
+ dependency: "direct main"
+ description:
+ name: shared_preferences
+ sha256: "6e8bf70b7fef813df4e9a36f658ac46d107db4b4cfe1048b477d4e453a8159f5"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.5.3"
+ shared_preferences_android:
+ dependency: transitive
+ description:
+ name: shared_preferences_android
+ sha256: "20cbd561f743a342c76c151d6ddb93a9ce6005751e7aa458baad3858bfbfb6ac"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.4.10"
+ shared_preferences_foundation:
+ dependency: transitive
+ description:
+ name: shared_preferences_foundation
+ sha256: "6a52cfcdaeac77cad8c97b539ff688ccfc458c007b4db12be584fbe5c0e49e03"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.5.4"
+ shared_preferences_linux:
+ dependency: transitive
+ description:
+ name: shared_preferences_linux
+ sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.4.1"
+ shared_preferences_platform_interface:
+ dependency: transitive
+ description:
+ name: shared_preferences_platform_interface
+ sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.4.1"
+ shared_preferences_web:
+ dependency: transitive
+ description:
+ name: shared_preferences_web
+ sha256: c49bd060261c9a3f0ff445892695d6212ff603ef3115edbb448509d407600019
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.4.3"
+ shared_preferences_windows:
+ dependency: transitive
+ description:
+ name: shared_preferences_windows
+ sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.4.1"
shelf:
dependency: transitive
description:
@@ -700,10 +769,10 @@ packages:
dependency: transitive
description:
name: web_socket
- sha256: bfe6f435f6ec49cb6c01da1e275ae4228719e59a6b067048c51e72d9d63bcc4b
+ sha256: "34d64019aa8e36bf9842ac014bb5d2f5586ca73df5e4d9bf5c936975cae6982c"
url: "https://pub.dev"
source: hosted
- version: "1.0.0"
+ version: "1.0.1"
web_socket_channel:
dependency: transitive
description: