M lib/main.dart => lib/main.dart +0 -9
@@ 70,15 70,6 @@ class _MyHomePageState extends State<MyHomePage> {
});
}
- void _readArticle(FeedEntry entry) async {
- if (await canLaunch(entry.url)) {
- MinifluxApi.instance.markAsRead(entry.id);
- launch(entry.url);
- } else {
- throw 'Could not launch ${entry.url}';
- }
- }
-
@override
void initState() {
checkConfig().then((success) {
M lib/miniflux.dart => lib/miniflux.dart +16 -2
@@ 5,20 5,34 @@ import 'package:localstorage/localstorage.dart';
import 'config.dart';
import 'package:http/http.dart' as http;
+class Feed {
+ int id;
+ String url;
+ String title;
+
+ Feed({this.id, this.url, this.title});
+
+ factory Feed.fromJson(Map<String, dynamic> json) {
+ return Feed(id: json["id"], url: json["url"], title: json["title"]);
+ }
+}
+
class FeedEntry {
int id;
String status;
String title;
String url;
+ Feed feed;
- FeedEntry({this.id, this.status, this.title, this.url});
+ FeedEntry({this.id, this.status, this.title, this.url, this.feed});
factory FeedEntry.fromJson(Map<String, dynamic> json) {
return FeedEntry(
id: json["id"],
status: json["status"],
title: json["title"],
- url: json["url"]);
+ url: json["url"],
+ feed: Feed.fromJson(json["feed"]));
}
}
M lib/views/unread_view.dart => lib/views/unread_view.dart +4 -2
@@ 41,6 41,9 @@ class _UnreadViewState extends State<UnreadView> {
if (await canLaunch(entry.url)) {
MinifluxApi.instance.markAsRead(entry.id);
launch(entry.url);
+ setState(() {
+ unreadPosts.remove(entry);
+ });
} else {
throw 'Could not launch ${entry.url}';
}
@@ 57,8 60,6 @@ class _UnreadViewState extends State<UnreadView> {
super.initState();
}
- static const List<Widget> _widgetOptions = <Widget>[];
-
@override
Widget build(BuildContext context) {
return Container(
@@ 82,6 83,7 @@ class _UnreadViewState extends State<UnreadView> {
child: ListTile(
key: UniqueKey(),
title: Text(entry.title),
+ subtitle: Text(entry.feed.title),
onTap: () => _readArticle(entry),
),
),