My working attempt to get the page going. Ran into weird issues trying to get it all centered. Going to see what the tutorial uses.

This commit is contained in:
Hyperling 2025-01-30 12:34:13 -07:00
parent ab0b551a64
commit acb6ed8599

View File

@ -64,7 +64,7 @@ class _MyHomePageState extends State<MyHomePage> {
page = GeneratorPage();
break;
case 1:
page = Placeholder();
page = FavoritesPage();
break;
default:
throw UnimplementedError('no widget for $selectedIndex');
@ -110,6 +110,28 @@ class _MyHomePageState extends State<MyHomePage> {
}
}
class FavoritesPage extends StatelessWidget {
const FavoritesPage({
super.key,
});
@override
Widget build(BuildContext context) {
var appState = context.watch<MyAppState>();
var textFields = <Text>[];
for (var fave in appState.favorites) {
textFields.add(Text(fave.toString()));
}
return Center(
child: ListView(
children: textFields,
),
);
}
}
class GeneratorPage extends StatelessWidget {
@override
Widget build(BuildContext context) {