Merge branch 'beta'

This commit is contained in:
Juan Gilsanz Polo 2023-10-24 21:30:43 +02:00
commit 6e01ace7b6
4 changed files with 240 additions and 267 deletions

View file

@ -176,65 +176,6 @@ class _HomeState extends State<Home> {
), ),
TopItemsLists(order: appConfigProvider.homeTopItemsOrder), TopItemsLists(order: appConfigProvider.homeTopItemsOrder),
// if (width > 700) Column(
// children: [
// Wrap(
// alignment: WrapAlignment.center,
// children: appConfigProvider.homeTopItemsOrder.map((item) {
// switch (item) {
// case HomeTopItems.queriedDomains:
// return Padding(
// padding: const EdgeInsets.only(bottom: 16),
// child: ConstrainedBox(
// constraints: const BoxConstraints(
// maxWidth: 500
// ),
// child: TopItems(
// label: AppLocalizations.of(context)!.topQueriedDomains,
// data: statusProvider.serverStatus!.stats.topQueriedDomains,
// type: 'topQueriedDomains',
// ),
// ),
// );
// case HomeTopItems.blockedDomains:
// return Padding(
// padding: const EdgeInsets.only(bottom: 16),
// child: ConstrainedBox(
// constraints: const BoxConstraints(
// maxWidth: 500
// ),
// child: TopItems(
// label: AppLocalizations.of(context)!.topBlockedDomains,
// data: statusProvider.serverStatus!.stats.topBlockedDomains,
// type: 'topBlockedDomains',
// ),
// ),
// );
// case HomeTopItems.recurrentClients:
// return Padding(
// padding: const EdgeInsets.only(bottom: 16),
// child: ConstrainedBox(
// constraints: const BoxConstraints(
// maxWidth: 500
// ),
// child: TopItems(
// label: AppLocalizations.of(context)!.topClients,
// data: statusProvider.serverStatus!.stats.topClients,
// type: 'topClients',
// ),
// ),
// );
// default:
// return const SizedBox();
// }
// }).toList(),
// ),
// ],
// )
]; ];
} }

View file

@ -31,6 +31,8 @@ class _ManagementModalState extends State<ManagementModal> with SingleTickerProv
late Animation<double> animation; late Animation<double> animation;
final ExpandableController expandableController = ExpandableController(); final ExpandableController expandableController = ExpandableController();
final _chipsScrollController = ScrollController();
@override @override
void initState() { void initState() {
expandableController.addListener(() async { expandableController.addListener(() async {
@ -155,46 +157,58 @@ class _ManagementModalState extends State<ManagementModal> with SingleTickerProv
Widget bottomRow() { Widget bottomRow() {
return Container( return Container(
height: 40, height: Platform.isMacOS || Platform.isLinux || Platform.isWindows ? 50 : 40,
margin: const EdgeInsets.only(top: 8), margin: const EdgeInsets.only(top: 8),
child: ListView( child: Scrollbar(
scrollDirection: Axis.horizontal, controller: _chipsScrollController,
children: [ thumbVisibility: Platform.isMacOS || Platform.isLinux || Platform.isWindows,
ActionChip( interactive: Platform.isMacOS || Platform.isLinux || Platform.isWindows,
label: Text(AppLocalizations.of(context)!.seconds(30)), thickness: Platform.isMacOS || Platform.isLinux || Platform.isWindows ? 8 : 0,
onPressed: statusProvider.protectionsManagementProcess.contains('general') == false && statusProvider.serverStatus!.generalEnabled == true child: Padding(
? () => disableWithCountdown(29000) padding: EdgeInsets.only(
: null, bottom: Platform.isMacOS || Platform.isLinux || Platform.isWindows ? 16 : 0
), ),
const SizedBox(width: 8), child: ListView(
ActionChip( controller: _chipsScrollController,
label: Text(AppLocalizations.of(context)!.minute(1)), scrollDirection: Axis.horizontal,
onPressed: statusProvider.protectionsManagementProcess.contains('general') == false && statusProvider.serverStatus!.generalEnabled == true children: [
? () => disableWithCountdown(59000) ActionChip(
: null, label: Text(AppLocalizations.of(context)!.seconds(30)),
onPressed: statusProvider.protectionsManagementProcess.contains('general') == false && statusProvider.serverStatus!.generalEnabled == true
? () => disableWithCountdown(29000)
: null,
),
const SizedBox(width: 8),
ActionChip(
label: Text(AppLocalizations.of(context)!.minute(1)),
onPressed: statusProvider.protectionsManagementProcess.contains('general') == false && statusProvider.serverStatus!.generalEnabled == true
? () => disableWithCountdown(59000)
: null,
),
const SizedBox(width: 8),
ActionChip(
label: Text(AppLocalizations.of(context)!.minutes(10)),
onPressed: statusProvider.protectionsManagementProcess.contains('general') == false && statusProvider.serverStatus!.generalEnabled == true
? () => disableWithCountdown(599000)
: null,
),
const SizedBox(width: 8),
ActionChip(
label: Text(AppLocalizations.of(context)!.hour(1)),
onPressed: statusProvider.protectionsManagementProcess.contains('general') == false && statusProvider.serverStatus!.generalEnabled == true
? () => disableWithCountdown(3599000)
: null,
),
const SizedBox(width: 8),
ActionChip(
label: Text(AppLocalizations.of(context)!.hours(24)),
onPressed: statusProvider.protectionsManagementProcess.contains('general') == false && statusProvider.serverStatus!.generalEnabled == true
? () => disableWithCountdown(86399000)
: null,
),
],
), ),
const SizedBox(width: 8), ),
ActionChip(
label: Text(AppLocalizations.of(context)!.minutes(10)),
onPressed: statusProvider.protectionsManagementProcess.contains('general') == false && statusProvider.serverStatus!.generalEnabled == true
? () => disableWithCountdown(599000)
: null,
),
const SizedBox(width: 8),
ActionChip(
label: Text(AppLocalizations.of(context)!.hour(1)),
onPressed: statusProvider.protectionsManagementProcess.contains('general') == false && statusProvider.serverStatus!.generalEnabled == true
? () => disableWithCountdown(3599000)
: null,
),
const SizedBox(width: 8),
ActionChip(
label: Text(AppLocalizations.of(context)!.hours(24)),
onPressed: statusProvider.protectionsManagementProcess.contains('general') == false && statusProvider.serverStatus!.generalEnabled == true
? () => disableWithCountdown(86399000)
: null,
),
],
), ),
); );
} }

View file

@ -157,41 +157,46 @@ class _TopItemsState extends State<TopItems> {
const SizedBox(height: 24), const SizedBox(height: 24),
if (widget.data.isEmpty) noItems, if (widget.data.isEmpty) noItems,
if (widget.data.isNotEmpty && width > 700) SizedBox( if (widget.data.isNotEmpty && width > 700) Row(
height: 240, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
child: Row( children: [
mainAxisAlignment: MainAxisAlignment.spaceEvenly, Expanded(
children: [ flex: 1,
Expanded( child: ConstrainedBox(
flex: 1, constraints: const BoxConstraints(
maxHeight: 250
),
child: Padding( child: Padding(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
child: chart, child: chart,
)
),
Expanded(
flex: 2,
child: Column(
children: [
...itemsList,
OthersRowItem(items: widget.data)
]
), ),
) )
], ),
), Expanded(
flex: 2,
child: Column(
children: [
...itemsList,
OthersRowItem(items: widget.data)
]
),
)
],
), ),
if (widget.data.isNotEmpty && width <= 700) ...[ if (widget.data.isNotEmpty && width <= 700) ...[
if (_showChart) ...[ if (_showChart) ...[
chart, SizedBox(
height: 300,
child: chart
),
const SizedBox(height: 16), const SizedBox(height: 16),
], ],
...itemsList, ...itemsList,
if (_showChart) OthersRowItem(items: widget.data) if (_showChart) OthersRowItem(items: widget.data),
const SizedBox(height: 16),
], ],
if (widget.data.length > 5) ...[ if (widget.data.length > 5) ...[
const SizedBox(height: 20),
Padding( Padding(
padding: const EdgeInsets.only(right: 20), padding: const EdgeInsets.only(right: 20),
child: Row( child: Row(

View file

@ -129,158 +129,171 @@ class SettingsWidget extends StatelessWidget {
) )
) )
], ],
body: ListView( body: SafeArea(
children: [ top: false,
if ( bottom: false,
serversProvider.selectedServer != null && child: Builder(
statusProvider.serverStatus != null && builder: (context) => CustomScrollView(
serversProvider.apiClient != null slivers: [
) ...[ SliverOverlapInjector(
SectionLabel(label: AppLocalizations.of(context)!.serverSettings), handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
if (serverVersionIsAhead( ),
currentVersion: statusProvider.serverStatus!.serverVersion, SliverList.list(
referenceVersion: 'v0.107.28', children: [
referenceVersionBeta: 'v0.108.0-b.33' if (
) == true) settingsTile( serversProvider.selectedServer != null &&
icon: Icons.search_rounded, statusProvider.serverStatus != null &&
title: AppLocalizations.of(context)!.safeSearch, serversProvider.apiClient != null
subtitle: AppLocalizations.of(context)!.safeSearchSettings, ) ...[
thisItem: 0, SectionLabel(label: AppLocalizations.of(context)!.serverSettings),
screenToNavigate: const SafeSearchSettingsScreen(), if (serverVersionIsAhead(
), currentVersion: statusProvider.serverStatus!.serverVersion,
settingsTile( referenceVersion: 'v0.107.28',
icon: Icons.lock_rounded, referenceVersionBeta: 'v0.108.0-b.33'
title: AppLocalizations.of(context)!.accessSettings, ) == true) settingsTile(
subtitle: AppLocalizations.of(context)!.accessSettingsDescription, icon: Icons.search_rounded,
thisItem: 1, title: AppLocalizations.of(context)!.safeSearch,
screenToNavigate: const AccessSettings(), subtitle: AppLocalizations.of(context)!.safeSearchSettings,
), thisItem: 0,
settingsTile( screenToNavigate: const SafeSearchSettingsScreen(),
icon: Icons.install_desktop_rounded, ),
title: AppLocalizations.of(context)!.dhcpSettings, settingsTile(
subtitle: AppLocalizations.of(context)!.dhcpSettingsDescription, icon: Icons.lock_rounded,
thisItem: 2, title: AppLocalizations.of(context)!.accessSettings,
screenToNavigate: const DhcpScreen(), subtitle: AppLocalizations.of(context)!.accessSettingsDescription,
), thisItem: 1,
settingsTile( screenToNavigate: const AccessSettings(),
icon: Icons.dns_rounded, ),
title: AppLocalizations.of(context)!.dnsSettings, settingsTile(
subtitle: AppLocalizations.of(context)!.dnsSettingsDescription, icon: Icons.install_desktop_rounded,
thisItem: 3, title: AppLocalizations.of(context)!.dhcpSettings,
screenToNavigate: const DnsSettings(), subtitle: AppLocalizations.of(context)!.dhcpSettingsDescription,
), thisItem: 2,
settingsTile( screenToNavigate: const DhcpScreen(),
icon: Icons.security_rounded, ),
title: AppLocalizations.of(context)!.encryptionSettings, settingsTile(
subtitle: AppLocalizations.of(context)!.encryptionSettingsDescription, icon: Icons.dns_rounded,
thisItem: 4, title: AppLocalizations.of(context)!.dnsSettings,
screenToNavigate: const EncryptionSettings(), subtitle: AppLocalizations.of(context)!.dnsSettingsDescription,
), thisItem: 3,
settingsTile( screenToNavigate: const DnsSettings(),
icon: Icons.route_rounded, ),
title: AppLocalizations.of(context)!.dnsRewrites, settingsTile(
subtitle: AppLocalizations.of(context)!.dnsRewritesDescription, icon: Icons.security_rounded,
thisItem: 5, title: AppLocalizations.of(context)!.encryptionSettings,
screenToNavigate: const DnsRewritesScreen(), subtitle: AppLocalizations.of(context)!.encryptionSettingsDescription,
), thisItem: 4,
if (serversProvider.updateAvailable.data != null) settingsTile( screenToNavigate: const EncryptionSettings(),
icon: Icons.system_update_rounded, ),
title: AppLocalizations.of(context)!.updates, settingsTile(
subtitle: AppLocalizations.of(context)!.updatesDescription, icon: Icons.route_rounded,
trailing: serversProvider.updateAvailable.data != null && title: AppLocalizations.of(context)!.dnsRewrites,
serversProvider.updateAvailable.data!.canAutoupdate == true subtitle: AppLocalizations.of(context)!.dnsRewritesDescription,
? Container( thisItem: 5,
width: 10, screenToNavigate: const DnsRewritesScreen(),
height: 10, ),
margin: const EdgeInsets.only(right: 12), if (serversProvider.updateAvailable.data != null) settingsTile(
decoration: BoxDecoration( icon: Icons.system_update_rounded,
borderRadius: BorderRadius.circular(20), title: AppLocalizations.of(context)!.updates,
color: Colors.red subtitle: AppLocalizations.of(context)!.updatesDescription,
), trailing: serversProvider.updateAvailable.data != null &&
) serversProvider.updateAvailable.data!.canAutoupdate == true
: null, ? Container(
thisItem: 6, width: 10,
screenToNavigate: const UpdateScreen(), height: 10,
), margin: const EdgeInsets.only(right: 12),
settingsTile( decoration: BoxDecoration(
icon: Icons.info_rounded, borderRadius: BorderRadius.circular(20),
title: AppLocalizations.of(context)!.serverInformation, color: Colors.red
subtitle: AppLocalizations.of(context)!.serverInformationDescription, ),
thisItem: 7, )
screenToNavigate: const ServerInformation(), : null,
), thisItem: 6,
], screenToNavigate: const UpdateScreen(),
SectionLabel(label: AppLocalizations.of(context)!.appSettings), ),
settingsTile( settingsTile(
icon: Icons.palette_rounded, icon: Icons.info_rounded,
title: AppLocalizations.of(context)!.customization, title: AppLocalizations.of(context)!.serverInformation,
subtitle: AppLocalizations.of(context)!.customizationDescription, subtitle: AppLocalizations.of(context)!.serverInformationDescription,
thisItem: 8, thisItem: 7,
screenToNavigate: const Customization(), screenToNavigate: const ServerInformation(),
), ),
settingsTile( ],
icon: Icons.storage_rounded, SectionLabel(label: AppLocalizations.of(context)!.appSettings),
title: AppLocalizations.of(context)!.servers, settingsTile(
subtitle: serversProvider.selectedServer != null icon: Icons.palette_rounded,
? statusProvider.serverStatus != null title: AppLocalizations.of(context)!.customization,
? "${AppLocalizations.of(context)!.connectedTo} ${serversProvider.selectedServer!.name}" subtitle: AppLocalizations.of(context)!.customizationDescription,
: "${AppLocalizations.of(context)!.selectedServer} ${serversProvider.selectedServer!.name}" thisItem: 8,
: AppLocalizations.of(context)!.noServerSelected, screenToNavigate: const Customization(),
thisItem: 9,
screenToNavigate: const Servers(),
),
settingsTile(
icon: Icons.settings,
title: AppLocalizations.of(context)!.generalSettings,
subtitle: AppLocalizations.of(context)!.generalSettingsDescription,
thisItem: 10,
screenToNavigate: const GeneralSettings(),
),
settingsTile(
icon: Icons.build_outlined,
title: AppLocalizations.of(context)!.advancedSettings,
subtitle: AppLocalizations.of(context)!.advancedSetupDescription,
thisItem: 11,
screenToNavigate: const AdvancedSettings(),
),
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, settingsTile(
), icon: Icons.storage_rounded,
IconButton( title: AppLocalizations.of(context)!.servers,
onPressed: () => openUrl(Urls.gitHub), subtitle: serversProvider.selectedServer != null
icon: SvgPicture.asset( ? statusProvider.serverStatus != null
'assets/resources/github.svg', ? "${AppLocalizations.of(context)!.connectedTo} ${serversProvider.selectedServer!.name}"
color: Theme.of(context).colorScheme.onSurfaceVariant, : "${AppLocalizations.of(context)!.selectedServer} ${serversProvider.selectedServer!.name}"
width: 30, : AppLocalizations.of(context)!.noServerSelected,
height: 30, thisItem: 9,
screenToNavigate: const Servers(),
), ),
tooltip: AppLocalizations.of(context)!.gitHub, settingsTile(
), icon: Icons.settings,
], title: AppLocalizations.of(context)!.generalSettings,
), subtitle: AppLocalizations.of(context)!.generalSettingsDescription,
thisItem: 10,
screenToNavigate: const GeneralSettings(),
),
settingsTile(
icon: Icons.build_outlined,
title: AppLocalizations.of(context)!.advancedSettings,
subtitle: AppLocalizations.of(context)!.advancedSetupDescription,
thisItem: 11,
screenToNavigate: const AdvancedSettings(),
),
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,
),
],
),
)
],
)
],
) )
], ),
), ),
) )
); );