Implement some sort of basic rss scraping

This commit is contained in:
2025-02-22 14:25:48 +01:00
parent bc1e553fc7
commit 5ed90da80b
6 changed files with 350 additions and 21 deletions

View File

@@ -1,6 +1,20 @@
import 'package:flutter/material.dart';
import 'package:gamer_updater/db.dart';
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);
void main() {
runApp(const MyApp());
}
@@ -14,6 +28,19 @@ class MyApp extends StatelessWidget {
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
),
darkTheme: ThemeData(
brightness: Brightness.dark,
useMaterial3: true,
scaffoldBackgroundColor: Colors.black,
colorSchemeSeed: Colors.black,
highlightColor: Colors.deepPurple,
textTheme: TextTheme(
bodyLarge: TextStyle(fontSize: 22, fontWeight: FontWeight.bold),
bodyMedium: TextStyle(fontSize: 20),
bodySmall: TextStyle(fontSize: 16),
),
),
themeMode: ThemeMode.system,
home: const MyHomePage(title: 'Gamer Updater'),
);
}
@@ -28,14 +55,6 @@ class MyHomePage extends StatefulWidget {
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
_counter++;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
@@ -46,20 +65,9 @@ class _MyHomePageState extends State<MyHomePage> {
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text('You have pushed the button this many times:'),
Text(
'$_counter',
style: Theme.of(context).textTheme.headlineMedium,
),
],
children: <Widget>[const Text('Hello cyka')],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
),
);
}
}