Compare commits
No commits in common. "fe15a0edad2de3ddd300f3f579e93981158d536e" and "ab0b551a6419924512b9c9618d8f0ba4ecbd7c66" have entirely different histories.
fe15a0edad
...
ab0b551a64
@ -64,7 +64,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
page = GeneratorPage();
|
page = GeneratorPage();
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
page = FavoritesPage();
|
page = Placeholder();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw UnimplementedError('no widget for $selectedIndex');
|
throw UnimplementedError('no widget for $selectedIndex');
|
||||||
@ -110,38 +110,6 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class FavoritesPage extends StatelessWidget {
|
|
||||||
const FavoritesPage({
|
|
||||||
super.key,
|
|
||||||
});
|
|
||||||
|
|
||||||
@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 GeneratorPage extends StatelessWidget {
|
class GeneratorPage extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user