Fixed scrolling issue on some screens

This commit is contained in:
Juan Gilsanz Polo 2023-05-21 14:52:35 +02:00
parent df4564e975
commit 9aa79806a9
2 changed files with 128 additions and 162 deletions

View file

@ -294,35 +294,25 @@ class LogDetailsScreen extends StatelessWidget {
}
else {
return Scaffold(
body: NestedScrollView(
headerSliverBuilder: (context, innerBoxIsScrolled) => [
SliverOverlapAbsorber(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
sliver: SliverAppBar(
pinned: true,
floating: true,
centerTitle: false,
forceElevated: innerBoxIsScrolled,
title: Text(AppLocalizations.of(context)!.logDetails),
actions: [
if (serversProvider.filteringStatus != null) IconButton(
onPressed: () => blockUnblock(log, getFilteredStatus(context, appConfigProvider, log.reason, true)['filtered'] == true ? 'unblock' : 'block'),
icon: Icon(
getFilteredStatus(context, appConfigProvider, log.reason, true)['filtered'] == true
? Icons.check_circle_rounded
: Icons.block
),
tooltip: getFilteredStatus(context, appConfigProvider, log.reason, true)['filtered'] == true
? AppLocalizations.of(context)!.unblockDomain
: AppLocalizations.of(context)!.blockDomain,
),
const SizedBox(width: 10)
],
appBar: AppBar(
centerTitle: false,
title: Text(AppLocalizations.of(context)!.logDetails),
actions: [
if (serversProvider.filteringStatus != null) IconButton(
onPressed: () => blockUnblock(log, getFilteredStatus(context, appConfigProvider, log.reason, true)['filtered'] == true ? 'unblock' : 'block'),
icon: Icon(
getFilteredStatus(context, appConfigProvider, log.reason, true)['filtered'] == true
? Icons.check_circle_rounded
: Icons.block
),
)
tooltip: getFilteredStatus(context, appConfigProvider, log.reason, true)['filtered'] == true
? AppLocalizations.of(context)!.unblockDomain
: AppLocalizations.of(context)!.blockDomain,
),
const SizedBox(width: 10)
],
body: content(),
),
body: content(),
);
}
}

View file

@ -109,143 +109,119 @@ class _GeneralSettingsState extends State<GeneralSettings> {
}
return Scaffold(
body: NestedScrollView(
headerSliverBuilder: (context, innerBoxIsScrolled) => [
SliverOverlapAbsorber(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
sliver: SliverAppBar(
pinned: true,
floating: true,
centerTitle: false,
forceElevated: innerBoxIsScrolled,
title: Text(AppLocalizations.of(context)!.generalSettings),
)
)
],
body: SafeArea(
top: false,
bottom: false,
child: Builder(
builder: (context) => CustomScrollView(
slivers: [
SliverOverlapInjector(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
),
SliverList.list(
children: [
SectionLabel(label: AppLocalizations.of(context)!.home),
CustomListTile(
icon: Icons.exposure_zero_rounded,
title: AppLocalizations.of(context)!.hideZeroValues,
subtitle: AppLocalizations.of(context)!.hideZeroValuesDescription,
trailing: Switch(
value: appConfigProvider.hideZeroValues,
onChanged: (value) => updateSettings(
newStatus: value,
function: appConfigProvider.setHideZeroValues
),
),
onTap: () => updateSettings(
newStatus: !appConfigProvider.hideZeroValues,
function: appConfigProvider.setHideZeroValues
),
padding: const EdgeInsets.only(
top: 10,
bottom: 10,
left: 16,
right: 10
)
),
CustomListTile(
icon: Icons.show_chart_rounded,
title: AppLocalizations.of(context)!.combinedChart,
subtitle: AppLocalizations.of(context)!.combinedChartDescription,
trailing: Switch(
value: appConfigProvider.combinedChartHome,
onChanged: (value) => updateSettings(
newStatus: value,
function: appConfigProvider.setCombinedChartHome
),
),
onTap: () => updateSettings(
newStatus: !appConfigProvider.combinedChartHome,
function: appConfigProvider.setCombinedChartHome
),
padding: const EdgeInsets.only(
top: 10,
bottom: 10,
left: 16,
right: 10
)
),
SectionLabel(label: AppLocalizations.of(context)!.logs),
CustomListTile(
icon: Icons.timer_rounded,
title: AppLocalizations.of(context)!.timeLogs,
subtitle: AppLocalizations.of(context)!.timeLogsDescription,
trailing: Switch(
value: appConfigProvider.showTimeLogs,
onChanged: (value) => updateSettings(
newStatus: value,
function: appConfigProvider.setshowTimeLogs
),
),
onTap: () => updateSettings(
newStatus: !appConfigProvider.showTimeLogs,
function: appConfigProvider.setshowTimeLogs
),
padding: const EdgeInsets.only(
top: 10,
bottom: 10,
left: 16,
right: 10
)
),
CustomListTile(
icon: Icons.more,
title: AppLocalizations.of(context)!.ipLogs,
subtitle: AppLocalizations.of(context)!.ipLogsDescription,
trailing: Switch(
value: appConfigProvider.showIpLogs,
onChanged: (value) => updateSettings(
newStatus: value,
function: appConfigProvider.setShowIpLogs
),
),
onTap: () => updateSettings(
newStatus: !appConfigProvider.showIpLogs,
function: appConfigProvider.setShowIpLogs
),
padding: const EdgeInsets.only(
top: 10,
bottom: 10,
left: 16,
right: 10
)
),
if (
!(Platform.isAndroid || Platform.isIOS) ||
(Platform.isAndroid && (
appConfigProvider.installationSource == Source.IS_INSTALLED_FROM_LOCAL_SOURCE) ||
appConfigProvider.installationSource == Source.UNKNOWN
)
) ...[
SectionLabel(label: AppLocalizations.of(context)!.application),
CustomListTile(
icon: Icons.system_update_rounded,
title: AppLocalizations.of(context)!.appUpdates,
subtitle: appConfigProvider.appUpdatesAvailable != null
? AppLocalizations.of(context)!.updateAvailable
: AppLocalizations.of(context)!.usingLatestVersion,
trailing: generateAppUpdateStatus()
)
]
],
)
],
appBar: AppBar(
title: Text(AppLocalizations.of(context)!.generalSettings),
),
body: ListView(
children: [
SectionLabel(label: AppLocalizations.of(context)!.home),
CustomListTile(
icon: Icons.exposure_zero_rounded,
title: AppLocalizations.of(context)!.hideZeroValues,
subtitle: AppLocalizations.of(context)!.hideZeroValuesDescription,
trailing: Switch(
value: appConfigProvider.hideZeroValues,
onChanged: (value) => updateSettings(
newStatus: value,
function: appConfigProvider.setHideZeroValues
),
),
)
)
onTap: () => updateSettings(
newStatus: !appConfigProvider.hideZeroValues,
function: appConfigProvider.setHideZeroValues
),
padding: const EdgeInsets.only(
top: 10,
bottom: 10,
left: 16,
right: 10
)
),
CustomListTile(
icon: Icons.show_chart_rounded,
title: AppLocalizations.of(context)!.combinedChart,
subtitle: AppLocalizations.of(context)!.combinedChartDescription,
trailing: Switch(
value: appConfigProvider.combinedChartHome,
onChanged: (value) => updateSettings(
newStatus: value,
function: appConfigProvider.setCombinedChartHome
),
),
onTap: () => updateSettings(
newStatus: !appConfigProvider.combinedChartHome,
function: appConfigProvider.setCombinedChartHome
),
padding: const EdgeInsets.only(
top: 10,
bottom: 10,
left: 16,
right: 10
)
),
SectionLabel(label: AppLocalizations.of(context)!.logs),
CustomListTile(
icon: Icons.timer_rounded,
title: AppLocalizations.of(context)!.timeLogs,
subtitle: AppLocalizations.of(context)!.timeLogsDescription,
trailing: Switch(
value: appConfigProvider.showTimeLogs,
onChanged: (value) => updateSettings(
newStatus: value,
function: appConfigProvider.setshowTimeLogs
),
),
onTap: () => updateSettings(
newStatus: !appConfigProvider.showTimeLogs,
function: appConfigProvider.setshowTimeLogs
),
padding: const EdgeInsets.only(
top: 10,
bottom: 10,
left: 16,
right: 10
)
),
CustomListTile(
icon: Icons.more,
title: AppLocalizations.of(context)!.ipLogs,
subtitle: AppLocalizations.of(context)!.ipLogsDescription,
trailing: Switch(
value: appConfigProvider.showIpLogs,
onChanged: (value) => updateSettings(
newStatus: value,
function: appConfigProvider.setShowIpLogs
),
),
onTap: () => updateSettings(
newStatus: !appConfigProvider.showIpLogs,
function: appConfigProvider.setShowIpLogs
),
padding: const EdgeInsets.only(
top: 10,
bottom: 10,
left: 16,
right: 10
)
),
if (
!(Platform.isAndroid || Platform.isIOS) ||
(Platform.isAndroid && (
appConfigProvider.installationSource == Source.IS_INSTALLED_FROM_LOCAL_SOURCE) ||
appConfigProvider.installationSource == Source.UNKNOWN
)
) ...[
SectionLabel(label: AppLocalizations.of(context)!.application),
CustomListTile(
icon: Icons.system_update_rounded,
title: AppLocalizations.of(context)!.appUpdates,
subtitle: appConfigProvider.appUpdatesAvailable != null
? AppLocalizations.of(context)!.updateAvailable
: AppLocalizations.of(context)!.usingLatestVersion,
trailing: generateAppUpdateStatus()
)
]
],
)
);
}