From 84d007e6d635199edf45277a2238b4ad57b4e0f3 Mon Sep 17 00:00:00 2001 From: ahnjuseong <ahnjuseong@ajou.ac.kr> Date: Thu, 6 Jun 2024 19:56:03 +0900 Subject: [PATCH] =?UTF-8?q?8=EB=8B=A8=EA=B3=84=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../assign/lib/main.dart | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/.github/workflows/flutter_application_1/assign/lib/main.dart b/.github/workflows/flutter_application_1/assign/lib/main.dart index 01ffce1771..d5d4c27e3f 100644 --- a/.github/workflows/flutter_application_1/assign/lib/main.dart +++ b/.github/workflows/flutter_application_1/assign/lib/main.dart @@ -64,7 +64,7 @@ class _MyHomePageState extends State<MyHomePage> { page = GeneratorPage(); break; case 1: - page = Placeholder(); + page = FavoritesPage(); break; default: throw UnimplementedError('no widget for $selectedIndex'); @@ -185,4 +185,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('(null)'), + ); + } + + 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