Skip to content

Commit

Permalink
feat(digital-guide): setup presentation layer
Browse files Browse the repository at this point in the history
  • Loading branch information
mikolaj-jalocha committed Jan 22, 2025
1 parent 5ba3792 commit b221e22
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import "../../tabs/adapted_toilets/presentation/adapted_toilets_expansion_tile_c
import "../../tabs/amenities/presentation/amenities_expansion_tile_content.dart";
import "../../tabs/evacuation/evacuation_widget.dart";
import "../../tabs/localization/presentation/localization_expansion_tile_content.dart";
import "../../tabs/lodge/presentation/digital_guide_lodge_expansion_tile_content.dart";
import "../../tabs/micronavigation/presentation/micronavigation_expansion_tile_content.dart";
import "../../tabs/rooms/presentation/digital_guide_rooms_expansion_tile_content.dart";
import "../../tabs/surrounding/presentation/surroundings_expansion_tile_content.dart";
Expand Down Expand Up @@ -102,6 +103,14 @@ class DigitalGuideFeaturesSection extends ConsumerWidget {
),
],
),
(
title: context.localize.lodge,
content: [
DigitalGuideLodgeExpansionTileContent(
digitalGuideData,
),
],
),
];

return SliverList(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import "package:fast_immutable_collections/fast_immutable_collections.dart";
import "package:flutter/material.dart";
import "package:flutter_riverpod/flutter_riverpod.dart";

import "../../../../../config/ui_config.dart";
import "../../../../../theme/app_theme.dart";
import "../../../../../utils/context_extensions.dart";
import "../../../../../widgets/my_error_widget.dart";
import "../../../data/models/digital_guide_response.dart";
import "../../../presentation/widgets/digital_guide_photo_row.dart";
import "../data/models/digital_guide_lodge.dart";
import "../data/repository/lodges_repository.dart";

class DigitalGuideLodgeExpansionTileContent extends ConsumerWidget {
const DigitalGuideLodgeExpansionTileContent(this.digitalGuideResponse);

final DigitalGuideResponse digitalGuideResponse;

@override
Widget build(BuildContext context, WidgetRef ref) {
final lodgeResponse =
ref.watch(lodgesRepositoryProvider(digitalGuideResponse));
return lodgeResponse.when(
data: (data) =>
_DigitalGuideLodgeExpansionTileContent(lodge: data.firstOrNull),
error: (error, _) => MyErrorWidget(error),
loading: () => const Center(
child: CircularProgressIndicator(),
),
);
}
}

class _DigitalGuideLodgeExpansionTileContent extends StatelessWidget {
final DigitalGuideLodge? lodge;

const _DigitalGuideLodgeExpansionTileContent({
required this.lodge,
});

@override
Widget build(BuildContext context) {
if (lodge == null) {
return Center(child: Text(context.localize.no_lodge_in_the_building));
}
final DigitalGuideTranslationLodge lodgeInformation =
lodge!.translations.pl;
return Padding(
padding: const EdgeInsets.all(DigitalGuideConfig.paddingMedium),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(context.localize.localization, style: context.textTheme.title),
Padding(
padding: const EdgeInsets.symmetric(
vertical: DigitalGuideConfig.heightSmall,
),
child: Text(lodgeInformation.location),
),
Text(context.localize.working_hours, style: context.textTheme.title),
const SizedBox(
height: DigitalGuideConfig.heightSmall,
),
Text(lodgeInformation.workingDaysAndHours),
const SizedBox(
height: DigitalGuideConfig.heightSmall,
),
if (lodgeInformation.comment.isNotEmpty)
Padding(
padding: const EdgeInsets.only(
bottom: DigitalGuideConfig.paddingSmall,
),
child: Text(
context.localize.additional_information,
style: context.textTheme.title,
),
),
Text(lodgeInformation.comment),
if (lodgeInformation.comment.isNotEmpty)
const SizedBox(
height: DigitalGuideConfig.heightMedium,
),
DigitalGuidePhotoRow(
imagesIDs: lodge!.imagesIds?.toIList() ?? const IList.empty(),
),
],
),
);
}
}
6 changes: 4 additions & 2 deletions lib/l10n/app_pl.arb
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@
"communique" : "Komunikat",
"audio_message" : "Komunikat Dźwiękowy",
"audio_message_comment" : "Sygnał znacznika może różnić się tempem i brzmieniem",
"digital_guide" : "Cyfrowy Przewodnik",
"platforms" : "Podesty",
"stairs" : "Schody",
"key_information" : "Najważniejsze informacje",
Expand All @@ -299,5 +298,8 @@
"sensorySensitivity": "Wrażliwość sensoryczna",
"cognitiveImpairment": "Trudności poznawcze",
"accessibility_profiles":"Profile dostępności",
"you_can_adjust": "Możesz dostosować informacje pod swoje specjalne potrzeby"
"you_can_adjust": "Możesz dostosować informacje pod swoje specjalne potrzeby",
"additional_information": "Dodatkowe informacje",
"lodge": "Portiernia",
"no_lodge_in_the_building": "W tym budynku nie ma portierni"
}

0 comments on commit b221e22

Please sign in to comment.