mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-04-30 02:28:16 +00:00
Changed green and red with theme color and grey
This commit is contained in:
parent
6b593dc195
commit
5e30ac4986
11 changed files with 134 additions and 47 deletions
|
@ -1,8 +1,9 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
|
||||||
|
import 'package:adguard_home_manager/providers/app_config_provider.dart';
|
||||||
|
|
||||||
Map<String, dynamic> getFilteredStatus(BuildContext context, String filterKey, bool isRow) {
|
Map<String, dynamic> getFilteredStatus(BuildContext context, AppConfigProvider appConfigProvider, String filterKey, bool isRow) {
|
||||||
switch (filterKey) {
|
switch (filterKey) {
|
||||||
case 'NotFilteredNotFound':
|
case 'NotFilteredNotFound':
|
||||||
return {
|
return {
|
||||||
|
@ -10,7 +11,9 @@ Map<String, dynamic> getFilteredStatus(BuildContext context, String filterKey, b
|
||||||
'label': isRow == true
|
'label': isRow == true
|
||||||
? AppLocalizations.of(context)!.processedRow
|
? AppLocalizations.of(context)!.processedRow
|
||||||
: AppLocalizations.of(context)!.processed,
|
: AppLocalizations.of(context)!.processed,
|
||||||
'color': Colors.green,
|
'color': appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Theme.of(context).primaryColor
|
||||||
|
: Colors.green,
|
||||||
'icon': Icons.verified_user_rounded,
|
'icon': Icons.verified_user_rounded,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -20,7 +23,9 @@ Map<String, dynamic> getFilteredStatus(BuildContext context, String filterKey, b
|
||||||
'label': isRow == true
|
'label': isRow == true
|
||||||
? AppLocalizations.of(context)!.processedWhitelistRow
|
? AppLocalizations.of(context)!.processedWhitelistRow
|
||||||
: AppLocalizations.of(context)!.processedWhitelist,
|
: AppLocalizations.of(context)!.processedWhitelist,
|
||||||
'color': Colors.green,
|
'color': appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Theme.of(context).primaryColor
|
||||||
|
: Colors.green,
|
||||||
'icon': Icons.verified_user_rounded,
|
'icon': Icons.verified_user_rounded,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -30,7 +35,9 @@ Map<String, dynamic> getFilteredStatus(BuildContext context, String filterKey, b
|
||||||
'label': isRow == true
|
'label': isRow == true
|
||||||
? AppLocalizations.of(context)!.processedErrorRow
|
? AppLocalizations.of(context)!.processedErrorRow
|
||||||
: AppLocalizations.of(context)!.processedError,
|
: AppLocalizations.of(context)!.processedError,
|
||||||
'color': Colors.green,
|
'color': appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Theme.of(context).primaryColor
|
||||||
|
: Colors.green,
|
||||||
'icon': Icons.verified_user_rounded,
|
'icon': Icons.verified_user_rounded,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -40,7 +47,9 @@ Map<String, dynamic> getFilteredStatus(BuildContext context, String filterKey, b
|
||||||
'label': isRow == true
|
'label': isRow == true
|
||||||
? AppLocalizations.of(context)!.blockedBlacklistRow
|
? AppLocalizations.of(context)!.blockedBlacklistRow
|
||||||
: AppLocalizations.of(context)!.blockedBlacklist,
|
: AppLocalizations.of(context)!.blockedBlacklist,
|
||||||
'color': Colors.red,
|
'color': appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Colors.grey
|
||||||
|
: Colors.red,
|
||||||
'icon': Icons.gpp_bad_rounded,
|
'icon': Icons.gpp_bad_rounded,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -50,7 +59,9 @@ Map<String, dynamic> getFilteredStatus(BuildContext context, String filterKey, b
|
||||||
'label': isRow == true
|
'label': isRow == true
|
||||||
? AppLocalizations.of(context)!.blockedSafeBrowsingRow
|
? AppLocalizations.of(context)!.blockedSafeBrowsingRow
|
||||||
: AppLocalizations.of(context)!.blockedSafeBrowsing,
|
: AppLocalizations.of(context)!.blockedSafeBrowsing,
|
||||||
'color': Colors.red,
|
'color': appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Colors.grey
|
||||||
|
: Colors.red,
|
||||||
'icon': Icons.gpp_bad_rounded,
|
'icon': Icons.gpp_bad_rounded,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -60,7 +71,9 @@ Map<String, dynamic> getFilteredStatus(BuildContext context, String filterKey, b
|
||||||
'label': isRow == true
|
'label': isRow == true
|
||||||
? AppLocalizations.of(context)!.blockedParentalRow
|
? AppLocalizations.of(context)!.blockedParentalRow
|
||||||
: AppLocalizations.of(context)!.blockedParental,
|
: AppLocalizations.of(context)!.blockedParental,
|
||||||
'color': Colors.red,
|
'color': appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Colors.grey
|
||||||
|
: Colors.red,
|
||||||
'icon': Icons.gpp_bad_rounded,
|
'icon': Icons.gpp_bad_rounded,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -70,7 +83,9 @@ Map<String, dynamic> getFilteredStatus(BuildContext context, String filterKey, b
|
||||||
'label': isRow == true
|
'label': isRow == true
|
||||||
? AppLocalizations.of(context)!.blockedInvalidRow
|
? AppLocalizations.of(context)!.blockedInvalidRow
|
||||||
: AppLocalizations.of(context)!.blockedInvalid,
|
: AppLocalizations.of(context)!.blockedInvalid,
|
||||||
'color': Colors.red,
|
'color': appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Colors.grey
|
||||||
|
: Colors.red,
|
||||||
'icon': Icons.gpp_bad_rounded,
|
'icon': Icons.gpp_bad_rounded,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -80,7 +95,9 @@ Map<String, dynamic> getFilteredStatus(BuildContext context, String filterKey, b
|
||||||
'label': isRow == true
|
'label': isRow == true
|
||||||
? AppLocalizations.of(context)!.blockedSafeSearchRow
|
? AppLocalizations.of(context)!.blockedSafeSearchRow
|
||||||
: AppLocalizations.of(context)!.blockedSafeSearch,
|
: AppLocalizations.of(context)!.blockedSafeSearch,
|
||||||
'color': Colors.red,
|
'color': appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Colors.grey
|
||||||
|
: Colors.red,
|
||||||
'icon': Icons.gpp_bad_rounded,
|
'icon': Icons.gpp_bad_rounded,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -90,7 +107,9 @@ Map<String, dynamic> getFilteredStatus(BuildContext context, String filterKey, b
|
||||||
'label': isRow == true
|
'label': isRow == true
|
||||||
? AppLocalizations.of(context)!.blockedServiceRow
|
? AppLocalizations.of(context)!.blockedServiceRow
|
||||||
: AppLocalizations.of(context)!.blockedService,
|
: AppLocalizations.of(context)!.blockedService,
|
||||||
'color': Colors.red,
|
'color': appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Colors.grey
|
||||||
|
: Colors.red,
|
||||||
'icon': Icons.gpp_bad_rounded,
|
'icon': Icons.gpp_bad_rounded,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -234,7 +234,11 @@ class _AddedListState extends State<AddedList> {
|
||||||
Icons.filter_list_rounded,
|
Icons.filter_list_rounded,
|
||||||
size: 19,
|
size: 19,
|
||||||
color: widget.data[index].filteringEnabled == true
|
color: widget.data[index].filteringEnabled == true
|
||||||
? Colors.green
|
? appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Theme.of(context).primaryColor
|
||||||
|
: Colors.green
|
||||||
|
: appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Colors.grey
|
||||||
: Colors.red,
|
: Colors.red,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
|
@ -242,7 +246,11 @@ class _AddedListState extends State<AddedList> {
|
||||||
Icons.vpn_lock_rounded,
|
Icons.vpn_lock_rounded,
|
||||||
size: 18,
|
size: 18,
|
||||||
color: widget.data[index].safebrowsingEnabled == true
|
color: widget.data[index].safebrowsingEnabled == true
|
||||||
? Colors.green
|
? appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Theme.of(context).primaryColor
|
||||||
|
: Colors.green
|
||||||
|
: appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Colors.grey
|
||||||
: Colors.red,
|
: Colors.red,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
|
@ -250,7 +258,11 @@ class _AddedListState extends State<AddedList> {
|
||||||
Icons.block,
|
Icons.block,
|
||||||
size: 18,
|
size: 18,
|
||||||
color: widget.data[index].parentalEnabled == true
|
color: widget.data[index].parentalEnabled == true
|
||||||
? Colors.green
|
? appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Theme.of(context).primaryColor
|
||||||
|
: Colors.green
|
||||||
|
: appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Colors.grey
|
||||||
: Colors.red,
|
: Colors.red,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
|
@ -258,7 +270,11 @@ class _AddedListState extends State<AddedList> {
|
||||||
Icons.search_rounded,
|
Icons.search_rounded,
|
||||||
size: 19,
|
size: 19,
|
||||||
color: widget.data[index].safesearchEnabled == true
|
color: widget.data[index].safesearchEnabled == true
|
||||||
? Colors.green
|
? appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Theme.of(context).primaryColor
|
||||||
|
: Colors.green
|
||||||
|
: appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Colors.grey
|
||||||
: Colors.red,
|
: Colors.red,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
|
|
@ -289,7 +289,11 @@ class _SearchClientsWidgetState extends State<SearchClientsWidget> {
|
||||||
Icons.filter_list_rounded,
|
Icons.filter_list_rounded,
|
||||||
size: 19,
|
size: 19,
|
||||||
color: clientsScreen[index].filteringEnabled == true
|
color: clientsScreen[index].filteringEnabled == true
|
||||||
? Colors.green
|
? appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Theme.of(context).primaryColor
|
||||||
|
: Colors.green
|
||||||
|
: appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Colors.grey
|
||||||
: Colors.red,
|
: Colors.red,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
|
@ -297,7 +301,11 @@ class _SearchClientsWidgetState extends State<SearchClientsWidget> {
|
||||||
Icons.vpn_lock_rounded,
|
Icons.vpn_lock_rounded,
|
||||||
size: 18,
|
size: 18,
|
||||||
color: clientsScreen[index].safebrowsingEnabled == true
|
color: clientsScreen[index].safebrowsingEnabled == true
|
||||||
? Colors.green
|
? appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Theme.of(context).primaryColor
|
||||||
|
: Colors.green
|
||||||
|
: appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Colors.grey
|
||||||
: Colors.red,
|
: Colors.red,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
|
@ -305,7 +313,11 @@ class _SearchClientsWidgetState extends State<SearchClientsWidget> {
|
||||||
Icons.block,
|
Icons.block,
|
||||||
size: 18,
|
size: 18,
|
||||||
color: clientsScreen[index].parentalEnabled == true
|
color: clientsScreen[index].parentalEnabled == true
|
||||||
? Colors.green
|
? appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Theme.of(context).primaryColor
|
||||||
|
: Colors.green
|
||||||
|
: appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Colors.grey
|
||||||
: Colors.red,
|
: Colors.red,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
|
@ -313,7 +325,11 @@ class _SearchClientsWidgetState extends State<SearchClientsWidget> {
|
||||||
Icons.search_rounded,
|
Icons.search_rounded,
|
||||||
size: 19,
|
size: 19,
|
||||||
color: clientsScreen[index].safesearchEnabled == true
|
color: clientsScreen[index].safesearchEnabled == true
|
||||||
? Colors.green
|
? appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Theme.of(context).primaryColor
|
||||||
|
: Colors.green
|
||||||
|
: appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Colors.grey
|
||||||
: Colors.red,
|
: Colors.red,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
|
|
@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
|
||||||
|
import 'package:adguard_home_manager/providers/app_config_provider.dart';
|
||||||
import 'package:adguard_home_manager/functions/get_filtered_status.dart';
|
import 'package:adguard_home_manager/functions/get_filtered_status.dart';
|
||||||
import 'package:adguard_home_manager/services/http_requests.dart';
|
import 'package:adguard_home_manager/services/http_requests.dart';
|
||||||
import 'package:adguard_home_manager/providers/servers_provider.dart';
|
import 'package:adguard_home_manager/providers/servers_provider.dart';
|
||||||
|
@ -48,6 +49,7 @@ class _CheckHostModalState extends State<CheckHostModal> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final serversProvider = Provider.of<ServersProvider>(context);
|
final serversProvider = Provider.of<ServersProvider>(context);
|
||||||
|
final appConfigProvider = Provider.of<AppConfigProvider>(context);
|
||||||
|
|
||||||
void checkHost() async {
|
void checkHost() async {
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
|
@ -56,7 +58,7 @@ class _CheckHostModalState extends State<CheckHostModal> {
|
||||||
final result = await checkHostFiltered(server: serversProvider.selectedServer!, host: domainController.text);
|
final result = await checkHostFiltered(server: serversProvider.selectedServer!, host: domainController.text);
|
||||||
|
|
||||||
if (result['result'] == 'success') {
|
if (result['result'] == 'success') {
|
||||||
final status = getFilteredStatus(context, result['data']['reason'], true);
|
final status = getFilteredStatus(context, appConfigProvider, result['data']['reason'], true);
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() => resultWidget = Row(
|
setState(() => resultWidget = Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
@ -65,7 +67,11 @@ class _CheckHostModalState extends State<CheckHostModal> {
|
||||||
status['icon'],
|
status['icon'],
|
||||||
size: 18,
|
size: 18,
|
||||||
color: status['filtered'] == true
|
color: status['filtered'] == true
|
||||||
? Colors.red
|
? appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Colors.grey
|
||||||
|
: Colors.red
|
||||||
|
: appConfigProvider.useThemeColorForStatus
|
||||||
|
? Theme.of(context).primaryColor
|
||||||
: Colors.green,
|
: Colors.green,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
|
@ -73,7 +79,11 @@ class _CheckHostModalState extends State<CheckHostModal> {
|
||||||
status['label'],
|
status['label'],
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: status['filtered'] == true
|
color: status['filtered'] == true
|
||||||
? Colors.red
|
? appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Colors.grey
|
||||||
|
: Colors.red
|
||||||
|
: appConfigProvider.useThemeColorForStatus
|
||||||
|
? Theme.of(context).primaryColor
|
||||||
: Colors.green,
|
: Colors.green,
|
||||||
fontWeight: FontWeight.w500
|
fontWeight: FontWeight.w500
|
||||||
),
|
),
|
||||||
|
|
|
@ -300,8 +300,12 @@ class _FiltersWidgetState extends State<FiltersWidget> with TickerProviderStateM
|
||||||
: Icons.cancel,
|
: Icons.cancel,
|
||||||
size: 12,
|
size: 12,
|
||||||
color: serversProvider.filtering.data!.enabled == true
|
color: serversProvider.filtering.data!.enabled == true
|
||||||
? Colors.green
|
? appConfigProvider.useThemeColorForStatus == true
|
||||||
: Colors.red,
|
? Theme.of(context).primaryColor
|
||||||
|
: Colors.green
|
||||||
|
: appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Colors.grey
|
||||||
|
: Colors.red
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
@ -297,8 +297,12 @@ class _FiltersListState extends State<FiltersList> {
|
||||||
? Icons.check_circle_rounded
|
? Icons.check_circle_rounded
|
||||||
: Icons.cancel,
|
: Icons.cancel,
|
||||||
color: widget.data[index].enabled == true
|
color: widget.data[index].enabled == true
|
||||||
? Colors.green
|
? appConfigProvider.useThemeColorForStatus == true
|
||||||
: Colors.red,
|
? Theme.of(context).primaryColor
|
||||||
|
: Colors.green
|
||||||
|
: appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Colors.grey
|
||||||
|
: Colors.red
|
||||||
),
|
),
|
||||||
onTap: () => openDetailsModal(widget.data[index]),
|
onTap: () => openDetailsModal(widget.data[index]),
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
|
||||||
import 'package:adguard_home_manager/screens/filters/filter_list_tile.dart';
|
import 'package:adguard_home_manager/screens/filters/filter_list_tile.dart';
|
||||||
|
|
||||||
import 'package:adguard_home_manager/functions/format_time.dart';
|
import 'package:adguard_home_manager/functions/format_time.dart';
|
||||||
|
import 'package:adguard_home_manager/providers/app_config_provider.dart';
|
||||||
import 'package:adguard_home_manager/models/filtering.dart';
|
import 'package:adguard_home_manager/models/filtering.dart';
|
||||||
|
|
||||||
class ListDetailsModal extends StatelessWidget {
|
class ListDetailsModal extends StatelessWidget {
|
||||||
|
@ -26,6 +28,8 @@ class ListDetailsModal extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final appConfigProvider = Provider.of<AppConfigProvider>(context);
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: const BorderRadius.only(
|
borderRadius: const BorderRadius.only(
|
||||||
|
@ -96,7 +100,11 @@ class ListDetailsModal extends StatelessWidget {
|
||||||
? AppLocalizations.of(context)!.enabled
|
? AppLocalizations.of(context)!.enabled
|
||||||
: AppLocalizations.of(context)!.disabled,
|
: AppLocalizations.of(context)!.disabled,
|
||||||
color: list.enabled == true
|
color: list.enabled == true
|
||||||
? Colors.green
|
? appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Theme.of(context).primaryColor
|
||||||
|
: Colors.green
|
||||||
|
: appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Colors.grey
|
||||||
: Colors.red,
|
: Colors.red,
|
||||||
bold: true,
|
bold: true,
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
|
||||||
import 'package:adguard_home_manager/screens/logs/log_list_tile.dart';
|
import 'package:adguard_home_manager/screens/logs/log_list_tile.dart';
|
||||||
|
|
||||||
import 'package:adguard_home_manager/functions/get_filtered_status.dart';
|
import 'package:adguard_home_manager/functions/get_filtered_status.dart';
|
||||||
import 'package:adguard_home_manager/functions/format_time.dart';
|
import 'package:adguard_home_manager/functions/format_time.dart';
|
||||||
|
import 'package:adguard_home_manager/providers/app_config_provider.dart';
|
||||||
import 'package:adguard_home_manager/models/logs.dart';
|
import 'package:adguard_home_manager/models/logs.dart';
|
||||||
|
|
||||||
class LogDetailsModal extends StatelessWidget {
|
class LogDetailsModal extends StatelessWidget {
|
||||||
|
@ -21,8 +23,10 @@ class LogDetailsModal extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final appConfigProvider = Provider.of<AppConfigProvider>(context);
|
||||||
|
|
||||||
Widget getResult() {
|
Widget getResult() {
|
||||||
final filter = getFilteredStatus(context, log.reason, true);
|
final filter = getFilteredStatus(context, appConfigProvider, log.reason, true);
|
||||||
return Text(
|
return Text(
|
||||||
filter['label'],
|
filter['label'],
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
|
@ -222,11 +226,11 @@ class LogDetailsModal extends StatelessWidget {
|
||||||
children: [
|
children: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
blockUnblock(log, getFilteredStatus(context, log.reason, true)['filtered'] == true ? 'unblock' : 'block');
|
blockUnblock(log, getFilteredStatus(context, appConfigProvider, log.reason, true)['filtered'] == true ? 'unblock' : 'block');
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
getFilteredStatus(context, log.reason, true)['filtered'] == true
|
getFilteredStatus(context, appConfigProvider, log.reason, true)['filtered'] == true
|
||||||
? AppLocalizations.of(context)!.unblockDomain
|
? AppLocalizations.of(context)!.unblockDomain
|
||||||
: AppLocalizations.of(context)!.blockDomain
|
: AppLocalizations.of(context)!.blockDomain
|
||||||
)
|
)
|
||||||
|
|
|
@ -63,7 +63,7 @@ class LogTile extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget generateLogStatus() {
|
Widget generateLogStatus() {
|
||||||
final filter = getFilteredStatus(context, log.reason, false);
|
final filter = getFilteredStatus(context, appConfigProvider, log.reason, false);
|
||||||
return logStatusWidget(
|
return logStatusWidget(
|
||||||
icon: filter['icon'],
|
icon: filter['icon'],
|
||||||
color: filter['color'],
|
color: filter['color'],
|
||||||
|
|
|
@ -542,7 +542,7 @@ class _EncryptionSettingsWidgetState extends State<EncryptionSettingsWidget> {
|
||||||
builder: (context) => EncryptionErrorModal(error: validDataError!)
|
builder: (context) => EncryptionErrorModal(error: validDataError!)
|
||||||
)
|
)
|
||||||
} : null,
|
} : null,
|
||||||
icon: generateStatus(localValidationValid, dataValidApi),
|
icon: generateStatus(context, appConfigProvider, localValidationValid, dataValidApi),
|
||||||
tooltip: generateStatusString(context, localValidationValid, dataValidApi)
|
tooltip: generateStatusString(context, localValidationValid, dataValidApi)
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
|
||||||
|
import 'package:adguard_home_manager/providers/app_config_provider.dart';
|
||||||
|
|
||||||
String? validateDomain(BuildContext context, String domain) {
|
String? validateDomain(BuildContext context, String domain) {
|
||||||
RegExp regExp = RegExp(r'^([a-z0-9|-]+\.)*[a-z0-9|-]+\.[a-z]+$');
|
RegExp regExp = RegExp(r'^([a-z0-9|-]+\.)*[a-z0-9|-]+\.[a-z]+$');
|
||||||
if (regExp.hasMatch(domain)) {
|
if (regExp.hasMatch(domain)) {
|
||||||
|
@ -50,7 +52,7 @@ String? validatePath(BuildContext context, String cert) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget generateStatus(bool localValidation, int dataValidApi) {
|
Widget generateStatus(BuildContext context, AppConfigProvider appConfigProvider, bool localValidation, int dataValidApi) {
|
||||||
if (localValidation == true) {
|
if (localValidation == true) {
|
||||||
if (dataValidApi == 0) {
|
if (dataValidApi == 0) {
|
||||||
return const SizedBox(
|
return const SizedBox(
|
||||||
|
@ -62,15 +64,19 @@ Widget generateStatus(bool localValidation, int dataValidApi) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (dataValidApi == 1) {
|
else if (dataValidApi == 1) {
|
||||||
return const Icon(
|
return Icon(
|
||||||
Icons.check_circle_rounded,
|
Icons.check_circle_rounded,
|
||||||
color: Colors.green,
|
color: appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Theme.of(context).primaryColor
|
||||||
|
: Colors.green,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (dataValidApi == 2) {
|
else if (dataValidApi == 2) {
|
||||||
return const Icon(
|
return Icon(
|
||||||
Icons.cancel_rounded,
|
Icons.cancel_rounded,
|
||||||
color: Colors.red,
|
color: appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Theme.of(context).listTileTheme.iconColor
|
||||||
|
: Colors.red,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue