51 lines
1.2 KiB
Dart
51 lines
1.2 KiB
Dart
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'),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|