Split into multiple files

This commit is contained in:
2025-05-03 00:25:11 +02:00
parent 88f0b8d4d1
commit d9e66711e4
5 changed files with 147 additions and 85 deletions

View File

@@ -0,0 +1,50 @@
library;
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../states/my_app_states.dart';
import 'big_card.dart';
class GeneratorPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
var appState = context.watch<MyAppState>();
var pair = appState.current;
IconData icon;
if (appState.favourites.contains(pair)) {
icon = Icons.favorite;
} else {
icon = Icons.favorite_border;
}
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
BigCard(pair: pair),
SizedBox(height: 10),
Row(
mainAxisSize: MainAxisSize.min,
children: [
ElevatedButton.icon(
onPressed: () {
appState.toggleFavourites();
},
icon: Icon(icon),
label: Text('Like'),
),
SizedBox(width: 10),
ElevatedButton(
onPressed: () {
appState.getNext();
},
child: Text('Next'),
),
],
),
],
),
);
}
}