Basic ass "display"
This commit is contained in:
@@ -5,16 +5,6 @@ import 'package:gamer_updater/game.dart';
|
||||
void main() async {
|
||||
await DB.init();
|
||||
|
||||
var game = Game(
|
||||
name: 'Rimworld',
|
||||
versionRegex: r'(\d+\.\d+\.\d+)',
|
||||
lastPlayed: '1.4.3704',
|
||||
rssFeedUrl:
|
||||
'https://store.steampowered.com/feeds/news/app/294100/?cc=HR&l=english',
|
||||
);
|
||||
await game.updateActualVersion();
|
||||
await GameRepository.upsert(game);
|
||||
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
@@ -55,6 +45,22 @@ class MyHomePage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _MyHomePageState extends State<MyHomePage> {
|
||||
late List<Game> games = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
GameRepository.getAll().then((games) {
|
||||
setState(() {
|
||||
this.games = games;
|
||||
});
|
||||
for (var e in games) {
|
||||
e.updateActualVersion();
|
||||
GameRepository.upsert(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -65,7 +71,10 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[const Text('Hello cyka')],
|
||||
children: <Widget>[
|
||||
Text(games.map((e) => e.name).join('\n')),
|
||||
Text(games.map((e) => e.actualVersion).join('\n')),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
Reference in New Issue
Block a user