From 432e7529374e70a0b5ed831fb23d4b1c156012e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maty=C3=A1=C5=A1=20Caras?= Date: Mon, 29 Jan 2024 18:47:01 +0100 Subject: [PATCH] fix: placeholder text as default in setup Also added currency symbol as prefix in the starting balance field, fixes #27 --- lib/l10n/app_cs.arb | 2 +- lib/l10n/app_en.arb | 2 +- lib/pw/platformfield.dart | 8 ++++++++ lib/views/setup.dart | 11 +++++++++-- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/lib/l10n/app_cs.arb b/lib/l10n/app_cs.arb index 489ffed..fce2785 100644 --- a/lib/l10n/app_cs.arb +++ b/lib/l10n/app_cs.arb @@ -7,7 +7,7 @@ "next": "Další", "back": "Zpět", "finish": "Dokončit", - "errorEmptyName": "Název nemůže být prázdný!", + "errorEmptyName": "Název peněženky nemůže být prázdný!", "welcome": "Vítejte!", "welcomeAboutPrasule": "Prašule je správce výdajů navržený pro lidi, kteří nechtějí vyplňovat každý malý detail.", "welcomeInstruction": "Na této obrazovce si nastavíte svoji 'peněženku', ve které budou zaznamenány vaše výdaje uspořádané do kategorií, které si nastavíte hned potom.", diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index e65d3a6..09441c3 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -7,7 +7,7 @@ "next": "Next", "back": "Back", "finish": "Finish", - "errorEmptyName": "Name cannot be empty", + "errorEmptyName": "Wallet name cannot be empty", "welcome": "Welcome!", "welcomeAboutPrasule": "Prašule is an expense tracker tool designed for people, who don't want to spend too much time filling in all the little details.", "welcomeInstruction": "On this screen you will set up your 'wallet', in which you will track your expenses categorized under categories, which you can later set in the settings menu.", diff --git a/lib/pw/platformfield.dart b/lib/pw/platformfield.dart index c45a0c0..4b891ca 100644 --- a/lib/pw/platformfield.dart +++ b/lib/pw/platformfield.dart @@ -23,6 +23,8 @@ class PlatformField extends PlatformWidget { this.maxLines = 1, this.focusNode, this.inputBorder = const OutlineInputBorder(), + this.suffix, + this.prefix, }); final TextEditingController? controller; final bool? enabled; @@ -38,6 +40,8 @@ class PlatformField extends PlatformWidget { final int? maxLines; final InputBorder inputBorder; final FocusNode? focusNode; + final Widget? suffix; + final Widget? prefix; @override TextField createAndroidWidget(BuildContext context) => TextField( @@ -48,6 +52,8 @@ class PlatformField extends PlatformWidget { decoration: InputDecoration( labelText: labelText, border: inputBorder, + suffix: suffix, + prefix: prefix, ), autocorrect: autocorrect, keyboardType: keyboardType, @@ -74,5 +80,7 @@ class PlatformField extends PlatformWidget { focusNode: focusNode, maxLines: maxLines, style: textStyle, + prefix: prefix, + suffix: suffix, ); } diff --git a/lib/views/setup.dart b/lib/views/setup.dart index f090ad3..5642d91 100644 --- a/lib/views/setup.dart +++ b/lib/views/setup.dart @@ -215,8 +215,10 @@ class _SetupViewState extends State { SizedBox( width: MediaQuery.of(context).size.width * 0.7, child: PlatformField( - labelText: - AppLocalizations.of(context).setupNamePlaceholder, + controller: TextEditingController( + text: + AppLocalizations.of(context).setupNamePlaceholder, + ), onChanged: (t) { name = t; }, @@ -249,11 +251,16 @@ class _SetupViewState extends State { keyboardType: const TextInputType.numberWithOptions( decimal: true, ), + controller: TextEditingController(text: "0.0"), inputFormatters: [ FilteringTextInputFormatter.allow( RegExp(r'\d+[\.,]{0,1}\d{0,}'), ), ], + prefix: Padding( + padding: const EdgeInsets.only(right: 4), + child: Text(_selectedCurrency.symbol), + ), onChanged: (t) { final b = double.tryParse(t); if (b == null) return;