mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-05-14 22:12:53 +00:00
Added open web admin panel
This commit is contained in:
parent
786b14e9ba
commit
427b87ba55
5 changed files with 39 additions and 2 deletions
|
@ -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)
|
||||
],
|
||||
),
|
||||
)
|
||||
]
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue