M lib/main.dart => lib/main.dart +18 -1
@@ 5,6 5,7 @@ import 'package:flutterflux/config.dart';
import 'package:flutterflux/miniflux.dart';
import 'package:flutterflux/views/user_input_view.dart';
import 'package:localstorage/localstorage.dart';
+import 'package:url_launcher/url_launcher.dart';
void main() {
runApp(MyApp());
@@ 62,6 63,14 @@ class _MyHomePageState extends State<MyHomePage> {
});
}
+ _launchURL(String url) async {
+ if (await canLaunch(url)) {
+ await launch(url);
+ } else {
+ throw 'Could not launch $url';
+ }
+ }
+
@override
void initState() {
checkConfig().then((success) {
@@ 86,7 95,15 @@ class _MyHomePageState extends State<MyHomePage> {
key: UniqueKey(),
itemBuilder: (BuildContext context, int index) {
FeedEntry entry = unreadPosts[index];
- return Card(key: UniqueKey(), child: Text(entry.title));
+ return InkWell(
+ child: Card(
+ child: ListTile(
+ key: UniqueKey(),
+ title: Text(entry.title),
+ ),
+ ),
+ onTap: () => _launchURL(entry.url),
+ );
},
)),
);
M lib/miniflux.dart => lib/miniflux.dart +6 -5
@@ 9,15 9,16 @@ class FeedEntry {
int id;
String status;
String title;
+ String url;
- FeedEntry({this.id, this.status, this.title});
+ FeedEntry({this.id, this.status, this.title, this.url});
factory FeedEntry.fromJson(Map<String, dynamic> json) {
return FeedEntry(
- id: json["id"],
- status: json["status"],
- title: json["title"],
- );
+ id: json["id"],
+ status: json["status"],
+ title: json["title"],
+ url: json["url"]);
}
}
M pubspec.lock => pubspec.lock +55 -1
@@ 81,6 81,11 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
+ flutter_web_plugins:
+ dependency: transitive
+ description: flutter
+ source: sdk
+ version: "0.0.0"
http:
dependency: "direct main"
description:
@@ 102,6 107,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.16.1"
+ js:
+ dependency: transitive
+ description:
+ name: js
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.6.3-nullsafety.3"
localstorage:
dependency: "direct main"
description:
@@ 247,6 259,48 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0-nullsafety.5"
+ url_launcher:
+ dependency: "direct main"
+ description:
+ name: url_launcher
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "5.7.10"
+ url_launcher_linux:
+ dependency: transitive
+ description:
+ name: url_launcher_linux
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.0.1+4"
+ url_launcher_macos:
+ dependency: transitive
+ description:
+ name: url_launcher_macos
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.0.1+9"
+ url_launcher_platform_interface:
+ dependency: transitive
+ description:
+ name: url_launcher_platform_interface
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.0.9"
+ url_launcher_web:
+ dependency: transitive
+ description:
+ name: url_launcher_web
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.1.5+3"
+ url_launcher_windows:
+ dependency: transitive
+ description:
+ name: url_launcher_windows
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.0.1+3"
vector_math:
dependency: transitive
description:
@@ 270,4 324,4 @@ packages:
version: "0.1.2"
sdks:
dart: ">=2.12.0-0.0 <3.0.0"
- flutter: ">=1.12.13+hotfix.5"
+ flutter: ">=1.22.0"
M pubspec.yaml => pubspec.yaml +2 -0
@@ 22,6 22,8 @@ environment:
dependencies:
localstorage: ^3.0.6
+ url_launcher: ^5.7.10
+
http: ^0.12.2
flutter:
sdk: flutter