Compare commits

...

9 commits

Author SHA1 Message Date
Matyáš Caras
96135f0bf5
fix: overlay not working 2024-02-10 16:16:34 +01:00
Matyáš Caras
6a25c8289c
fix: settings style 2024-02-10 16:00:15 +01:00
Matyáš Caras
d7a8233f6b
fix: edit on tap now 2024-02-10 15:52:36 +01:00
Matyáš Caras
771f7a3555
fix: move new category button to the top 2024-02-10 15:42:05 +01:00
Matyáš Caras
131ebfb8ce
fix: center text on setup 2024-02-10 15:22:30 +01:00
Matyáš Caras
ba3b4e556b
fix: adhere to lints without ignore 2024-02-10 15:14:58 +01:00
Matyáš Caras
43adaaf648
fix: change Kotlin version 2024-02-10 14:59:48 +01:00
Matyáš Caras
b4cbfe8f08
fix: unify FAB style 2024-02-10 14:59:33 +01:00
Matyáš Caras
d3b0b1bee3
docs: add logs section to bugreport 2024-02-10 14:59:22 +01:00
9 changed files with 253 additions and 235 deletions

View file

@ -27,6 +27,13 @@ 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,6 +16,9 @@
- 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,3 +1,15 @@
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,5 +1,3 @@
// ignore_for_file: inference_failure_on_function_invocation
import 'dart:async';
import 'package:dynamic_color/dynamic_color.dart';
@ -50,6 +48,7 @@ class _HomeViewState extends State<HomeView> {
var _filter = ""; // search filter
final searchFocus = FocusNode();
var sort = SortType.newest;
OverlayEntry? overlayEntry;
@override
void didChangeDependencies() {
@ -87,11 +86,15 @@ 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: [
@ -252,6 +255,32 @@ 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(() {});
}
@ -413,45 +442,9 @@ 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
@ -461,7 +454,7 @@ class _HomeViewState extends State<HomeView> {
.onError,
icon: Icons.delete,
onPressed: (c) {
showAdaptiveDialog(
showAdaptiveDialog<void>(
context: context,
builder: (cx) =>
AlertDialog.adaptive(
@ -511,6 +504,34 @@ 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:
@ -581,25 +602,6 @@ 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();
},
),
),
),
],
),
),
@ -612,7 +614,7 @@ class _HomeViewState extends State<HomeView> {
final availableLanguages = await TessdataApi.getDownloadedData();
if (availableLanguages.isEmpty) {
if (!mounted) return;
await showAdaptiveDialog(
await showAdaptiveDialog<void>(
context: context,
builder: (c) => AlertDialog.adaptive(
title: Text(AppLocalizations.of(context).missingOcr),
@ -645,7 +647,7 @@ class _HomeViewState extends State<HomeView> {
List<bool>.filled(availableLanguages.length, false);
selectedLanguages[0] = true;
await showAdaptiveDialog(
await showAdaptiveDialog<void>(
context: context,
builder: (c) => StatefulBuilder(
builder: (ctx, setState) => AlertDialog.adaptive(

View file

@ -1,5 +1,3 @@
// ignore_for_file: inference_failure_on_function_invocation
import 'dart:async';
import 'package:flutter/material.dart';
@ -125,7 +123,6 @@ class _RecurringEntriesViewState extends State<RecurringEntriesView> {
],
),
floatingActionButton: FloatingActionButton(
shape: const CircleBorder(),
child: const Icon(Icons.add),
onPressed: () {
Navigator.of(context).push(
@ -170,38 +167,8 @@ 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,
@ -209,7 +176,7 @@ class _RecurringEntriesViewState extends State<RecurringEntriesView> {
Theme.of(context).colorScheme.onError,
icon: Icons.delete,
onPressed: (c) {
showDialog(
showDialog<void>(
context: context,
builder: (cx) => AlertDialog.adaptive(
title: Text(
@ -247,6 +214,30 @@ 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,5 +1,3 @@
// ignore_for_file: inference_failure_on_function_invocation
import 'dart:async';
import 'package:dynamic_color/dynamic_color.dart';
@ -122,6 +120,27 @@ 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(
@ -142,7 +161,7 @@ class _EditCategoriesViewState extends State<EditCategoriesView> {
.getBool("useMaterialYou") ??
false;
if (!context.mounted) return;
await showAdaptiveDialog(
await showAdaptiveDialog<void>(
context: context,
builder: (c) => AlertDialog.adaptive(
actions: [
@ -211,7 +230,7 @@ class _EditCategoriesViewState extends State<EditCategoriesView> {
final controller = TextEditingController(
text: selectedWallet!.categories[i].name,
);
showAdaptiveDialog(
showAdaptiveDialog<void>(
context: context,
builder: (c) => AlertDialog.adaptive(
actions: [
@ -262,27 +281,6 @@ 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,5 +1,3 @@
// 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';
@ -49,53 +47,56 @@ class _GraphTypeSettingsViewState extends State<GraphTypeSettingsView> {
? AppLocalizations.of(context).barChart
: AppLocalizations.of(context).lineChart,
),
onPressed: (c) => showAdaptiveDialog(
onPressed: (c) => showAdaptiveDialog<void>(
context: c,
builder: (ctx) => AlertDialog.adaptive(
title: Text(AppLocalizations.of(context).selectType),
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,
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,
),
),
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(() {});
},
),
),
],
],
),
),
),
),
@ -107,53 +108,56 @@ class _GraphTypeSettingsViewState extends State<GraphTypeSettingsView> {
? AppLocalizations.of(context).barChart
: AppLocalizations.of(context).lineChart,
),
onPressed: (c) => showDialog(
onPressed: (c) => showAdaptiveDialog<void>(
context: c,
builder: (ctx) => AlertDialog.adaptive(
title: Text(AppLocalizations.of(context).selectType),
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,
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,
),
),
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,5 +1,3 @@
// ignore_for_file: inference_failure_on_function_invocation
import 'dart:async';
import 'dart:io';
@ -61,7 +59,7 @@ class _TessdataListViewState extends State<TessdataListView> {
final lang = _tessdata[i].keys.first;
if (_tessdata[i][lang]!) {
// deleting data
await showAdaptiveDialog(
await showAdaptiveDialog<void>(
context: context,
builder: (context) => AlertDialog.adaptive(
title:
@ -101,8 +99,10 @@ 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,6 +152,7 @@ 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,5 +1,3 @@
// ignore_for_file: inference_failure_on_function_invocation
import 'dart:async';
import 'package:currency_picker/currency_picker.dart';
@ -197,15 +195,17 @@ class _SetupViewState extends State<SetupView> {
Flexible(
child: Text(
AppLocalizations.of(context).welcomeAboutPrasule,
textAlign: TextAlign.center,
),
),
if (!widget.newWallet)
const SizedBox(
height: 5,
height: 8,
),
Flexible(
child: Text(
AppLocalizations.of(context).welcomeInstruction,
textAlign: TextAlign.center,
),
),
],
@ -303,6 +303,32 @@ 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(
@ -321,7 +347,7 @@ class _SetupViewState extends State<SetupView> {
.getBool("useMaterialYou") ??
false;
if (!context.mounted) return;
await showAdaptiveDialog(
await showAdaptiveDialog<void>(
context: context,
builder: (c) => AlertDialog.adaptive(
actions: [
@ -388,7 +414,7 @@ class _SetupViewState extends State<SetupView> {
final controller = TextEditingController(
text: categories[i].name,
);
showAdaptiveDialog(
showAdaptiveDialog<void>(
context: context,
builder: (c) => AlertDialog.adaptive(
actions: [
@ -439,32 +465,6 @@ 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),
),
],
),
),