-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(digital-guide): setup presentation layer
- Loading branch information
1 parent
5ba3792
commit b221e22
Showing
3 changed files
with
103 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
...igital_guide_view/tabs/lodge/presentation/digital_guide_lodge_expansion_tile_content.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(), | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters