Skip to content

Commit

Permalink
fixes review/13
Browse files Browse the repository at this point in the history
  • Loading branch information
karolgeneral committed Jul 17, 2024
1 parent 3dfb331 commit 7ecc528
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 23 deletions.
14 changes: 7 additions & 7 deletions lib/ i18n/strings.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/// Locales: 1
/// Strings: 19
///
/// Built on 2024-07-17 at 09:30 UTC
/// Built on 2024-07-17 at 11:41 UTC
// coverage:ignore-file
// ignore_for_file: type=lint
Expand Down Expand Up @@ -148,13 +148,13 @@ class Translations implements BaseTranslations<AppLocale, Translations> {

// Translations
String get appTitle => 'poly test codes';
String get title1 => 'Barcode List';
String get barcodeList => 'Barcode List';
String get description => 'Description';
String get code => 'Barcode';
String get addCode => 'Add Barcode';
String get type => 'Code Type';
String get codeTyp => 'Code Type';
late final _StringsErrorEn error = _StringsErrorEn._(_root);
String get codetype => 'Code type';
String get codeType => 'Code type';
late final _StringsBarcodesDescriptionEn barcodesDescription = _StringsBarcodesDescriptionEn._(_root);
}

Expand Down Expand Up @@ -195,15 +195,15 @@ extension on Translations {
dynamic _flatMapFunction(String path) {
switch (path) {
case 'appTitle': return 'poly test codes';
case 'title1': return 'Barcode List';
case 'barcodeList': return 'Barcode List';
case 'description': return 'Description';
case 'code': return 'Barcode';
case 'addCode': return 'Add Barcode';
case 'type': return 'Code Type';
case 'codeTyp': return 'Code Type';
case 'error.emptyDescription': return 'Description cannot be empty';
case 'error.emptyCode': return 'Barcode cannot be empty';
case 'error.invalidCode': return 'Invalid barcode';
case 'codetype': return 'Code type';
case 'codeType': return 'Code type';
case 'barcodesDescription.companyNotVerified': return 'Company not verified';
case 'barcodesDescription.companyVerifiedWithFullScores': return 'Company verified with full scores';
case 'barcodesDescription.companyVerifiedWithIncompleteScores': return 'Company verified with incomplete scores';
Expand Down
4 changes: 2 additions & 2 deletions lib/ i18n/strings.i18n.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"appTitle": "Kody testowe poli",
"title1": "Lista Kodów Kreskowych",
"barcodeList": "Lista Kodów Kreskowych",
"description": "Opis",
"code": "Kod kreskowy",
"addCode": "Dodaj kod kreskowy",
"type": "Typ kodu",
"Codetyp": "Typ kodu",
"error": {
"emptyDescription": "Opis nie może być pusty",
"emptoCode": "Kod kreskowy nie może być pusty",
Expand Down
6 changes: 3 additions & 3 deletions lib/ i18n/strings_en.i18n.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"appTitle": "poly test codes",
"title1": "Barcode List",
"barcodeList": "Barcode List",
"description": "Description",
"code": "Barcode",
"addCode": "Add Barcode",
"type": "Code Type",
"codeTyp": "Code Type",
"error": {
"emptyDescription": "Description cannot be empty",
"emptyCode": "Barcode cannot be empty",
"invalidCode": "Invalid barcode"
},
"codetype": "Code type",
"codeType": "Code type",
"barcodesDescription": {
"companyNotVerified": "Company not verified",
"companyVerifiedWithFullScores": "Company verified with full scores",
Expand Down
12 changes: 8 additions & 4 deletions lib/barcode_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,22 @@ class BarcodeItem {
data: "5905499300707",
type: Barcode.ean13()),
BarcodeItem(
description: translations.barcodesDescription.companyVerifiedWithFullScores,
description:
translations.barcodesDescription.companyVerifiedWithFullScores,
data: "5907632637572",
type: Barcode.ean13()),
BarcodeItem(
description: translations.barcodesDescription.companyVerifiedWithIncompleteScores,
description: translations
.barcodesDescription.companyVerifiedWithIncompleteScores,
data: "5900497025454",
type: Barcode.ean13()),
BarcodeItem(
description: translations.barcodesDescription.internalCode,
data: "00000000",
type: Barcode.ean8()),
BarcodeItem(
description: translations.barcodesDescription.companyRegisteredOutsidePoland,
description:
translations.barcodesDescription.companyRegisteredOutsidePoland,
data: "8680861069075",
type: Barcode.ean13()),
BarcodeItem(
Expand All @@ -47,7 +50,8 @@ class BarcodeItem {
data: "5906395053018",
type: Barcode.ean13()),
BarcodeItem(
description: translations.barcodesDescription.extendedCompanyDescription,
description:
translations.barcodesDescription.extendedCompanyDescription,
data: "9771644705002",
type: Barcode.ean13()),
];
Expand Down
2 changes: 1 addition & 1 deletion lib/barcodes_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class BarcodesPageState extends State<BarcodesPage> {
Widget build(context) {
return Scaffold(
appBar: AppBar(
title: Text(Translations.of(context).title1),
title: Text(Translations.of(context).barcodeList)
),
body: Padding(
padding: const EdgeInsets.all(8.0),
Expand Down
14 changes: 8 additions & 6 deletions lib/barcodes_panel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ class BarcodesPanelState extends State<BarcodesPanel> {
final barcodeType = _selectedBarcodeType;

setState(() {
_descriptionError =
description.isEmpty ? Translations.of(context).error.emptyDescription : null;
_dataError = data.isEmpty ? Translations.of(context).error.emptyCode : null;
_descriptionError = description.isEmpty
? Translations.of(context).error.emptyDescription
: null;
_dataError =
data.isEmpty ? Translations.of(context).error.emptyCode : null;

if (_descriptionError == null && _dataError == null) {
if (barcodeType.barcode.isValid(data)) {
Expand Down Expand Up @@ -88,7 +90,7 @@ class BarcodesPanelState extends State<BarcodesPanel> {
DropdownButtonFormField<custom.BarcodeType>(
value: _selectedBarcodeType,
decoration: InputDecoration(
labelText: Translations.of(context).codetype,
labelText: Translations.of(context).codeType,
),
items: custom.BarcodeType.values.map((custom.BarcodeType type) {
return DropdownMenuItem<custom.BarcodeType>(
Expand Down Expand Up @@ -119,8 +121,8 @@ class BarcodesPanelState extends State<BarcodesPanel> {
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_textField(_descriptionController, Translations.of(context).description,
_descriptionError),
_textField(_descriptionController,
Translations.of(context).description, _descriptionError),
const SizedBox(width: Constants.fieldSpacing),
_textField(
_dataController, Translations.of(context).code, _dataError),
Expand Down

0 comments on commit 7ecc528

Please sign in to comment.