diff --git a/lib/widgets/html_view.dart b/lib/widgets/html_view.dart index dc7d492..032871e 100644 --- a/lib/widgets/html_view.dart +++ b/lib/widgets/html_view.dart @@ -1,6 +1,7 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:git_touch/models/theme.dart'; +import 'package:git_touch/utils/utils.dart'; import 'package:provider/provider.dart'; import 'package:webview_flutter/webview_flutter.dart'; @@ -33,6 +34,7 @@ class HtmlView extends StatefulWidget { class _HtmlViewState extends State { double height; WebViewController controller; + var loaded = false; @override Widget build(BuildContext context) { @@ -56,6 +58,15 @@ class _HtmlViewState extends State { height = double.parse(res); }); }, + navigationDelegate: (request) { + if (loaded) { + launchUrl(request.url); // TODO: + return NavigationDecision.prevent; + } else { + loaded = true; + return NavigationDecision.navigate; + } + }, ), ); }