diff --git a/lib/functions/snackbar.dart b/lib/functions/snackbar.dart index 123ef3f..b332fcd 100644 --- a/lib/functions/snackbar.dart +++ b/lib/functions/snackbar.dart @@ -9,10 +9,12 @@ void showSnacbkar({ required AppConfigProvider appConfigProvider, required String label, required Color color, - Color? labelColor + Color? labelColor, + GlobalKey? key, }) async { + final GlobalKey scaffoldKey = key ?? scaffoldMessengerKey; if (appConfigProvider.showingSnackbar == true) { - scaffoldMessengerKey.currentState?.clearSnackBars(); + scaffoldKey.currentState?.clearSnackBars(); await Future.delayed(const Duration(milliseconds: 500)); } appConfigProvider.setShowingSnackbar(true); @@ -26,7 +28,7 @@ void showSnacbkar({ ), backgroundColor: color, ); - scaffoldMessengerKey.currentState?.showSnackBar(snackBar).closed.then( + scaffoldKey.currentState?.showSnackBar(snackBar).closed.then( (value) => appConfigProvider.setShowingSnackbar(false) ); } \ No newline at end of file diff --git a/lib/screens/settings/settings.dart b/lib/screens/settings/settings.dart index c9b7151..92ea100 100644 --- a/lib/screens/settings/settings.dart +++ b/lib/screens/settings/settings.dart @@ -1,5 +1,6 @@ import 'dart:io'; +import 'package:adguard_home_manager/config/globals.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -101,214 +102,217 @@ class _SettingsWidgetState extends State<_SettingsWidget> { appConfigProvider.setSelectedSettingsScreen(screen: null); } - return Scaffold( - body: NestedScrollView( - headerSliverBuilder: (context, innerBoxIsScrolled) => [ - SliverOverlapAbsorber( - handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), - sliver: SliverAppBar.large( - pinned: true, - floating: true, - centerTitle: false, - forceElevated: innerBoxIsScrolled, - surfaceTintColor: isDesktop(width) ? Colors.transparent : null, - title: Text(AppLocalizations.of(context)!.settings), + return ScaffoldMessenger( + key: widget.twoColumns ? GlobalKey() : null, + child: Scaffold( + body: NestedScrollView( + headerSliverBuilder: (context, innerBoxIsScrolled) => [ + SliverOverlapAbsorber( + handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), + sliver: SliverAppBar.large( + pinned: true, + floating: true, + centerTitle: false, + forceElevated: innerBoxIsScrolled, + surfaceTintColor: isDesktop(width) ? Colors.transparent : null, + title: Text(AppLocalizations.of(context)!.settings), + ) ) - ) - ], - body: SafeArea( - top: false, - bottom: false, - child: Builder( - builder: (context) => CustomScrollView( - slivers: [ - SliverOverlapInjector( - handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), - ), - SliverList.list( - children: [ - if ( - serversProvider.selectedServer != null && - statusProvider.serverStatus != null && - serversProvider.apiClient2 != null - ) ...[ - SectionLabel(label: AppLocalizations.of(context)!.serverSettings), - _SettingsTile( - icon: Icons.search_rounded, - title: AppLocalizations.of(context)!.safeSearch, - subtitle: AppLocalizations.of(context)!.safeSearchSettings, - thisItem: 0, - screenToNavigate: const SafeSearchSettingsScreen(), - twoColumns: widget.twoColumns, - ), - _SettingsTile( - icon: Icons.list_alt_rounded, - title: AppLocalizations.of(context)!.logsSettings, - subtitle: AppLocalizations.of(context)!.logsSettingsDescription, - thisItem: 1, - screenToNavigate: const LogsSettings(), - twoColumns: widget.twoColumns, - ), - _SettingsTile( - icon: Icons.analytics_rounded, - title: AppLocalizations.of(context)!.statisticsSettings, - subtitle: AppLocalizations.of(context)!.statisticsSettingsDescription, - thisItem: 2, - screenToNavigate: const StatisticsSettings(), - twoColumns: widget.twoColumns, - ), - _SettingsTile( - icon: Icons.lock_rounded, - title: AppLocalizations.of(context)!.accessSettings, - subtitle: AppLocalizations.of(context)!.accessSettingsDescription, - thisItem: 3, - screenToNavigate: const AccessSettings(), - twoColumns: widget.twoColumns, - ), - _SettingsTile( - icon: Icons.install_desktop_rounded, - title: AppLocalizations.of(context)!.dhcpSettings, - subtitle: AppLocalizations.of(context)!.dhcpSettingsDescription, - thisItem: 4, - screenToNavigate: const DhcpScreen(), - twoColumns: widget.twoColumns, - ), - _SettingsTile( - icon: Icons.dns_rounded, - title: AppLocalizations.of(context)!.dnsSettings, - subtitle: AppLocalizations.of(context)!.dnsSettingsDescription, - thisItem: 5, - screenToNavigate: DnsSettings( - splitView: widget.twoColumns, + ], + body: SafeArea( + top: false, + bottom: false, + child: Builder( + builder: (context) => CustomScrollView( + slivers: [ + SliverOverlapInjector( + handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), + ), + SliverList.list( + children: [ + if ( + serversProvider.selectedServer != null && + statusProvider.serverStatus != null && + serversProvider.apiClient2 != null + ) ...[ + SectionLabel(label: AppLocalizations.of(context)!.serverSettings), + _SettingsTile( + icon: Icons.search_rounded, + title: AppLocalizations.of(context)!.safeSearch, + subtitle: AppLocalizations.of(context)!.safeSearchSettings, + thisItem: 0, + screenToNavigate: const SafeSearchSettingsScreen(), + twoColumns: widget.twoColumns, ), + _SettingsTile( + icon: Icons.list_alt_rounded, + title: AppLocalizations.of(context)!.logsSettings, + subtitle: AppLocalizations.of(context)!.logsSettingsDescription, + thisItem: 1, + screenToNavigate: const LogsSettings(), + twoColumns: widget.twoColumns, + ), + _SettingsTile( + icon: Icons.analytics_rounded, + title: AppLocalizations.of(context)!.statisticsSettings, + subtitle: AppLocalizations.of(context)!.statisticsSettingsDescription, + thisItem: 2, + screenToNavigate: const StatisticsSettings(), + twoColumns: widget.twoColumns, + ), + _SettingsTile( + icon: Icons.lock_rounded, + title: AppLocalizations.of(context)!.accessSettings, + subtitle: AppLocalizations.of(context)!.accessSettingsDescription, + thisItem: 3, + screenToNavigate: const AccessSettings(), + twoColumns: widget.twoColumns, + ), + _SettingsTile( + icon: Icons.install_desktop_rounded, + title: AppLocalizations.of(context)!.dhcpSettings, + subtitle: AppLocalizations.of(context)!.dhcpSettingsDescription, + thisItem: 4, + screenToNavigate: const DhcpScreen(), + twoColumns: widget.twoColumns, + ), + _SettingsTile( + icon: Icons.dns_rounded, + title: AppLocalizations.of(context)!.dnsSettings, + subtitle: AppLocalizations.of(context)!.dnsSettingsDescription, + thisItem: 5, + screenToNavigate: DnsSettings( + splitView: widget.twoColumns, + ), + twoColumns: widget.twoColumns, + ), + _SettingsTile( + icon: Icons.security_rounded, + title: AppLocalizations.of(context)!.encryptionSettings, + subtitle: AppLocalizations.of(context)!.encryptionSettingsDescription, + thisItem: 6, + screenToNavigate: const EncryptionSettings(), + twoColumns: widget.twoColumns, + ), + _SettingsTile( + icon: Icons.route_rounded, + title: AppLocalizations.of(context)!.dnsRewrites, + subtitle: AppLocalizations.of(context)!.dnsRewritesDescription, + thisItem: 7, + screenToNavigate: const DnsRewritesScreen(), + twoColumns: widget.twoColumns, + ), + if (serversProvider.updateAvailable.data != null) _SettingsTile( + icon: Icons.system_update_rounded, + title: AppLocalizations.of(context)!.updates, + subtitle: AppLocalizations.of(context)!.updatesDescription, + trailing: serversProvider.updateAvailable.data != null && + serversProvider.updateAvailable.data!.canAutoupdate == true + ? Container( + width: 10, + height: 10, + margin: const EdgeInsets.only(right: 12), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(20), + color: Colors.red + ), + ) + : null, + thisItem: 8, + screenToNavigate: const UpdateScreen(), + twoColumns: widget.twoColumns, + ), + _SettingsTile( + icon: Icons.info_rounded, + title: AppLocalizations.of(context)!.serverInformation, + subtitle: AppLocalizations.of(context)!.serverInformationDescription, + thisItem: 9, + screenToNavigate: const ServerInformation(), + twoColumns: widget.twoColumns, + ), + ], + SectionLabel(label: AppLocalizations.of(context)!.appSettings), + _SettingsTile( + icon: Icons.palette_rounded, + title: AppLocalizations.of(context)!.customization, + subtitle: AppLocalizations.of(context)!.customizationDescription, + thisItem: 10, + screenToNavigate: const Customization(), twoColumns: widget.twoColumns, ), _SettingsTile( - icon: Icons.security_rounded, - title: AppLocalizations.of(context)!.encryptionSettings, - subtitle: AppLocalizations.of(context)!.encryptionSettingsDescription, - thisItem: 6, - screenToNavigate: const EncryptionSettings(), + icon: Icons.storage_rounded, + title: AppLocalizations.of(context)!.servers, + subtitle: serversProvider.selectedServer != null + ? statusProvider.serverStatus != null + ? "${AppLocalizations.of(context)!.connectedTo} ${serversProvider.selectedServer!.name}" + : "${AppLocalizations.of(context)!.selectedServer} ${serversProvider.selectedServer!.name}" + : AppLocalizations.of(context)!.noServerSelected, + thisItem: 11, + screenToNavigate: const Servers(), twoColumns: widget.twoColumns, ), _SettingsTile( - icon: Icons.route_rounded, - title: AppLocalizations.of(context)!.dnsRewrites, - subtitle: AppLocalizations.of(context)!.dnsRewritesDescription, - thisItem: 7, - screenToNavigate: const DnsRewritesScreen(), - twoColumns: widget.twoColumns, - ), - if (serversProvider.updateAvailable.data != null) _SettingsTile( - icon: Icons.system_update_rounded, - title: AppLocalizations.of(context)!.updates, - subtitle: AppLocalizations.of(context)!.updatesDescription, - trailing: serversProvider.updateAvailable.data != null && - serversProvider.updateAvailable.data!.canAutoupdate == true - ? Container( - width: 10, - height: 10, - margin: const EdgeInsets.only(right: 12), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(20), - color: Colors.red - ), - ) - : null, - thisItem: 8, - screenToNavigate: const UpdateScreen(), + icon: Icons.settings, + title: AppLocalizations.of(context)!.generalSettings, + subtitle: AppLocalizations.of(context)!.generalSettingsDescription, + thisItem: 12, + screenToNavigate: GeneralSettings(splitView: widget.twoColumns), twoColumns: widget.twoColumns, ), _SettingsTile( - icon: Icons.info_rounded, - title: AppLocalizations.of(context)!.serverInformation, - subtitle: AppLocalizations.of(context)!.serverInformationDescription, - thisItem: 9, - screenToNavigate: const ServerInformation(), + icon: Icons.build_outlined, + title: AppLocalizations.of(context)!.advancedSettings, + subtitle: AppLocalizations.of(context)!.advancedSetupDescription, + thisItem: 13, + screenToNavigate: const AdvancedSettings(), twoColumns: widget.twoColumns, ), + SectionLabel(label: AppLocalizations.of(context)!.aboutApp), + CustomListTile( + title: AppLocalizations.of(context)!.appVersion, + subtitle: appConfigProvider.getAppInfo!.version, + ), + CustomListTile( + title: AppLocalizations.of(context)!.createdBy, + subtitle: Strings.createdBy, + ), + Padding( + padding: const EdgeInsets.all(15), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + if (Platform.isAndroid) IconButton( + onPressed: () => openUrl(Urls.playStore), + icon: SvgPicture.asset( + 'assets/resources/google-play.svg', + color: Theme.of(context).colorScheme.onSurfaceVariant, + width: 30, + height: 30, + ), + tooltip: AppLocalizations.of(context)!.visitGooglePlay, + ), + IconButton( + onPressed: () => openUrl(Urls.gitHub), + icon: SvgPicture.asset( + 'assets/resources/github.svg', + color: Theme.of(context).colorScheme.onSurfaceVariant, + width: 30, + height: 30, + ), + tooltip: AppLocalizations.of(context)!.gitHub, + ), + ], + ), + ) ], - SectionLabel(label: AppLocalizations.of(context)!.appSettings), - _SettingsTile( - icon: Icons.palette_rounded, - title: AppLocalizations.of(context)!.customization, - subtitle: AppLocalizations.of(context)!.customizationDescription, - thisItem: 10, - screenToNavigate: const Customization(), - twoColumns: widget.twoColumns, - ), - _SettingsTile( - icon: Icons.storage_rounded, - title: AppLocalizations.of(context)!.servers, - subtitle: serversProvider.selectedServer != null - ? statusProvider.serverStatus != null - ? "${AppLocalizations.of(context)!.connectedTo} ${serversProvider.selectedServer!.name}" - : "${AppLocalizations.of(context)!.selectedServer} ${serversProvider.selectedServer!.name}" - : AppLocalizations.of(context)!.noServerSelected, - thisItem: 11, - screenToNavigate: const Servers(), - twoColumns: widget.twoColumns, - ), - _SettingsTile( - icon: Icons.settings, - title: AppLocalizations.of(context)!.generalSettings, - subtitle: AppLocalizations.of(context)!.generalSettingsDescription, - thisItem: 12, - screenToNavigate: GeneralSettings(splitView: widget.twoColumns), - twoColumns: widget.twoColumns, - ), - _SettingsTile( - icon: Icons.build_outlined, - title: AppLocalizations.of(context)!.advancedSettings, - subtitle: AppLocalizations.of(context)!.advancedSetupDescription, - thisItem: 13, - screenToNavigate: const AdvancedSettings(), - twoColumns: widget.twoColumns, - ), - SectionLabel(label: AppLocalizations.of(context)!.aboutApp), - CustomListTile( - title: AppLocalizations.of(context)!.appVersion, - subtitle: appConfigProvider.getAppInfo!.version, - ), - CustomListTile( - title: AppLocalizations.of(context)!.createdBy, - subtitle: Strings.createdBy, - ), - Padding( - padding: const EdgeInsets.all(15), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - if (Platform.isAndroid) IconButton( - onPressed: () => openUrl(Urls.playStore), - icon: SvgPicture.asset( - 'assets/resources/google-play.svg', - color: Theme.of(context).colorScheme.onSurfaceVariant, - width: 30, - height: 30, - ), - tooltip: AppLocalizations.of(context)!.visitGooglePlay, - ), - IconButton( - onPressed: () => openUrl(Urls.gitHub), - icon: SvgPicture.asset( - 'assets/resources/github.svg', - color: Theme.of(context).colorScheme.onSurfaceVariant, - width: 30, - height: 30, - ), - tooltip: AppLocalizations.of(context)!.gitHub, - ), - ], - ), - ) - ], - ) - ], - ) + ) + ], + ) + ), ), - ), - ) + ) + ), ); } } diff --git a/macos/Podfile.lock b/macos/Podfile.lock index 9d30918..9df518c 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -4,38 +4,33 @@ PODS: - dynamic_color (0.0.2): - FlutterMacOS - FlutterMacOS (1.0.0) - - FMDB (2.7.5): - - FMDB/standard (= 2.7.5) - - FMDB/standard (2.7.5) - package_info_plus (0.0.1): - FlutterMacOS - - Sentry/HybridSDK (8.17.2): - - SentryPrivate (= 8.17.2) + - Sentry/HybridSDK (8.18.0): + - SentryPrivate (= 8.18.0) - sentry_flutter (0.0.1): - Flutter - FlutterMacOS - - Sentry/HybridSDK (= 8.17.2) - - SentryPrivate (8.17.2) - - sqflite (0.0.2): + - Sentry/HybridSDK (= 8.18.0) + - SentryPrivate (8.18.0) + - sqflite (0.0.3): + - Flutter - FlutterMacOS - - FMDB (>= 2.7.5) - - sqlite3 (3.44.0): - - sqlite3/common (= 3.44.0) - - sqlite3/common (3.44.0) - - sqlite3/fts5 (3.44.0): + - sqlite3 (3.45.0): + - sqlite3/common (= 3.45.0) + - sqlite3/common (3.45.0) + - sqlite3/fts5 (3.45.0): - sqlite3/common - - sqlite3/perf-threadsafe (3.44.0): + - sqlite3/perf-threadsafe (3.45.0): - sqlite3/common - - sqlite3/rtree (3.44.0): + - sqlite3/rtree (3.45.0): - sqlite3/common - sqlite3_flutter_libs (0.0.1): - FlutterMacOS - - sqlite3 (~> 3.44.0) + - sqlite3 (~> 3.45.0) - sqlite3/fts5 - sqlite3/perf-threadsafe - sqlite3/rtree - - url_launcher_macos (0.0.1): - - FlutterMacOS - window_size (0.0.2): - FlutterMacOS @@ -45,14 +40,12 @@ DEPENDENCIES: - FlutterMacOS (from `Flutter/ephemeral`) - package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`) - sentry_flutter (from `Flutter/ephemeral/.symlinks/plugins/sentry_flutter/macos`) - - sqflite (from `Flutter/ephemeral/.symlinks/plugins/sqflite/macos`) + - sqflite (from `Flutter/ephemeral/.symlinks/plugins/sqflite/darwin`) - sqlite3_flutter_libs (from `Flutter/ephemeral/.symlinks/plugins/sqlite3_flutter_libs/macos`) - - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) - window_size (from `Flutter/ephemeral/.symlinks/plugins/window_size/macos`) SPEC REPOS: trunk: - - FMDB - Sentry - SentryPrivate - sqlite3 @@ -69,11 +62,9 @@ EXTERNAL SOURCES: sentry_flutter: :path: Flutter/ephemeral/.symlinks/plugins/sentry_flutter/macos sqflite: - :path: Flutter/ephemeral/.symlinks/plugins/sqflite/macos + :path: Flutter/ephemeral/.symlinks/plugins/sqflite/darwin sqlite3_flutter_libs: :path: Flutter/ephemeral/.symlinks/plugins/sqlite3_flutter_libs/macos - url_launcher_macos: - :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos window_size: :path: Flutter/ephemeral/.symlinks/plugins/window_size/macos @@ -81,15 +72,13 @@ SPEC CHECKSUMS: device_info_plus: 5401765fde0b8d062a2f8eb65510fb17e77cf07f dynamic_color: 2eaa27267de1ca20d879fbd6e01259773fb1670f FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 - FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a package_info_plus: 02d7a575e80f194102bef286361c6c326e4c29ce - Sentry: 64a9f9c3637af913adcf53deced05bbe452d1410 - sentry_flutter: 57912cf425e09398bdf47f38842a1fcb9836f1be - SentryPrivate: 024c6fed507ac39ae98e6d087034160f942920d5 - sqflite: a5789cceda41d54d23f31d6de539d65bb14100ea - sqlite3: 6e2d4a4879854d0ec86b476bf3c3e30870bac273 - sqlite3_flutter_libs: a25f3a0f522fdcd8fef6a4a50a3d681dd43d8dea - url_launcher_macos: d2691c7dd33ed713bf3544850a623080ec693d95 + Sentry: 8984a4ffb2b9bd2894d74fb36e6f5833865bc18e + sentry_flutter: c87a0556eeb6cbf7f9f924d30e878bdedf22d364 + SentryPrivate: 2f0c9ba4c3fc993f70eab6ca95673509561e0085 + sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec + sqlite3: f307b6291c4db7b5086c38d6237446b98a738581 + sqlite3_flutter_libs: 6b9913d8fbb718e5ebf23658aa6934a0fb509c0f window_size: 339dafa0b27a95a62a843042038fa6c3c48de195 PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7