From 7b6d5b340e928cd59ae0f56fe6182a94167e1432 Mon Sep 17 00:00:00 2001 From: Jingeun Lee <exploitsori@ajou.ac.kr> Date: Wed, 16 Apr 2025 19:05:37 +0900 Subject: [PATCH] =?UTF-8?q?8.=20=EC=83=88=20=ED=8E=98=EC=9D=B4=EC=A7=80=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/main.dart | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/lib/main.dart b/lib/main.dart index 4e9edf3..dc3c6b9 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -60,7 +60,7 @@ class _MyHomePageState extends State<MyHomePage> { page = GeneratorPage(); break; case 1: - page = Placeholder(); + page = FavoritesPage(); break; default: throw UnimplementedError('no widget for $selectedIndex'); @@ -174,4 +174,32 @@ class BigCard extends StatelessWidget { ), ); } +} + +class FavoritesPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + var appState = context.watch<MyAppState>(); + + if (appState.favorites.isEmpty) { + return Center(child: Text('No favorites yet.')); + } + + return ListView( + children: [ + Padding( + padding: const EdgeInsets.all(20), + child: Text( + 'You have ' + '${appState.favorites.length} favorites:', + ), + ), + for (var pair in appState.favorites) + ListTile( + leading: Icon(Icons.favorite), + title: Text(pair.asLowerCase), + ), + ], + ); + } } \ No newline at end of file -- GitLab