From e4986c0bd9422073131f4360da49862103e98aaf Mon Sep 17 00:00:00 2001 From: Juan Gilsanz Polo Date: Mon, 10 Oct 2022 01:20:36 +0200 Subject: [PATCH] Added open url custom rules --- lib/constants/urls.dart | 1 + lib/screens/filters/add_custom_rule.dart | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/constants/urls.dart b/lib/constants/urls.dart index df19dde..f10bd53 100644 --- a/lib/constants/urls.dart +++ b/lib/constants/urls.dart @@ -1,4 +1,5 @@ class Urls { static const String playStore = "https://play.google.com/store/apps/details?id=com.jgeek00.adguard_home_manager"; static const String gitHub = "https://github.com/JGeek00/adguard-home-manager"; + static const String customRuleDocs = "https://github.com/AdguardTeam/AdGuardHome/wiki/Hosts-Blocklists"; } \ No newline at end of file diff --git a/lib/screens/filters/add_custom_rule.dart b/lib/screens/filters/add_custom_rule.dart index 578c28a..7320635 100644 --- a/lib/screens/filters/add_custom_rule.dart +++ b/lib/screens/filters/add_custom_rule.dart @@ -1,8 +1,11 @@ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:flutter_web_browser/flutter_web_browser.dart'; import 'package:adguard_home_manager/widgets/custom_radio_toggle.dart'; +import 'package:adguard_home_manager/constants/urls.dart'; + class AddCustomRule extends StatefulWidget { final ScrollController scrollController; final void Function(String) onConfirm; @@ -65,6 +68,22 @@ class _AddCustomRuleState extends State { return rule; } + + void openDocsPage() { + FlutterWebBrowser.openWebPage( + url: Urls.customRuleDocs, + customTabsOptions: const CustomTabsOptions( + instantAppsEnabled: true, + showTitle: true, + urlBarHidingEnabled: false, + ), + safariVCOptions: const SafariViewControllerOptions( + barCollapsingEnabled: true, + dismissButtonStyle: SafariViewControllerDismissButtonStyle.close, + modalPresentationCapturesStatusBarAppearance: true, + ) + ); + } @override Widget build(BuildContext context) { @@ -316,7 +335,7 @@ class _AddCustomRuleState extends State { Material( color: Colors.transparent, child: InkWell( - onTap: () => {}, + onTap: openDocsPage, child: Padding( padding: const EdgeInsets.symmetric(horizontal: 28, vertical: 10), child: Row(