Split into multiple files
This commit is contained in:
50
lib/widgets/generator.dart
Normal file
50
lib/widgets/generator.dart
Normal 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'),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user