Compare commits

..

1 commit

Author SHA1 Message Date
Matyáš Caras cf732041c5
Added translation using Weblate (Slovak) 2024-02-10 14:41:27 +01:00
9 changed files with 235 additions and 253 deletions

View file

@ -27,13 +27,6 @@ the three dots > 'About' or in app info in your device's setting
### What actually happened
<!-- Here describe what ACTUALLY happened -->
### Relevant logs
```
Paste your logs here
Make sure it is a codebloc
```
### Steps to reproduce
<!--
Enter the exact steps that you made when you encountered the bug,

View file

@ -16,9 +16,6 @@
- Graphs now display correct tooltips when displaying only income or only expenses
- Change graph container style when using light mode
- Make pie chart values more visible by adding the category's corresponding color as background
- Welcome text on Setup view is now centered
- Editing entries is now done by tapping the entry, instead of a dedicated button
# 1.0.0-alpha+5
- Add tests
- Add searching through entries to homepage

View file

@ -1,15 +1,3 @@
buildscript {
ext.kotlin_version = '1.9.22'
repositories {
google()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()

View file

@ -1,3 +1,5 @@
// ignore_for_file: inference_failure_on_function_invocation
import 'dart:async';
import 'package:dynamic_color/dynamic_color.dart';
@ -48,7 +50,6 @@ class _HomeViewState extends State<HomeView> {
var _filter = ""; // search filter
final searchFocus = FocusNode();
var sort = SortType.newest;
OverlayEntry? overlayEntry;
@override
void didChangeDependencies() {
@ -86,15 +87,11 @@ class _HomeViewState extends State<HomeView> {
if (b) return;
_searchActive = false;
_filter = "";
overlayEntry?.remove();
setState(() {});
},
child: Scaffold(
drawer: makeDrawer(context, 1),
floatingActionButton: SpeedDial(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(16)),
),
icon: Icons.add,
activeIcon: Icons.close,
children: [
@ -255,32 +252,6 @@ class _HomeViewState extends State<HomeView> {
_searchActive = !_searchActive;
if (!_searchActive) {
_filter = "";
} else {
overlayEntry = OverlayEntry(
builder: (context) => Align(
alignment: Alignment.bottomCenter,
child: SizedBox(
width: MediaQuery.of(context).size.width,
height:
MediaQuery.of(context).size.height - 100,
child: GestureDetector(
onTap: () {
if (!searchFocus.hasFocus) {
_searchActive = false;
_filter = "";
overlayEntry?.remove();
setState(() {});
return;
}
searchFocus.unfocus();
},
),
),
),
);
Overlay.of(context).insert(
overlayEntry!,
);
}
setState(() {});
}
@ -442,9 +413,45 @@ class _HomeViewState extends State<HomeView> {
: groupSortOldest(a, b, locale),
itemBuilder: (context, element) => Slidable(
endActionPane: ActionPane(
extentRatio: 0.3,
motion: const ScrollMotion(),
children: [
SlidableAction(
onPressed: (c) {
Navigator.of(context)
.push<WalletSingleEntry>(
MaterialPageRoute(
builder: (c) =>
CreateSingleEntryView(
locale: locale,
w: selectedWallet!,
editEntry: element,
),
),
)
.then(
(editedEntry) {
if (editedEntry == null) {
return;
}
selectedWallet!.entries
.remove(element);
selectedWallet!.entries
.add(editedEntry);
WalletManager.saveWallet(
selectedWallet!,
);
setState(() {});
},
);
},
backgroundColor: Theme.of(context)
.colorScheme
.secondary,
foregroundColor: Theme.of(context)
.colorScheme
.onSecondary,
icon: Icons.edit,
),
SlidableAction(
backgroundColor: Theme.of(context)
.colorScheme
@ -454,7 +461,7 @@ class _HomeViewState extends State<HomeView> {
.onError,
icon: Icons.delete,
onPressed: (c) {
showAdaptiveDialog<void>(
showAdaptiveDialog(
context: context,
builder: (cx) =>
AlertDialog.adaptive(
@ -504,34 +511,6 @@ class _HomeViewState extends State<HomeView> {
],
),
child: ListTile(
onTap: () {
Navigator.of(context)
.push<WalletSingleEntry>(
MaterialPageRoute(
builder: (c) =>
CreateSingleEntryView(
locale: locale,
w: selectedWallet!,
editEntry: element,
),
),
)
.then(
(editedEntry) {
if (editedEntry == null) {
return;
}
selectedWallet!.entries
.remove(element);
selectedWallet!.entries
.add(editedEntry);
WalletManager.saveWallet(
selectedWallet!,
);
setState(() {});
},
);
},
leading: Container(
decoration: BoxDecoration(
borderRadius:
@ -602,6 +581,25 @@ class _HomeViewState extends State<HomeView> {
],
),
),
if (_searchActive)
OverlayEntry(
builder: (context) => SizedBox(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
child: GestureDetector(
onTap: () {
if (!_searchActive) return;
if (!searchFocus.hasFocus) {
_searchActive = false;
_filter = "";
setState(() {});
return;
}
searchFocus.unfocus();
},
),
),
),
],
),
),
@ -614,7 +612,7 @@ class _HomeViewState extends State<HomeView> {
final availableLanguages = await TessdataApi.getDownloadedData();
if (availableLanguages.isEmpty) {
if (!mounted) return;
await showAdaptiveDialog<void>(
await showAdaptiveDialog(
context: context,
builder: (c) => AlertDialog.adaptive(
title: Text(AppLocalizations.of(context).missingOcr),
@ -647,7 +645,7 @@ class _HomeViewState extends State<HomeView> {
List<bool>.filled(availableLanguages.length, false);
selectedLanguages[0] = true;
await showAdaptiveDialog<void>(
await showAdaptiveDialog(
context: context,
builder: (c) => StatefulBuilder(
builder: (ctx, setState) => AlertDialog.adaptive(

View file

@ -1,3 +1,5 @@
// ignore_for_file: inference_failure_on_function_invocation
import 'dart:async';
import 'package:flutter/material.dart';
@ -123,6 +125,7 @@ class _RecurringEntriesViewState extends State<RecurringEntriesView> {
],
),
floatingActionButton: FloatingActionButton(
shape: const CircleBorder(),
child: const Icon(Icons.add),
onPressed: () {
Navigator.of(context).push(
@ -167,8 +170,38 @@ class _RecurringEntriesViewState extends State<RecurringEntriesView> {
itemBuilder: (c, i) => Slidable(
endActionPane: ActionPane(
motion: const ScrollMotion(),
extentRatio: 0.3,
children: [
SlidableAction(
onPressed: (c) {
Navigator.of(context)
.push<RecurringWalletEntry>(
MaterialPageRoute(
builder: (c) => CreateRecurringEntryView(
w: selectedWallet!,
locale: locale,
editEntry:
selectedWallet!.recurringEntries[i],
),
),
)
.then(
(editedEntry) {
if (editedEntry == null) return;
selectedWallet!.entries.remove(
selectedWallet!.recurringEntries[i],
);
selectedWallet!.entries.add(editedEntry);
WalletManager.saveWallet(selectedWallet!);
setState(() {});
},
);
},
backgroundColor:
Theme.of(context).colorScheme.secondary,
foregroundColor:
Theme.of(context).colorScheme.onSecondary,
icon: Icons.edit,
),
SlidableAction(
backgroundColor:
Theme.of(context).colorScheme.error,
@ -176,7 +209,7 @@ class _RecurringEntriesViewState extends State<RecurringEntriesView> {
Theme.of(context).colorScheme.onError,
icon: Icons.delete,
onPressed: (c) {
showDialog<void>(
showDialog(
context: context,
builder: (cx) => AlertDialog.adaptive(
title: Text(
@ -214,30 +247,6 @@ class _RecurringEntriesViewState extends State<RecurringEntriesView> {
],
),
child: ListTile(
onTap: () {
Navigator.of(context)
.push<RecurringWalletEntry>(
MaterialPageRoute(
builder: (c) => CreateRecurringEntryView(
w: selectedWallet!,
locale: locale,
editEntry:
selectedWallet!.recurringEntries[i],
),
),
)
.then(
(editedEntry) {
if (editedEntry == null) return;
selectedWallet!.entries.remove(
selectedWallet!.recurringEntries[i],
);
selectedWallet!.entries.add(editedEntry);
WalletManager.saveWallet(selectedWallet!);
setState(() {});
},
);
},
leading: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),

View file

@ -1,3 +1,5 @@
// ignore_for_file: inference_failure_on_function_invocation
import 'dart:async';
import 'package:dynamic_color/dynamic_color.dart';
@ -120,27 +122,6 @@ class _EditCategoriesViewState extends State<EditCategoriesView> {
AppLocalizations.of(context).setupCategoriesEditHint,
textAlign: TextAlign.center,
),
IconButton(
onPressed: () async {
selectedWallet!.categories.add(
WalletCategory(
name: AppLocalizations.of(context)
.setupWalletNamePlaceholder,
id: selectedWallet!.nextCategoryId,
icon: IconData(
Icons.question_mark.codePoint,
fontFamily: 'MaterialIcons',
),
color: Colors.blueGrey.harmonizeWith(
Theme.of(context).colorScheme.primary,
),
),
);
await WalletManager.saveWallet(selectedWallet!);
setState(() {});
},
icon: const Icon(Icons.add),
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.64,
child: ListView.builder(
@ -161,7 +142,7 @@ class _EditCategoriesViewState extends State<EditCategoriesView> {
.getBool("useMaterialYou") ??
false;
if (!context.mounted) return;
await showAdaptiveDialog<void>(
await showAdaptiveDialog(
context: context,
builder: (c) => AlertDialog.adaptive(
actions: [
@ -230,7 +211,7 @@ class _EditCategoriesViewState extends State<EditCategoriesView> {
final controller = TextEditingController(
text: selectedWallet!.categories[i].name,
);
showAdaptiveDialog<void>(
showAdaptiveDialog(
context: context,
builder: (c) => AlertDialog.adaptive(
actions: [
@ -281,6 +262,27 @@ class _EditCategoriesViewState extends State<EditCategoriesView> {
itemCount: selectedWallet!.categories.length,
),
),
IconButton(
onPressed: () async {
selectedWallet!.categories.add(
WalletCategory(
name: AppLocalizations.of(context)
.setupWalletNamePlaceholder,
id: selectedWallet!.nextCategoryId,
icon: IconData(
Icons.question_mark.codePoint,
fontFamily: 'MaterialIcons',
),
color: Colors.blueGrey.harmonizeWith(
Theme.of(context).colorScheme.primary,
),
),
);
await WalletManager.saveWallet(selectedWallet!);
setState(() {});
},
icon: const Icon(Icons.add),
),
],
),
);

View file

@ -1,3 +1,5 @@
// ignore_for_file: inference_failure_on_function_invocation
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:settings_ui/settings_ui.dart';
@ -47,56 +49,53 @@ class _GraphTypeSettingsViewState extends State<GraphTypeSettingsView> {
? AppLocalizations.of(context).barChart
: AppLocalizations.of(context).lineChart,
),
onPressed: (c) => showAdaptiveDialog<void>(
onPressed: (c) => showAdaptiveDialog(
context: c,
builder: (ctx) => AlertDialog.adaptive(
title: Text(AppLocalizations.of(context).selectType),
content: SizedBox(
height: 80,
child: Column(
children: [
SizedBox(
width: MediaQuery.of(ctx).size.width,
child: InkWell(
child: Padding(
padding: const EdgeInsets.all(8),
child: Text(
AppLocalizations.of(context).barChart,
textAlign: TextAlign.center,
),
content: Column(
children: [
SizedBox(
width: MediaQuery.of(ctx).size.width,
child: InkWell(
child: Padding(
padding: const EdgeInsets.all(8),
child: Text(
AppLocalizations.of(context).barChart,
textAlign: TextAlign.center,
),
onTap: () async {
final s = await SharedPreferences.getInstance();
await s.setInt("yearlygraph", 1);
_yearly = 1;
if (!ctx.mounted) return;
Navigator.of(ctx).pop();
setState(() {});
},
),
onTap: () async {
final s = await SharedPreferences.getInstance();
await s.setInt("yearlygraph", 1);
_yearly = 1;
if (!ctx.mounted) return;
Navigator.of(ctx).pop();
setState(() {});
},
),
SizedBox(
width: MediaQuery.of(context).size.width,
child: InkWell(
child: Padding(
padding: const EdgeInsets.all(8),
child: Text(
AppLocalizations.of(context).lineChart,
textAlign: TextAlign.center,
),
),
SizedBox(
width: MediaQuery.of(context).size.width,
child: InkWell(
child: Padding(
padding: const EdgeInsets.all(8),
child: Text(
AppLocalizations.of(context).lineChart,
textAlign: TextAlign.center,
),
onTap: () async {
final s = await SharedPreferences.getInstance();
await s.setInt("yearlygraph", 2);
_yearly = 2;
if (!ctx.mounted) return;
Navigator.of(ctx).pop();
setState(() {});
},
),
onTap: () async {
final s = await SharedPreferences.getInstance();
await s.setInt("yearlygraph", 2);
_yearly = 2;
if (!ctx.mounted) return;
Navigator.of(ctx).pop();
setState(() {});
},
),
],
),
),
],
),
),
),
@ -108,56 +107,53 @@ class _GraphTypeSettingsViewState extends State<GraphTypeSettingsView> {
? AppLocalizations.of(context).barChart
: AppLocalizations.of(context).lineChart,
),
onPressed: (c) => showAdaptiveDialog<void>(
onPressed: (c) => showDialog(
context: c,
builder: (ctx) => AlertDialog.adaptive(
title: Text(AppLocalizations.of(context).selectType),
content: SizedBox(
height: 80,
child: Column(
children: [
SizedBox(
width: MediaQuery.of(ctx).size.width,
child: InkWell(
child: Padding(
padding: const EdgeInsets.all(8),
child: Text(
AppLocalizations.of(context).barChart,
textAlign: TextAlign.center,
),
content: Column(
children: [
SizedBox(
width: MediaQuery.of(ctx).size.width,
child: InkWell(
child: Padding(
padding: const EdgeInsets.all(8),
child: Text(
AppLocalizations.of(context).barChart,
textAlign: TextAlign.center,
),
onTap: () async {
final s = await SharedPreferences.getInstance();
await s.setInt("monthlygraph", 1);
_monthly = 1;
if (!ctx.mounted) return;
Navigator.of(ctx).pop();
setState(() {});
},
),
onTap: () async {
final s = await SharedPreferences.getInstance();
await s.setInt("monthlygraph", 1);
_monthly = 1;
if (!ctx.mounted) return;
Navigator.of(ctx).pop();
setState(() {});
},
),
SizedBox(
width: MediaQuery.of(ctx).size.width,
child: InkWell(
child: Padding(
padding: const EdgeInsets.all(8),
child: Text(
AppLocalizations.of(context).lineChart,
textAlign: TextAlign.center,
),
),
SizedBox(
width: MediaQuery.of(ctx).size.width,
child: InkWell(
child: Padding(
padding: const EdgeInsets.all(8),
child: Text(
AppLocalizations.of(context).lineChart,
textAlign: TextAlign.center,
),
onTap: () async {
final s = await SharedPreferences.getInstance();
await s.setInt("monthlygraph", 2);
_monthly = 2;
if (!ctx.mounted) return;
Navigator.of(ctx).pop();
setState(() {});
},
),
onTap: () async {
final s = await SharedPreferences.getInstance();
await s.setInt("monthlygraph", 2);
_monthly = 2;
if (!ctx.mounted) return;
Navigator.of(ctx).pop();
setState(() {});
},
),
],
),
),
],
),
),
),

View file

@ -1,3 +1,5 @@
// ignore_for_file: inference_failure_on_function_invocation
import 'dart:async';
import 'dart:io';
@ -59,7 +61,7 @@ class _TessdataListViewState extends State<TessdataListView> {
final lang = _tessdata[i].keys.first;
if (_tessdata[i][lang]!) {
// deleting data
await showAdaptiveDialog<void>(
await showAdaptiveDialog(
context: context,
builder: (context) => AlertDialog.adaptive(
title:
@ -99,10 +101,8 @@ class _TessdataListViewState extends State<TessdataListView> {
showAdaptiveDialog(
context: context,
builder: (c) => AlertDialog.adaptive(
title: Text(
AppLocalizations.of(context)
.langDownloadDialog(lang),
),
title: Text(AppLocalizations.of(context)
.langDownloadDialog(lang),),
content: StreamBuilder(
builder: (context, snapshot) {
if (snapshot.connectionState ==
@ -152,7 +152,6 @@ class _TessdataListViewState extends State<TessdataListView> {
/// so we can show it to the user
Future<void> loadAllTessdata() async {
final tessDir = Directory(await FlutterTesseractOcr.getTessdataPath());
if (!tessDir.existsSync()) tessDir.createSync(recursive: true);
final d = await TessdataApi.getAvailableData();
final dataStatus = <Map<String, bool>>[];
for (final data in d) {

View file

@ -1,3 +1,5 @@
// ignore_for_file: inference_failure_on_function_invocation
import 'dart:async';
import 'package:currency_picker/currency_picker.dart';
@ -195,17 +197,15 @@ class _SetupViewState extends State<SetupView> {
Flexible(
child: Text(
AppLocalizations.of(context).welcomeAboutPrasule,
textAlign: TextAlign.center,
),
),
if (!widget.newWallet)
const SizedBox(
height: 8,
height: 5,
),
Flexible(
child: Text(
AppLocalizations.of(context).welcomeInstruction,
textAlign: TextAlign.center,
),
),
],
@ -303,32 +303,6 @@ class _SetupViewState extends State<SetupView> {
AppLocalizations.of(context).setupCategoriesEditHint,
textAlign: TextAlign.center,
),
IconButton(
onPressed: () {
var id = 0;
while (categories
.where((element) => element.id == id)
.isNotEmpty) {
id++; // create unique ID
}
categories.add(
WalletCategory(
name: AppLocalizations.of(context)
.setupWalletNamePlaceholder,
id: id,
icon: IconData(
Icons.question_mark.codePoint,
fontFamily: 'MaterialIcons',
),
color: Colors.blueGrey.harmonizeWith(
Theme.of(context).colorScheme.primary,
),
),
);
setState(() {});
},
icon: const Icon(Icons.add),
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.64,
child: ListView.builder(
@ -347,7 +321,7 @@ class _SetupViewState extends State<SetupView> {
.getBool("useMaterialYou") ??
false;
if (!context.mounted) return;
await showAdaptiveDialog<void>(
await showAdaptiveDialog(
context: context,
builder: (c) => AlertDialog.adaptive(
actions: [
@ -414,7 +388,7 @@ class _SetupViewState extends State<SetupView> {
final controller = TextEditingController(
text: categories[i].name,
);
showAdaptiveDialog<void>(
showAdaptiveDialog(
context: context,
builder: (c) => AlertDialog.adaptive(
actions: [
@ -465,6 +439,32 @@ class _SetupViewState extends State<SetupView> {
itemCount: categories.length,
),
),
IconButton(
onPressed: () {
var id = 0;
while (categories
.where((element) => element.id == id)
.isNotEmpty) {
id++; // create unique ID
}
categories.add(
WalletCategory(
name: AppLocalizations.of(context)
.setupWalletNamePlaceholder,
id: id,
icon: IconData(
Icons.question_mark.codePoint,
fontFamily: 'MaterialIcons',
),
color: Colors.blueGrey.harmonizeWith(
Theme.of(context).colorScheme.primary,
),
),
);
setState(() {});
},
icon: const Icon(Icons.add),
),
],
),
),