Skip to content

Commit

Permalink
albums generated day by day
Browse files Browse the repository at this point in the history
  • Loading branch information
apoleon33 committed Dec 29, 2023
1 parent a990ab1 commit e8e5ea2
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,21 @@ class _MyHomePageState extends State<MyHomePage> {
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
DateTime timeNow = DateTime.now();
List<Widget> albumCards = [
const SizedBox(height: 16),
AlbumCard(time: timeNow),
];
DateTime deadline = DateTime.parse('2023-12-25');
DateTime date = timeNow;

while (date.isAfter(deadline)) {
date = DateTime(date.year, date.month, date.day - 1);
albumCards.add(const SizedBox(height: 13));
albumCards.add(AlbumCard(time: date));

}

return Scaffold(
appBar: AppBar(
leading: IconButton(
Expand Down Expand Up @@ -105,18 +120,7 @@ class _MyHomePageState extends State<MyHomePage> {
// wireframe for each widget.
mainAxisAlignment: MainAxisAlignment.center,

children: [
SizedBox(height: 16),
AlbumCard(time: DateTime.now()),
SizedBox(height: 16),
AlbumCard(time: DateTime.parse("2023-12-27")),
SizedBox(height: 16),
AlbumCard(time: DateTime.parse("2023-12-26")),
SizedBox(height: 16),
AlbumCard(time: DateTime.parse("2023-11-27")),
SizedBox(height: 16),
AlbumCard(time: DateTime.parse("2023-12-25"))
],
children: albumCards,
),
),
),
Expand Down

0 comments on commit e8e5ea2

Please sign in to comment.