mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-05-15 06:22:48 +00:00
Changed style lists
This commit is contained in:
parent
682e9d49f5
commit
979b8b0729
7 changed files with 114 additions and 184 deletions
|
@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:provider/provider.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
import 'package:adguard_home_manager/screens/settings/custom_list_tile.dart';
|
||||
import 'package:adguard_home_manager/widgets/custom_list_tile.dart';
|
||||
import 'package:adguard_home_manager/screens/app_logs/app_logs.dart';
|
||||
|
||||
import 'package:adguard_home_manager/providers/app_config_provider.dart';
|
||||
|
@ -43,9 +43,9 @@ class AdvancedSettings extends StatelessWidget {
|
|||
body: ListView(
|
||||
children: [
|
||||
CustomListTile(
|
||||
leadingIcon: Icons.lock,
|
||||
label: AppLocalizations.of(context)!.dontCheckCertificate,
|
||||
description: AppLocalizations.of(context)!.dontCheckCertificateDescription,
|
||||
icon: Icons.lock,
|
||||
title: AppLocalizations.of(context)!.dontCheckCertificate,
|
||||
subtitle: AppLocalizations.of(context)!.dontCheckCertificateDescription,
|
||||
trailing: Switch(
|
||||
value: appConfigProvider.overrideSslCheck,
|
||||
onChanged: updateSslCheck,
|
||||
|
@ -60,9 +60,9 @@ class AdvancedSettings extends StatelessWidget {
|
|||
)
|
||||
),
|
||||
CustomListTile(
|
||||
leadingIcon: Icons.list_rounded,
|
||||
label: AppLocalizations.of(context)!.logs,
|
||||
description: AppLocalizations.of(context)!.checkAppLogs,
|
||||
icon: Icons.list_rounded,
|
||||
title: AppLocalizations.of(context)!.logs,
|
||||
subtitle: AppLocalizations.of(context)!.checkAppLogs,
|
||||
onTap: () => {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
|
|
|
@ -1,86 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class CustomListTile extends StatelessWidget {
|
||||
final IconData? leadingIcon;
|
||||
final String label;
|
||||
final String? description;
|
||||
final Color? color;
|
||||
final void Function()? onTap;
|
||||
final void Function()? onDoubleTap;
|
||||
final Widget? trailing;
|
||||
final EdgeInsets? padding;
|
||||
final bool? disableRipple;
|
||||
|
||||
const CustomListTile({
|
||||
Key? key,
|
||||
this.leadingIcon,
|
||||
required this.label,
|
||||
this.description,
|
||||
this.color,
|
||||
this.onTap,
|
||||
this.onDoubleTap,
|
||||
this.trailing,
|
||||
this.padding,
|
||||
this.disableRipple
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
onTap: onTap,
|
||||
onDoubleTap: onDoubleTap,
|
||||
splashFactory: disableRipple == true
|
||||
? NoSplash.splashFactory
|
||||
: null,
|
||||
child: Container(
|
||||
padding: padding ?? const EdgeInsets.symmetric(
|
||||
vertical: 10,
|
||||
horizontal: 25
|
||||
),
|
||||
width: double.maxFinite,
|
||||
child: Row(
|
||||
children: [
|
||||
if (leadingIcon != null) Row(
|
||||
children: [
|
||||
Icon(
|
||||
leadingIcon,
|
||||
color: color,
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
],
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: color
|
||||
),
|
||||
),
|
||||
if (description != null) Column(
|
||||
children: [
|
||||
const SizedBox(height: 5),
|
||||
Text(
|
||||
description!,
|
||||
style: TextStyle(
|
||||
color: color ?? Colors.grey
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
if (trailing != null) trailing!
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:provider/provider.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
import 'package:adguard_home_manager/screens/settings/custom_list_tile.dart';
|
||||
import 'package:adguard_home_manager/widgets/custom_list_tile.dart';
|
||||
|
||||
import 'package:adguard_home_manager/providers/app_config_provider.dart';
|
||||
|
||||
|
@ -42,9 +42,9 @@ class GeneralSettings extends StatelessWidget {
|
|||
body: ListView(
|
||||
children: [
|
||||
CustomListTile(
|
||||
leadingIcon: Icons.exposure_zero_rounded,
|
||||
label: AppLocalizations.of(context)!.hideZeroValues,
|
||||
description: AppLocalizations.of(context)!.hideZeroValuesDescription,
|
||||
icon: Icons.exposure_zero_rounded,
|
||||
title: AppLocalizations.of(context)!.hideZeroValues,
|
||||
subtitle: AppLocalizations.of(context)!.hideZeroValuesDescription,
|
||||
trailing: Switch(
|
||||
value: appConfigProvider.hideZeroValues,
|
||||
onChanged: updateHideZeroValues,
|
||||
|
|
|
@ -25,7 +25,12 @@ class DnsAddressesModal extends StatelessWidget {
|
|||
width: double.minPositive,
|
||||
child: ListView(
|
||||
children: dnsAddresses.map((address) => ListTile(
|
||||
title: Text(address),
|
||||
title: Text(
|
||||
address,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.normal
|
||||
),
|
||||
),
|
||||
)).toList(),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -3,8 +3,8 @@ import 'package:flutter/material.dart';
|
|||
import 'package:provider/provider.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
import 'package:adguard_home_manager/screens/settings/custom_list_tile.dart';
|
||||
import 'package:adguard_home_manager/screens/settings/server_info/dns_addresses_modal.dart';
|
||||
import 'package:adguard_home_manager/widgets/custom_list_tile.dart';
|
||||
|
||||
import 'package:adguard_home_manager/providers/app_config_provider.dart';
|
||||
import 'package:adguard_home_manager/services/http_requests.dart';
|
||||
|
@ -97,8 +97,8 @@ class _ServerInformationWidgetState extends State<ServerInformationWidget> {
|
|||
return ListView(
|
||||
children: [
|
||||
CustomListTile(
|
||||
label: AppLocalizations.of(context)!.dnsAddresses,
|
||||
description: AppLocalizations.of(context)!.seeDnsAddresses,
|
||||
title: AppLocalizations.of(context)!.dnsAddresses,
|
||||
subtitle: AppLocalizations.of(context)!.seeDnsAddresses,
|
||||
onTap: () {
|
||||
showModal(
|
||||
context: context,
|
||||
|
@ -109,38 +109,38 @@ class _ServerInformationWidgetState extends State<ServerInformationWidget> {
|
|||
},
|
||||
),
|
||||
CustomListTile(
|
||||
label: AppLocalizations.of(context)!.dnsPort,
|
||||
description: serverInfo.data!.dnsPort.toString(),
|
||||
title: AppLocalizations.of(context)!.dnsPort,
|
||||
subtitle: serverInfo.data!.dnsPort.toString(),
|
||||
),
|
||||
CustomListTile(
|
||||
label: AppLocalizations.of(context)!.httpPort,
|
||||
description: serverInfo.data!.httpPort.toString(),
|
||||
title: AppLocalizations.of(context)!.httpPort,
|
||||
subtitle: serverInfo.data!.httpPort.toString(),
|
||||
),
|
||||
CustomListTile(
|
||||
label: AppLocalizations.of(context)!.protectionEnabled,
|
||||
description: serverInfo.data!.protectionEnabled == true
|
||||
title: AppLocalizations.of(context)!.protectionEnabled,
|
||||
subtitle: serverInfo.data!.protectionEnabled == true
|
||||
? AppLocalizations.of(context)!.yes
|
||||
: AppLocalizations.of(context)!.no,
|
||||
),
|
||||
CustomListTile(
|
||||
label: AppLocalizations.of(context)!.dhcpAvailable,
|
||||
description: serverInfo.data!.dhcpAvailable == true
|
||||
title: AppLocalizations.of(context)!.dhcpAvailable,
|
||||
subtitle: serverInfo.data!.dhcpAvailable == true
|
||||
? AppLocalizations.of(context)!.yes
|
||||
: AppLocalizations.of(context)!.no,
|
||||
),
|
||||
CustomListTile(
|
||||
label: AppLocalizations.of(context)!.serverRunning,
|
||||
description: serverInfo.data!.running == true
|
||||
title: AppLocalizations.of(context)!.serverRunning,
|
||||
subtitle: serverInfo.data!.running == true
|
||||
? AppLocalizations.of(context)!.yes
|
||||
: AppLocalizations.of(context)!.no,
|
||||
),
|
||||
CustomListTile(
|
||||
label: AppLocalizations.of(context)!.serverVersion,
|
||||
description: serverInfo.data!.version,
|
||||
title: AppLocalizations.of(context)!.serverVersion,
|
||||
subtitle: serverInfo.data!.version,
|
||||
),
|
||||
CustomListTile(
|
||||
label: AppLocalizations.of(context)!.serverLanguage,
|
||||
description: serverInfo.data!.language,
|
||||
title: AppLocalizations.of(context)!.serverLanguage,
|
||||
subtitle: serverInfo.data!.language,
|
||||
),
|
||||
]
|
||||
);
|
||||
|
|
|
@ -5,8 +5,8 @@ import 'package:flutter_web_browser/flutter_web_browser.dart';
|
|||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
import 'package:adguard_home_manager/screens/settings/theme_modal.dart';
|
||||
import 'package:adguard_home_manager/screens/settings/custom_list_tile.dart';
|
||||
import 'package:adguard_home_manager/screens/settings/server_info/server_info.dart';
|
||||
import 'package:adguard_home_manager/widgets/custom_list_tile.dart';
|
||||
import 'package:adguard_home_manager/screens/settings/access_settings/access_settings.dart';
|
||||
import 'package:adguard_home_manager/screens/settings/dhcp/dhcp.dart';
|
||||
import 'package:adguard_home_manager/screens/settings/section_label.dart';
|
||||
|
@ -91,9 +91,9 @@ class Settings extends StatelessWidget {
|
|||
if (serversProvider.selectedServer != null) ...[
|
||||
SectionLabel(label: AppLocalizations.of(context)!.serverSettings),
|
||||
CustomListTile(
|
||||
leadingIcon: Icons.lock_rounded,
|
||||
label: AppLocalizations.of(context)!.accessSettings,
|
||||
description: AppLocalizations.of(context)!.accessSettingsDescription,
|
||||
icon: Icons.lock_rounded,
|
||||
title: AppLocalizations.of(context)!.accessSettings,
|
||||
subtitle: AppLocalizations.of(context)!.accessSettingsDescription,
|
||||
onTap: () => {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
|
@ -103,9 +103,9 @@ class Settings extends StatelessWidget {
|
|||
},
|
||||
),
|
||||
CustomListTile(
|
||||
leadingIcon: Icons.install_desktop_rounded,
|
||||
label: AppLocalizations.of(context)!.dhcpSettings,
|
||||
description: AppLocalizations.of(context)!.dhcpSettingsDescription,
|
||||
icon: Icons.install_desktop_rounded,
|
||||
title: AppLocalizations.of(context)!.dhcpSettings,
|
||||
subtitle: AppLocalizations.of(context)!.dhcpSettingsDescription,
|
||||
onTap: () => {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
|
@ -115,9 +115,9 @@ class Settings extends StatelessWidget {
|
|||
},
|
||||
),
|
||||
CustomListTile(
|
||||
leadingIcon: Icons.dns_rounded,
|
||||
label: AppLocalizations.of(context)!.dnsSettings,
|
||||
description: AppLocalizations.of(context)!.dnsSettingsDescription,
|
||||
icon: Icons.dns_rounded,
|
||||
title: AppLocalizations.of(context)!.dnsSettings,
|
||||
subtitle: AppLocalizations.of(context)!.dnsSettingsDescription,
|
||||
onTap: () => {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
|
@ -127,9 +127,9 @@ class Settings extends StatelessWidget {
|
|||
},
|
||||
),
|
||||
CustomListTile(
|
||||
leadingIcon: Icons.route_rounded,
|
||||
label: AppLocalizations.of(context)!.dnsRewrites,
|
||||
description: AppLocalizations.of(context)!.dnsRewritesDescription,
|
||||
icon: Icons.route_rounded,
|
||||
title: AppLocalizations.of(context)!.dnsRewrites,
|
||||
subtitle: AppLocalizations.of(context)!.dnsRewritesDescription,
|
||||
onTap: () => {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
|
@ -139,9 +139,9 @@ class Settings extends StatelessWidget {
|
|||
},
|
||||
),
|
||||
CustomListTile(
|
||||
leadingIcon: Icons.info_rounded,
|
||||
label: AppLocalizations.of(context)!.serverInformation,
|
||||
description: AppLocalizations.of(context)!.serverInformationDescription,
|
||||
icon: Icons.info_rounded,
|
||||
title: AppLocalizations.of(context)!.serverInformation,
|
||||
subtitle: AppLocalizations.of(context)!.serverInformationDescription,
|
||||
onTap: () => {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
|
@ -153,15 +153,15 @@ class Settings extends StatelessWidget {
|
|||
],
|
||||
SectionLabel(label: AppLocalizations.of(context)!.appSettings),
|
||||
CustomListTile(
|
||||
leadingIcon: Icons.light_mode_rounded,
|
||||
label: AppLocalizations.of(context)!.theme,
|
||||
description: getThemeString(),
|
||||
icon: Icons.light_mode_rounded,
|
||||
title: AppLocalizations.of(context)!.theme,
|
||||
subtitle: getThemeString(),
|
||||
onTap: openThemeModal,
|
||||
),
|
||||
CustomListTile(
|
||||
leadingIcon: Icons.storage_rounded,
|
||||
label: AppLocalizations.of(context)!.servers,
|
||||
description: serversProvider.selectedServer != null
|
||||
icon: Icons.storage_rounded,
|
||||
title: AppLocalizations.of(context)!.servers,
|
||||
subtitle: serversProvider.selectedServer != null
|
||||
? serversProvider.serverStatus.data != null
|
||||
? "${AppLocalizations.of(context)!.connectedTo} ${serversProvider.selectedServer!.name}"
|
||||
: "${AppLocalizations.of(context)!.selectedServer} ${serversProvider.selectedServer!.name}"
|
||||
|
@ -169,9 +169,9 @@ class Settings extends StatelessWidget {
|
|||
onTap: navigateServers,
|
||||
),
|
||||
CustomListTile(
|
||||
leadingIcon: Icons.settings,
|
||||
label: AppLocalizations.of(context)!.generalSettings,
|
||||
description: AppLocalizations.of(context)!.generalSettingsDescription,
|
||||
icon: Icons.settings,
|
||||
title: AppLocalizations.of(context)!.generalSettings,
|
||||
subtitle: AppLocalizations.of(context)!.generalSettingsDescription,
|
||||
onTap: () => {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
|
@ -181,9 +181,9 @@ class Settings extends StatelessWidget {
|
|||
},
|
||||
),
|
||||
CustomListTile(
|
||||
leadingIcon: Icons.build_outlined,
|
||||
label: AppLocalizations.of(context)!.advancedSettings,
|
||||
description: AppLocalizations.of(context)!.advancedSetupDescription,
|
||||
icon: Icons.build_outlined,
|
||||
title: AppLocalizations.of(context)!.advancedSettings,
|
||||
subtitle: AppLocalizations.of(context)!.advancedSetupDescription,
|
||||
onTap: () => {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
|
@ -194,12 +194,12 @@ class Settings extends StatelessWidget {
|
|||
),
|
||||
SectionLabel(label: AppLocalizations.of(context)!.aboutApp),
|
||||
CustomListTile(
|
||||
label: AppLocalizations.of(context)!.appVersion,
|
||||
description: appConfigProvider.getAppInfo!.version,
|
||||
title: AppLocalizations.of(context)!.appVersion,
|
||||
subtitle: appConfigProvider.getAppInfo!.version,
|
||||
),
|
||||
CustomListTile(
|
||||
label: AppLocalizations.of(context)!.createdBy,
|
||||
description: Strings.createdBy,
|
||||
title: AppLocalizations.of(context)!.createdBy,
|
||||
subtitle: Strings.createdBy,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(15),
|
||||
|
|
|
@ -3,15 +3,19 @@ import 'package:flutter/material.dart';
|
|||
class CustomListTile extends StatelessWidget {
|
||||
final String title;
|
||||
final String? subtitle;
|
||||
final void Function() onTap;
|
||||
final void Function()? onTap;
|
||||
final IconData? icon;
|
||||
final Widget? trailing;
|
||||
final EdgeInsets? padding;
|
||||
|
||||
const CustomListTile({
|
||||
Key? key,
|
||||
required this.title,
|
||||
this.subtitle,
|
||||
required this.onTap,
|
||||
this.onTap,
|
||||
this.icon,
|
||||
this.trailing,
|
||||
this.padding
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
|
@ -21,8 +25,12 @@ class CustomListTile extends StatelessWidget {
|
|||
child: InkWell(
|
||||
onTap: onTap,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 15),
|
||||
padding: padding ?? const EdgeInsets.symmetric(horizontal: 20, vertical: 15),
|
||||
child: Row(
|
||||
children: [
|
||||
Flexible(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (icon != null) ...[
|
||||
Icon(
|
||||
|
@ -31,37 +39,40 @@ class CustomListTile extends StatelessWidget {
|
|||
),
|
||||
const SizedBox(width: 20),
|
||||
],
|
||||
Column(
|
||||
Flexible(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width-84,
|
||||
child: Text(
|
||||
Text(
|
||||
title,
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.normal
|
||||
),
|
||||
),
|
||||
),
|
||||
if (subtitle != null) ...[
|
||||
const SizedBox(height: 5),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width-84,
|
||||
child: Text(
|
||||
Text(
|
||||
subtitle!,
|
||||
style: const TextStyle(
|
||||
color: Color.fromRGBO(104, 104, 104, 1),
|
||||
fontSize: 14
|
||||
),
|
||||
),
|
||||
),
|
||||
]
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
if (trailing != null) ...[
|
||||
const SizedBox(width: 10),
|
||||
trailing!
|
||||
]
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue