Compare commits
5 commits
b688b8e32d
...
cd2b6f7084
Author | SHA1 | Date | |
---|---|---|---|
|
cd2b6f7084 | ||
|
1556b9bd1e | ||
|
ae07720854 | ||
|
5520655e32 | ||
|
dab4448c14 |
7 changed files with 72 additions and 31 deletions
|
@ -9,6 +9,8 @@
|
|||
- Make search case-insensitive
|
||||
- Added titles above graphs
|
||||
- Some extra optimization for iOS
|
||||
- Fix starting balance not saving
|
||||
- Fix overlay disabling tappig on edit/delete buttons on home view
|
||||
# 1.0.0-alpha+5
|
||||
- Add tests
|
||||
- Add searching through entries to homepage
|
||||
|
|
|
@ -113,5 +113,6 @@
|
|||
"search":"Prohledat",
|
||||
"expensesPerYear":"Měsíční výdaje v roce {year}",
|
||||
"expensesPerMonth":"Denní výdaje během měsíce {monthYear}",
|
||||
"expensesPerCategory":"Total expenses per category"
|
||||
"expensesPerCategory":"Total expenses per category",
|
||||
"date":"Datum"
|
||||
}
|
|
@ -247,5 +247,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"expensesPerCategory":"Total expenses per category"
|
||||
"expensesPerCategory":"Total expenses per category",
|
||||
"date":"Date"
|
||||
}
|
1
lib/l10n/app_sk.arb
Normal file
1
lib/l10n/app_sk.arb
Normal file
|
@ -0,0 +1 @@
|
|||
{}
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:prasule/api/category.dart';
|
||||
import 'package:prasule/api/entry_data.dart';
|
||||
import 'package:prasule/api/wallet.dart';
|
||||
|
@ -13,7 +14,12 @@ import 'package:prasule/util/show_message.dart';
|
|||
/// Used when user wants to add new entry
|
||||
class CreateSingleEntryView extends StatefulWidget {
|
||||
/// Used when user wants to add new entry
|
||||
const CreateSingleEntryView({required this.w, super.key, this.editEntry});
|
||||
const CreateSingleEntryView({
|
||||
required this.w,
|
||||
super.key,
|
||||
this.editEntry,
|
||||
required this.locale,
|
||||
});
|
||||
|
||||
/// The wallet, where the entry will be saved to
|
||||
final Wallet w;
|
||||
|
@ -23,6 +29,8 @@ class CreateSingleEntryView extends StatefulWidget {
|
|||
/// Is null unless we are editing an existing entry
|
||||
final WalletSingleEntry? editEntry;
|
||||
|
||||
final String locale;
|
||||
|
||||
@override
|
||||
State createState() => _CreateSingleEntryViewState();
|
||||
}
|
||||
|
@ -184,6 +192,33 @@ class _CreateSingleEntryViewState extends State<CreateSingleEntryView> {
|
|||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Text(AppLocalizations.of(context).date),
|
||||
PlatformButton(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateProperty.all(
|
||||
Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
foregroundColor: MaterialStateProperty.all(
|
||||
Theme.of(context).colorScheme.onPrimary,
|
||||
),
|
||||
),
|
||||
text: DateFormat.yMMMMd(widget.locale).format(newEntry.date),
|
||||
onPressed: () async {
|
||||
final date = await showDatePicker(
|
||||
initialDate: newEntry.date,
|
||||
context: context,
|
||||
firstDate: DateTime.now()
|
||||
.subtract(const Duration(days: 20 * 365)),
|
||||
lastDate: DateTime.now().add(const Duration(days: 365)),
|
||||
);
|
||||
if (date == null) return;
|
||||
newEntry.date = date;
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
|
|
|
@ -117,7 +117,10 @@ class _HomeViewState extends State<HomeView> {
|
|||
onTap: () async {
|
||||
final sw = await Navigator.of(context).push<Wallet>(
|
||||
MaterialPageRoute(
|
||||
builder: (c) => CreateSingleEntryView(w: selectedWallet!),
|
||||
builder: (c) => CreateSingleEntryView(
|
||||
w: selectedWallet!,
|
||||
locale: locale,
|
||||
),
|
||||
),
|
||||
);
|
||||
if (sw != null) {
|
||||
|
@ -419,6 +422,7 @@ class _HomeViewState extends State<HomeView> {
|
|||
MaterialPageRoute(
|
||||
builder: (c) =>
|
||||
CreateSingleEntryView(
|
||||
locale: locale,
|
||||
w: selectedWallet!,
|
||||
editEntry: element,
|
||||
),
|
||||
|
@ -577,24 +581,25 @@ class _HomeViewState extends State<HomeView> {
|
|||
],
|
||||
),
|
||||
),
|
||||
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();
|
||||
},
|
||||
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();
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -710,6 +715,7 @@ class _HomeViewState extends State<HomeView> {
|
|||
await Navigator.of(context).push<WalletSingleEntry>(
|
||||
platformRoute<WalletSingleEntry>(
|
||||
(c) => CreateSingleEntryView(
|
||||
locale: locale,
|
||||
w: selectedWallet!,
|
||||
editEntry: WalletSingleEntry(
|
||||
data: EntryData(
|
||||
|
|
|
@ -51,7 +51,7 @@ class _SetupViewState extends State<SetupView> {
|
|||
);
|
||||
List<WalletCategory> categories = <WalletCategory>[];
|
||||
String name = "";
|
||||
double balance = 0;
|
||||
final _balanceController = TextEditingController(text: "0.0");
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
|
@ -155,10 +155,10 @@ class _SetupViewState extends State<SetupView> {
|
|||
return;
|
||||
}
|
||||
final wallet = Wallet(
|
||||
name: name,
|
||||
currency: _selectedCurrency,
|
||||
categories: categories,
|
||||
);
|
||||
name: name,
|
||||
currency: _selectedCurrency,
|
||||
categories: categories,
|
||||
starterBalance: double.parse(_balanceController.text));
|
||||
await WalletManager.saveWallet(wallet);
|
||||
|
||||
if (widget.newWallet && context.mounted) {
|
||||
|
@ -267,7 +267,7 @@ class _SetupViewState extends State<SetupView> {
|
|||
keyboardType: const TextInputType.numberWithOptions(
|
||||
decimal: true,
|
||||
),
|
||||
controller: TextEditingController(text: "0.0"),
|
||||
controller: _balanceController,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(
|
||||
RegExp(r'\d+[\.,]{0,1}\d{0,}'),
|
||||
|
@ -277,11 +277,6 @@ class _SetupViewState extends State<SetupView> {
|
|||
padding: const EdgeInsets.only(right: 4),
|
||||
child: Text(_selectedCurrency.symbol),
|
||||
),
|
||||
onChanged: (t) {
|
||||
final b = double.tryParse(t);
|
||||
if (b == null) return;
|
||||
balance = b;
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
Loading…
Reference in a new issue