Compare commits

...

3 commits

Author SHA1 Message Date
Matyáš Caras
ab3bc9869c
feat: create base for recurring entries 2023-12-07 21:20:52 +01:00
Matyáš Caras
b16b61b242
chore: upgrade flutter 2023-12-07 19:57:22 +01:00
fb2a88a0ec fix(deps): update dependency fl_chart to ^0.65.0 (#10)
Reviewed-on: #10
Co-authored-by: Renovate Bot <kontakt+renovator@caras.cafe>
Co-committed-by: Renovate Bot <kontakt+renovator@caras.cafe>
2023-11-28 19:07:57 +01:00
13 changed files with 237 additions and 43 deletions

@ -1 +1 @@
Subproject commit 0b591f2c82e9f59276ed68c7d4cbd63196f7c865
Subproject commit 593a031efb1e54aef4d083fc810482c2877ba1d2

View file

@ -0,0 +1,32 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:prasule/api/walletentry.dart';
import 'package:prasule/api/category.dart';
import 'package:prasule/api/entry_data.dart';
part 'recurring_entry.g.dart';
enum RecurringType { byDay, byMonth, byYear }
@JsonSerializable()
/// Used to store data about recurring entries
class RecurringEntry extends WalletSingleEntry {
/// Sets recurring by day, month or year
RecurringType recurringType;
/// Indicates by how many days/months/years should we recur
int recurEvery;
RecurringEntry(
{required super.data,
required super.type,
required super.date,
required super.category,
required super.id,
required this.recurringType,
required this.recurEvery});
factory RecurringEntry.fromJson(Map<String, dynamic> json) =>
_$RecurringEntryFromJson(json);
@override
Map<String, dynamic> toJson() => _$RecurringEntryToJson(this);
}

View file

@ -0,0 +1,41 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'recurring_entry.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
RecurringEntry _$RecurringEntryFromJson(Map<String, dynamic> json) =>
RecurringEntry(
data: EntryData.fromJson(json['data'] as Map<String, dynamic>),
type: $enumDecode(_$EntryTypeEnumMap, json['type']),
date: DateTime.parse(json['date'] as String),
category:
WalletCategory.fromJson(json['category'] as Map<String, dynamic>),
id: json['id'] as int,
recurringType: $enumDecode(_$RecurringTypeEnumMap, json['recurringType']),
recurEvery: json['recurEvery'] as int,
);
Map<String, dynamic> _$RecurringEntryToJson(RecurringEntry instance) =>
<String, dynamic>{
'type': _$EntryTypeEnumMap[instance.type]!,
'data': instance.data,
'date': instance.date.toIso8601String(),
'category': instance.category,
'id': instance.id,
'recurringType': _$RecurringTypeEnumMap[instance.recurringType]!,
'recurEvery': instance.recurEvery,
};
const _$EntryTypeEnumMap = {
EntryType.expense: 'expense',
EntryType.income: 'income',
};
const _$RecurringTypeEnumMap = {
RecurringType.byDay: 'byDay',
RecurringType.byMonth: 'byMonth',
RecurringType.byYear: 'byYear',
};

View file

@ -1,6 +1,7 @@
import 'package:currency_picker/currency_picker.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:prasule/api/category.dart';
import 'package:prasule/api/recurring_entry.dart';
import 'package:prasule/api/walletentry.dart';
part 'wallet.g.dart';
@ -12,6 +13,7 @@ class Wallet {
final String name;
final List<WalletCategory> categories;
final List<WalletSingleEntry> entries;
final List<RecurringEntry> recurringEntries;
double starterBalance;
@JsonKey(fromJson: _currencyFromJson)
final Currency currency;
@ -21,7 +23,8 @@ class Wallet {
required this.currency,
this.categories = const [],
this.entries = const [],
this.starterBalance = 0});
this.starterBalance = 0,
this.recurringEntries = const []});
/// Connect the generated [_$WalletEntry] function to the `fromJson`
/// factory.

View file

@ -19,12 +19,17 @@ Wallet _$WalletFromJson(Map<String, dynamic> json) => Wallet(
.toList() ??
const [],
starterBalance: (json['starterBalance'] as num?)?.toDouble() ?? 0,
recurringEntries: (json['recurringEntries'] as List<dynamic>?)
?.map((e) => RecurringEntry.fromJson(e as Map<String, dynamic>))
.toList() ??
const [],
);
Map<String, dynamic> _$WalletToJson(Wallet instance) => <String, dynamic>{
'name': instance.name,
'categories': instance.categories,
'entries': instance.entries,
'recurringEntries': instance.recurringEntries,
'starterBalance': instance.starterBalance,
'currency': instance.currency,
};

View file

@ -61,6 +61,8 @@
"createTestData":"Vytvořit vzorková data",
"spendingStats":"Statistiky utrácení",
"yearly":"Roční",
"monthly":"Měsíční"
"monthly":"Měsíční",
"sourceCode":"Zdrojový kód",
"recurringEntries":"Opakující se záznamy"
}

View file

@ -97,5 +97,7 @@
"createTestData":"Create test data",
"spendingStats":"Spending statistics",
"yearly":"Yearly",
"monthly":"Monthly"
"monthly":"Monthly",
"sourceCode":"Source code",
"recurringEntries":"Recurring entries"
}

View file

@ -3,6 +3,7 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:prasule/pw/platformroute.dart';
import 'package:prasule/views/graph_view.dart';
import 'package:prasule/views/home.dart';
import 'package:prasule/views/recurring_view.dart';
/// Makes the drawer because I won't enter the same code in every view
Drawer makeDrawer(BuildContext context, int page) => Drawer(
@ -39,6 +40,21 @@ Drawer makeDrawer(BuildContext context, int page) => Drawer(
.pushReplacement(platformRoute((p0) => const GraphView()));
},
),
ListTile(
leading: const Icon(Icons.loop),
title: Text(
AppLocalizations.of(context)!.recurringEntries,
),
selected: page == 3,
onTap: () {
if (page == 3) {
Navigator.of(context).pop();
return;
}
Navigator.of(context).pushReplacement(
platformRoute((p0) => const RecurringEntriesView()));
},
),
],
),
);

View file

@ -1,4 +1,3 @@
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:prasule/api/wallet.dart';

View file

@ -1,6 +1,5 @@
import 'dart:math';
import 'package:currency_picker/currency_picker.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
@ -26,6 +25,7 @@ import 'package:prasule/views/settings/settings.dart';
import 'package:prasule/views/settings/tessdata_list.dart';
import 'package:prasule/views/setup.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:url_launcher/url_launcher_string.dart';
class HomeView extends StatefulWidget {
const HomeView({super.key});
@ -197,6 +197,14 @@ class _HomeViewState extends State<HomeView> {
);
} else if (value == AppLocalizations.of(context)!.about) {
showAboutDialog(
children: [
PlatformButton(
text: AppLocalizations.of(context)!.sourceCode,
onPressed: () => launchUrlString(
"https://git.mnau.xyz/hernik/prasule",
mode: LaunchMode.externalApplication),
),
],
context: context,
applicationLegalese: AppLocalizations.of(context)!.license,
applicationName: "Prašule");

View file

@ -0,0 +1,27 @@
import 'package:flutter/material.dart';
import 'package:prasule/api/wallet.dart';
import 'package:prasule/util/drawer.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
class RecurringEntriesView extends StatefulWidget {
const RecurringEntriesView({super.key});
@override
State<RecurringEntriesView> createState() => _RecurringEntriesViewState();
}
class _RecurringEntriesViewState extends State<RecurringEntriesView> {
Wallet? selectedWallet;
List<Wallet> wallets = [];
String? locale;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(AppLocalizations.of(context)!.recurringEntries),
),
drawer: makeDrawer(context, 3),
);
}
}

View file

@ -85,10 +85,10 @@ packages:
dependency: "direct dev"
description:
name: build_runner
sha256: "10c6bcdbf9d049a0b666702cf1cee4ddfdc38f02a19d35ae392863b47519848b"
sha256: "67d591d602906ef9201caf93452495ad1812bea2074f04e25dbd7c133785821b"
url: "https://pub.dev"
source: hosted
version: "2.4.6"
version: "2.4.7"
build_runner_core:
dependency: transitive
description:
@ -109,10 +109,10 @@ packages:
dependency: transitive
description:
name: built_value
sha256: "723b4021e903217dfc445ec4cf5b42e27975aece1fc4ebbc1ca6329c2d9fb54e"
sha256: "69acb7007eb2a31dc901512bfe0f7b767168be34cb734835d54c070bfa74c1b2"
url: "https://pub.dev"
source: hosted
version: "8.7.0"
version: "8.8.0"
characters:
dependency: transitive
description:
@ -149,10 +149,10 @@ packages:
dependency: transitive
description:
name: code_builder
sha256: "1be9be30396d7e4c0db42c35ea6ccd7cc6a1e19916b5dc64d6ac216b5544d677"
sha256: b2151ce26a06171005b379ecff6e08d34c470180ffe16b8e14b6d52be292b55f
url: "https://pub.dev"
source: hosted
version: "4.7.0"
version: "4.8.0"
collection:
dependency: transitive
description:
@ -181,10 +181,10 @@ packages:
dependency: transitive
description:
name: cross_file
sha256: "445db18de832dba8d851e287aff8ccf169bed30d2e94243cb54c7d2f1ed2142c"
sha256: fedaadfa3a6996f75211d835aaeb8fede285dae94262485698afd832371b9a5e
url: "https://pub.dev"
source: hosted
version: "0.3.3+6"
version: "0.3.3+8"
crypto:
dependency: transitive
description:
@ -213,18 +213,18 @@ packages:
dependency: transitive
description:
name: dart_style
sha256: abd7625e16f51f554ea244d090292945ec4d4be7bfbaf2ec8cccea568919d334
sha256: "40ae61a5d43feea6d24bd22c0537a6629db858963b99b4bc1c3db80676f32368"
url: "https://pub.dev"
source: hosted
version: "2.3.3"
version: "2.3.4"
dio:
dependency: "direct main"
description:
name: dio
sha256: "417e2a6f9d83ab396ec38ff4ea5da6c254da71e4db765ad737a42af6930140b7"
sha256: "797e1e341c3dd2f69f2dad42564a6feff3bfb87187d05abb93b9609e6f1645c3"
url: "https://pub.dev"
source: hosted
version: "5.3.3"
version: "5.4.0"
dots_indicator:
dependency: transitive
description:
@ -317,10 +317,10 @@ packages:
dependency: "direct main"
description:
name: fl_chart
sha256: "6b9eb2b3017241d05c482c01f668dd05cc909ec9a0114fdd49acd958ff2432fa"
sha256: "5a74434cc83bf64346efb562f1a06eefaf1bcb530dc3d96a104f631a1eff8d79"
url: "https://pub.dev"
source: hosted
version: "0.64.0"
version: "0.65.0"
flutter:
dependency: "direct main"
description: flutter
@ -499,10 +499,10 @@ packages:
dependency: transitive
description:
name: http
sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525"
sha256: d4872660c46d929f6b8a9ef4e7a7eff7e49bbf0c4ec3f385ee32df5119175139
url: "https://pub.dev"
source: hosted
version: "1.1.0"
version: "1.1.2"
http_multi_server:
dependency: transitive
description:
@ -648,10 +648,10 @@ packages:
dependency: transitive
description:
name: leak_tracker
sha256: "7e108028e3d258667d079986da8c0bc32da4cb57431c2af03b1dc1038621a9dc"
sha256: "04be76c4a4bb50f14904e64749237e541e7c7bcf7ec0b196907322ab5d2fc739"
url: "https://pub.dev"
source: hosted
version: "9.0.13"
version: "9.0.16"
leak_tracker_testing:
dependency: transitive
description:
@ -800,10 +800,10 @@ packages:
dependency: transitive
description:
name: petitparser
sha256: eeb2d1428ee7f4170e2bd498827296a18d4e7fc462b71727d111c0ac7707cfa6
sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27
url: "https://pub.dev"
source: hosted
version: "6.0.1"
version: "6.0.2"
platform:
dependency: transitive
description:
@ -816,10 +816,10 @@ packages:
dependency: transitive
description:
name: plugin_platform_interface
sha256: da3fdfeccc4d4ff2da8f8c556704c08f912542c5fb3cf2233ed75372384a034d
sha256: f4f88d4a900933e7267e2b353594774fc0d07fb072b47eedcd5b54e1ea3269f8
url: "https://pub.dev"
source: hosted
version: "2.1.6"
version: "2.1.7"
pointycastle:
dependency: transitive
description:
@ -1041,6 +1041,70 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.2"
url_launcher:
dependency: "direct main"
description:
name: url_launcher
sha256: b1c9e98774adf8820c96fbc7ae3601231d324a7d5ebd8babe27b6dfac91357ba
url: "https://pub.dev"
source: hosted
version: "6.2.1"
url_launcher_android:
dependency: transitive
description:
name: url_launcher_android
sha256: "31222ffb0063171b526d3e569079cf1f8b294075ba323443fdc690842bfd4def"
url: "https://pub.dev"
source: hosted
version: "6.2.0"
url_launcher_ios:
dependency: transitive
description:
name: url_launcher_ios
sha256: bba3373219b7abb6b5e0d071b0fe66dfbe005d07517a68e38d4fc3638f35c6d3
url: "https://pub.dev"
source: hosted
version: "6.2.1"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
sha256: "9f2d390e096fdbe1e6e6256f97851e51afc2d9c423d3432f1d6a02a8a9a8b9fd"
url: "https://pub.dev"
source: hosted
version: "3.1.0"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
sha256: b7244901ea3cf489c5335bdacda07264a6e960b1c1b1a9f91e4bc371d9e68234
url: "https://pub.dev"
source: hosted
version: "3.1.0"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
sha256: "980e8d9af422f477be6948bdfb68df8433be71f5743a188968b0c1b887807e50"
url: "https://pub.dev"
source: hosted
version: "2.2.0"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
sha256: "138bd45b3a456dcfafc46d1a146787424f8d2edfbf2809c9324361e58f851cf7"
url: "https://pub.dev"
source: hosted
version: "2.2.1"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
sha256: "7754a1ad30ee896b265f8d14078b0513a4dba28d358eabb9d5f339886f4a1adc"
url: "https://pub.dev"
source: hosted
version: "3.1.0"
vector_math:
dependency: transitive
description:
@ -1069,10 +1133,10 @@ packages:
dependency: transitive
description:
name: web
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
sha256: edc8a9573dd8c5a83a183dae1af2b6fd4131377404706ca4e5420474784906fa
url: "https://pub.dev"
source: hosted
version: "0.3.0"
version: "0.4.0"
web_socket_channel:
dependency: transitive
description:
@ -1101,10 +1165,10 @@ packages:
dependency: transitive
description:
name: win32
sha256: "7c99c0e1e2fa190b48d25c81ca5e42036d5cac81430ef249027d97b0935c553f"
sha256: b0f37db61ba2f2e9b7a78a1caece0052564d1bc70668156cf3a29d676fe4e574
url: "https://pub.dev"
source: hosted
version: "5.1.0"
version: "5.1.1"
xdg_directories:
dependency: transitive
description:
@ -1117,10 +1181,10 @@ packages:
dependency: transitive
description:
name: xml
sha256: af5e77e9b83f2f4adc5d3f0a4ece1c7f45a2467b695c2540381bac793e34e556
sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226
url: "https://pub.dev"
source: hosted
version: "6.4.2"
version: "6.5.0"
yaml:
dependency: transitive
description:
@ -1130,5 +1194,5 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.2.0-194.0.dev <4.0.0"
flutter: ">=3.7.0"
dart: ">=3.2.0 <4.0.0"
flutter: ">=3.16.0"

View file

@ -16,7 +16,6 @@ dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
@ -38,7 +37,8 @@ dependencies:
flutter_slidable: ^3.0.0
flutter_localizations:
sdk: flutter
fl_chart: ^0.64.0
fl_chart: ^0.65.0
url_launcher: ^6.2.1
dev_dependencies:
flutter_test:
@ -76,7 +76,6 @@ flutter_launcher_icons:
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter packages.
flutter:
generate: true
@ -87,18 +86,14 @@ flutter:
assets:
- assets/
- assets/tessdata/
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a