Tutorial's version of the page.
This commit is contained in:
parent
acb6ed8599
commit
fe15a0edad
@ -119,15 +119,25 @@ class FavoritesPage extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
var appState = context.watch<MyAppState>();
|
||||
|
||||
var textFields = <Text>[];
|
||||
for (var fave in appState.favorites) {
|
||||
textFields.add(Text(fave.toString()));
|
||||
if (appState.favorites.isEmpty) {
|
||||
return Center(
|
||||
child: Text('No favorites yet.'),
|
||||
);
|
||||
}
|
||||
|
||||
return Center(
|
||||
child: ListView(
|
||||
children: textFields,
|
||||
),
|
||||
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),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user