FEATURE add translation

This commit is contained in:
konrad.lys@eu.equinix.com
2023-06-06 06:26:38 +02:00
parent bf0351f23f
commit fab33afc87
3 changed files with 21 additions and 10 deletions

View File

@@ -42,6 +42,8 @@ class ScannerPage extends StatefulWidget {
class _ScannerPageState extends State<ScannerPage> class _ScannerPageState extends State<ScannerPage>
with SingleTickerProviderStateMixin { with SingleTickerProviderStateMixin {
static const fkFileName = "filename";
final SliverOverlapAbsorberHandle searchBarHandle = final SliverOverlapAbsorberHandle searchBarHandle =
SliverOverlapAbsorberHandle(); SliverOverlapAbsorberHandle();
final SliverOverlapAbsorberHandle actionsHandle = final SliverOverlapAbsorberHandle actionsHandle =
@@ -147,7 +149,7 @@ class _ScannerPageState extends State<ScannerPage>
BlocBuilder<DocumentScannerCubit, List<File>>( BlocBuilder<DocumentScannerCubit, List<File>>(
builder: (context, state) { builder: (context, state) {
return TextButton.icon( return TextButton.icon(
label: Text("Export"), label: Text(S.of(context)!.export),
style: TextButton.styleFrom( style: TextButton.styleFrom(
padding: const EdgeInsets.fromLTRB(5, 10, 5, 10), padding: const EdgeInsets.fromLTRB(5, 10, 5, 10),
), ),
@@ -172,9 +174,11 @@ class _ScannerPageState extends State<ScannerPage>
autovalidateMode: autovalidateMode:
AutovalidateMode.always, AutovalidateMode.always,
validator: (value) { validator: (value) {
if (value == null || if (value?.trim().isEmpty ??
value.isEmpty) { true) {
return 'Please enter some text'; return S
.of(context)!
.thisFieldIsRequired;
} }
return null; return null;
}, },
@@ -182,12 +186,11 @@ class _ScannerPageState extends State<ScannerPage>
labelText: labelText:
S.of(context)!.fileName, S.of(context)!.fileName,
), ),
initialValue: "test", name: fkFileName,
name: 'filename',
)), )),
TextButton.icon( TextButton.icon(
label: const Text( label:
"Save a local copy"), Text(S.of(context)!.export),
icon: const Icon(Icons.download), icon: const Icon(Icons.download),
onPressed: () => { onPressed: () => {
if (_downloadFormKey if (_downloadFormKey
@@ -306,8 +309,8 @@ class _ScannerPageState extends State<ScannerPage>
//TODO: Ask user to grant permissions //TODO: Ask user to grant permissions
} }
} }
final name = (_downloadFormKey.currentState?.fields['filename']?.value ?? final name =
"") as String; _downloadFormKey.currentState?.fields[fkFileName]!.value as String;
var fileName = "$name.pdf"; var fileName = "$name.pdf";

View File

@@ -811,5 +811,9 @@
"goToLogin": "Go to login", "goToLogin": "Go to login",
"@goToLogin": { "@goToLogin": {
"description": "Label of the button shown on the login page to skip logging in to existing accounts and navigate user to login page" "description": "Label of the button shown on the login page to skip logging in to existing accounts and navigate user to login page"
},
"export": "Export",
"@export": {
"description": "Label for button that exports scanned images to pdf (before upload)"
} }
} }

View File

@@ -811,5 +811,9 @@
"goToLogin": "Przejdź do logowania", "goToLogin": "Przejdź do logowania",
"@goToLogin": { "@goToLogin": {
"description": "Label of the button shown on the login page to skip logging in to existing accounts and navigate user to login page" "description": "Label of the button shown on the login page to skip logging in to existing accounts and navigate user to login page"
},
"export": "Eksport",
"@export": {
"description": "Label for button that exports scanned images to pdf (before upload)"
} }
} }