diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 2bb205d..65ebdb9 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -166,5 +166,6 @@ "generalSettings": "General settings", "generalSettingsDescription": "Various different settings", "hideZeroValues": "Hide zero values", - "hideZeroValuesDescription": "On homescreen, hide blocks with zero value" + "hideZeroValuesDescription": "On homescreen, hide blocks with zero value", + "webAdminPanel": "Web admin. panel" } \ No newline at end of file diff --git a/lib/l10n/app_es.arb b/lib/l10n/app_es.arb index 5da9929..c9aa975 100644 --- a/lib/l10n/app_es.arb +++ b/lib/l10n/app_es.arb @@ -166,5 +166,6 @@ "generalSettings": "Ajustes generales", "generalSettingsDescription": "Varios ajustes generales", "hideZeroValues": "Oculta valores a cero", - "hideZeroValuesDescription": "En la pantalla de inicio, oculta bloqueos con valor cero" + "hideZeroValuesDescription": "En la pantalla de inicio, oculta bloqueos con valor cero", + "webAdminPanel": "Panel de admin. web" } \ No newline at end of file diff --git a/lib/screens/home/appbar.dart b/lib/screens/home/appbar.dart index 8784631..0554cb6 100644 --- a/lib/screens/home/appbar.dart +++ b/lib/screens/home/appbar.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:flutter_web_browser/flutter_web_browser.dart'; import 'package:adguard_home_manager/screens/servers/servers.dart'; @@ -24,6 +25,22 @@ class HomeAppBar extends StatelessWidget with PreferredSizeWidget { })); } + void openWebAdminPanel() { + FlutterWebBrowser.openWebPage( + url: "${server.connectionMethod}://${server.domain}${server.path ?? ""}${server.port != null ? ':${server.port}' : ""}", + customTabsOptions: const CustomTabsOptions( + instantAppsEnabled: true, + showTitle: true, + urlBarHidingEnabled: false, + ), + safariVCOptions: const SafariViewControllerOptions( + barCollapsingEnabled: true, + dismissButtonStyle: SafariViewControllerDismissButtonStyle.close, + modalPresentationCapturesStatusBarAppearance: true, + ) + ); + } + return AppBar( toolbarHeight: 70, title: Padding( @@ -80,6 +97,16 @@ class HomeAppBar extends StatelessWidget with PreferredSizeWidget { Text(AppLocalizations.of(context)!.servers) ], ), + ), + if (serversProvider.serverStatus.loadStatus == 1) PopupMenuItem( + onTap: openWebAdminPanel, + child: Row( + children: [ + const Icon(Icons.web_rounded), + const SizedBox(width: 10), + Text(AppLocalizations.of(context)!.webAdminPanel) + ], + ), ) ] ) diff --git a/pubspec.lock b/pubspec.lock index f807035..bfbce05 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -226,6 +226,13 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_web_browser: + dependency: "direct main" + description: + name: flutter_web_browser + url: "https://pub.dartlang.org" + source: hosted + version: "0.17.1" flutter_web_plugins: dependency: transitive description: flutter diff --git a/pubspec.yaml b/pubspec.yaml index 3de06c9..592c8fd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -45,6 +45,7 @@ dependencies: uuid: ^3.0.6 expandable: ^5.0.1 fl_chart: ^0.55.2 + flutter_web_browser: ^0.17.1 dev_dependencies: flutter_test: