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) {
|
Widget build(BuildContext context) {
|
||||||
var appState = context.watch<MyAppState>();
|
var appState = context.watch<MyAppState>();
|
||||||
|
|
||||||
var textFields = <Text>[];
|
if (appState.favorites.isEmpty) {
|
||||||
for (var fave in appState.favorites) {
|
return Center(
|
||||||
textFields.add(Text(fave.toString()));
|
child: Text('No favorites yet.'),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Center(
|
return ListView(
|
||||||
child: ListView(
|
children: [
|
||||||
children: textFields,
|
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