Fixed settings sliver list

This commit is contained in:
Juan Gilsanz Polo 2023-10-24 21:28:57 +02:00
parent 6f3ba647f4
commit 229d329936

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,
),
],
),
)
],
)
],
) )
], ),
), ),
) )
); );