Skip to content
Snippets Groups Projects
Commit 7533d245 authored by kim hakjun's avatar kim hakjun
Browse files

8 stage

parent d0a10671
No related branches found
No related tags found
No related merge requests found
...@@ -63,7 +63,7 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -63,7 +63,7 @@ class _MyHomePageState extends State<MyHomePage> {
page = GeneratorPage(); page = GeneratorPage();
break; break;
case 1: case 1:
page = Placeholder(); page = FavoritesPage();
break; break;
default: default:
throw UnimplementedError('no widget for $selectedIndex'); throw UnimplementedError('no widget for $selectedIndex');
...@@ -181,3 +181,31 @@ class BigCard extends StatelessWidget { ...@@ -181,3 +181,31 @@ 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment