-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
123 additions
and
11 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
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
61 changes: 61 additions & 0 deletions
61
lib/features/picture_of_the_day/presentation/pages/details_page.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,61 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:nasa_potday/features/picture_of_the_day/domain/entities/picture_entity.dart'; | ||
import 'package:nasa_potday/features/picture_of_the_day/presentation/widgets/date_widget.dart'; | ||
|
||
class DetailsPage extends StatelessWidget { | ||
const DetailsPage({ | ||
required this.picture, | ||
super.key, | ||
}); | ||
|
||
final PictureEntity picture; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar(), | ||
body: CustomScrollView( | ||
slivers: [ | ||
SliverToBoxAdapter( | ||
child: Hero( | ||
tag: picture.url, | ||
child: Image.network( | ||
picture.url.toString(), | ||
), | ||
), | ||
), | ||
const SliverPadding( | ||
padding: EdgeInsets.only(top: 16), | ||
), | ||
SliverPadding( | ||
padding: const EdgeInsets.symmetric(horizontal: 16), | ||
sliver: SliverToBoxAdapter( | ||
child: Text(picture.title), | ||
), | ||
), | ||
const SliverPadding( | ||
padding: EdgeInsets.only(top: 16), | ||
), | ||
SliverPadding( | ||
padding: const EdgeInsets.symmetric(horizontal: 16), | ||
sliver: SliverToBoxAdapter( | ||
child: DateWidget(date: picture.date), | ||
), | ||
), | ||
const SliverPadding( | ||
padding: EdgeInsets.only(top: 16), | ||
), | ||
SliverPadding( | ||
padding: const EdgeInsets.symmetric(horizontal: 16), | ||
sliver: SliverToBoxAdapter( | ||
child: Text(picture.explanation), | ||
), | ||
), | ||
const SliverPadding( | ||
padding: EdgeInsets.only(top: 32), | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
lib/features/picture_of_the_day/presentation/widgets/date_widget.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,22 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:intl/intl.dart'; | ||
|
||
class DateWidget extends StatelessWidget { | ||
const DateWidget({ | ||
required this.date, | ||
super.key, | ||
}); | ||
|
||
final DateTime date; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Row( | ||
children: [ | ||
const Icon(Icons.calendar_month_outlined), | ||
const SizedBox(width: 8), | ||
Text(DateFormat('dd/MM/yyyy').format(date)), | ||
], | ||
); | ||
} | ||
} |
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
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
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