Skip to content

Commit

Permalink
fix: add extension to change null address to new value
Browse files Browse the repository at this point in the history
kamilfedio committed Aug 7, 2024
1 parent 79aee7d commit 4e53fbe
Showing 3 changed files with 15 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/features/buildings_view/building_tile.dart
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ import "../../utils/context_extensions.dart";
import "../../widgets/wide_tile_card.dart";
import "controllers.dart";
import "model/building_model.dart";
import "utils.dart";

class BuildingTile extends ConsumerWidget {
const BuildingTile(
@@ -23,7 +24,7 @@ class BuildingTile extends ConsumerWidget {
activeGradient: context.colorTheme.toPwrGradient,
photoUrl: building.cover?.filename_disk.directusUrl,
title: "${context.localize.building_prefix} ${building.name}",
subtitle: building.addresFormatted,
subtitle: building.addresFormatted.changeNull(),
isActive: isActive,
onTap: () {
ref.read(buildingsMapControllerProvider.notifier).onMarkerTap(building);
11 changes: 11 additions & 0 deletions lib/features/buildings_view/utils.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import "package:flutter_gen/gen_l10n/app_localizations_pl.dart";
import "../../config/map_view_config.dart";

extension ContainsCaseUnsensitive on String? {
@@ -16,3 +17,13 @@ extension ContainsCaseUnsensitive on String? {
false;
}
}

extension ChangeNullAdress on String? {
String? changeNull() {
if (this == null) {
return AppLocalizationsPl().no_address;
} else {
return this;
}
}
}
3 changes: 2 additions & 1 deletion lib/l10n/app_pl.arb
Original file line number Diff line number Diff line change
@@ -70,7 +70,8 @@
"offline_department_details":"wydziału",
"guide": "Przewodnik",
"deans_office" : "Dziekanat",
"fields_of_study" : "Kierunki"
"fields_of_study" : "Kierunki",
"no_address": "Brak adresu"


}

0 comments on commit 4e53fbe

Please sign in to comment.