Skip to content
Snippets Groups Projects
Commit 2495701b authored by NOOBJE's avatar NOOBJE
Browse files

8단계완료

parent 9b674350
No related branches found
No related tags found
No related merge requests found
...@@ -46,8 +46,6 @@ class MyAppState extends ChangeNotifier { ...@@ -46,8 +46,6 @@ class MyAppState extends ChangeNotifier {
} }
// ...
class MyHomePage extends StatefulWidget { class MyHomePage extends StatefulWidget {
@override @override
State<MyHomePage> createState() => _MyHomePageState(); State<MyHomePage> createState() => _MyHomePageState();
...@@ -64,7 +62,7 @@ switch (selectedIndex) { ...@@ -64,7 +62,7 @@ switch (selectedIndex) {
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');
...@@ -97,7 +95,7 @@ switch (selectedIndex) { ...@@ -97,7 +95,7 @@ switch (selectedIndex) {
Expanded( Expanded(
child: Container( child: Container(
color: Theme.of(context).colorScheme.primaryContainer, color: Theme.of(context).colorScheme.primaryContainer,
child: GeneratorPage(), child: page,
), ),
), ),
], ],
...@@ -153,6 +151,35 @@ class GeneratorPage extends StatelessWidget { ...@@ -153,6 +151,35 @@ class GeneratorPage 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),
),
],
);
}
}
class BigCard extends StatelessWidget { class BigCard extends StatelessWidget {
const BigCard({ const BigCard({
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment