mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-04-26 00:36:09 +00:00
Updated scroll screens
This commit is contained in:
parent
31f5e045c8
commit
a57a65f12a
2 changed files with 490 additions and 418 deletions
|
@ -82,9 +82,8 @@ class LogDetailsScreen extends StatelessWidget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget content() {
|
List<Widget> content() {
|
||||||
return ListView(
|
return [
|
||||||
children: [
|
|
||||||
SectionLabel(label: AppLocalizations.of(context)!.status),
|
SectionLabel(label: AppLocalizations.of(context)!.status),
|
||||||
LogListTile(
|
LogListTile(
|
||||||
icon: Icons.shield_rounded,
|
icon: Icons.shield_rounded,
|
||||||
|
@ -206,8 +205,7 @@ class LogDetailsScreen extends StatelessWidget {
|
||||||
)
|
)
|
||||||
)).toList()
|
)).toList()
|
||||||
]
|
]
|
||||||
],
|
];
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dialog) {
|
if (dialog) {
|
||||||
|
@ -269,7 +267,9 @@ class LogDetailsScreen extends StatelessWidget {
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||||
child: content(),
|
child: ListView(
|
||||||
|
children: content(),
|
||||||
|
)
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
@ -279,8 +279,15 @@ class LogDetailsScreen extends StatelessWidget {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
body: NestedScrollView(
|
||||||
|
headerSliverBuilder: (context, innerBoxIsScrolled) => [
|
||||||
|
SliverOverlapAbsorber(
|
||||||
|
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
||||||
|
sliver: SliverAppBar.large(
|
||||||
|
pinned: true,
|
||||||
|
floating: true,
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
|
forceElevated: innerBoxIsScrolled,
|
||||||
title: Text(AppLocalizations.of(context)!.logDetails),
|
title: Text(AppLocalizations.of(context)!.logDetails),
|
||||||
actions: [
|
actions: [
|
||||||
IconButton(
|
IconButton(
|
||||||
|
@ -307,7 +314,25 @@ class LogDetailsScreen extends StatelessWidget {
|
||||||
const SizedBox(width: 10)
|
const SizedBox(width: 10)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: content(),
|
)
|
||||||
|
],
|
||||||
|
body: SafeArea(
|
||||||
|
top: false,
|
||||||
|
bottom: false,
|
||||||
|
child: Builder(
|
||||||
|
builder: (context) => CustomScrollView(
|
||||||
|
slivers: [
|
||||||
|
SliverOverlapInjector(
|
||||||
|
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
||||||
|
),
|
||||||
|
SliverList.list(
|
||||||
|
children: content()
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,7 +192,17 @@ class _LogsState extends State<Logs> {
|
||||||
Widget generateBody() {
|
Widget generateBody() {
|
||||||
switch (logsProvider.loadStatus) {
|
switch (logsProvider.loadStatus) {
|
||||||
case LoadStatus.loading:
|
case LoadStatus.loading:
|
||||||
return SizedBox(
|
return SafeArea(
|
||||||
|
top: false,
|
||||||
|
bottom: false,
|
||||||
|
child: Builder(
|
||||||
|
builder: (context) => CustomScrollView(
|
||||||
|
slivers: [
|
||||||
|
SliverOverlapInjector(
|
||||||
|
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
||||||
|
),
|
||||||
|
SliverFillRemaining(
|
||||||
|
child: SizedBox(
|
||||||
width: double.maxFinite,
|
width: double.maxFinite,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
@ -209,20 +219,25 @@ class _LogsState extends State<Logs> {
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
case LoadStatus.loaded:
|
case LoadStatus.loaded:
|
||||||
return RefreshIndicator(
|
return SafeArea(
|
||||||
onRefresh: () async {
|
top: false,
|
||||||
await logsProvider.fetchLogs(inOffset: 0);
|
bottom: false,
|
||||||
},
|
child: Builder(
|
||||||
child: logsProvider.logsData!.data.isNotEmpty
|
builder: (context) => CustomScrollView(
|
||||||
? ListView.builder(
|
slivers: [
|
||||||
controller: scrollController,
|
SliverOverlapInjector(
|
||||||
padding: const EdgeInsets.only(top: 0),
|
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
||||||
itemCount: logsProvider.isLoadingMore == true
|
),
|
||||||
? logsProvider.logsData!.data.length+1
|
if (logsProvider.logsData!.data.isNotEmpty) SliverList.builder(
|
||||||
: logsProvider.logsData!.data.length,
|
itemCount: logsProvider.logsData!.data.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
if (logsProvider.isLoadingMore == true && index == logsProvider.logsData!.data.length) {
|
if (logsProvider.isLoadingMore == true && index == logsProvider.logsData!.data.length) {
|
||||||
return const Padding(
|
return const Padding(
|
||||||
|
@ -255,8 +270,9 @@ class _LogsState extends State<Logs> {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
),
|
||||||
: Center(
|
if (logsProvider.logsData!.data.isEmpty) SliverFillRemaining(
|
||||||
|
child: Center(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
|
@ -284,11 +300,25 @@ class _LogsState extends State<Logs> {
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
case LoadStatus.error:
|
case LoadStatus.error:
|
||||||
return SizedBox(
|
return SafeArea(
|
||||||
|
top: false,
|
||||||
|
bottom: false,
|
||||||
|
child: Builder(
|
||||||
|
builder: (context) => CustomScrollView(
|
||||||
|
slivers: [
|
||||||
|
SliverOverlapInjector(
|
||||||
|
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
||||||
|
),
|
||||||
|
SliverFillRemaining(
|
||||||
|
child: SizedBox(
|
||||||
width: double.maxFinite,
|
width: double.maxFinite,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
@ -309,6 +339,11 @@ class _LogsState extends State<Logs> {
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -318,9 +353,18 @@ class _LogsState extends State<Logs> {
|
||||||
|
|
||||||
Widget logsScreen() {
|
Widget logsScreen() {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
body: NestedScrollView(
|
||||||
title: Text(AppLocalizations.of(context)!.logs),
|
headerSliverBuilder: (context, innerBoxIsScrolled) => [
|
||||||
|
SliverOverlapAbsorber(
|
||||||
|
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
||||||
|
sliver: SliverAppBar.large(
|
||||||
|
pinned: true,
|
||||||
|
floating: true,
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
|
forceElevated: innerBoxIsScrolled,
|
||||||
|
title: Text(AppLocalizations.of(context)!.logs),
|
||||||
|
expandedHeight: logsProvider.appliedFilters.searchText != null || logsProvider.appliedFilters.selectedResultStatus != 'all' || logsProvider.appliedFilters.clients != null
|
||||||
|
? 170 : null,
|
||||||
actions: [
|
actions: [
|
||||||
if (!(Platform.isAndroid || Platform.isIOS)) IconButton(
|
if (!(Platform.isAndroid || Platform.isIOS)) IconButton(
|
||||||
onPressed: () => logsProvider.fetchLogs(inOffset: 0),
|
onPressed: () => logsProvider.fetchLogs(inOffset: 0),
|
||||||
|
@ -369,7 +413,7 @@ class _LogsState extends State<Logs> {
|
||||||
],
|
],
|
||||||
bottom: logsProvider.appliedFilters.searchText != null || logsProvider.appliedFilters.selectedResultStatus != 'all' || logsProvider.appliedFilters.clients != null
|
bottom: logsProvider.appliedFilters.searchText != null || logsProvider.appliedFilters.selectedResultStatus != 'all' || logsProvider.appliedFilters.clients != null
|
||||||
? PreferredSize(
|
? PreferredSize(
|
||||||
preferredSize: const Size(double.maxFinite, 50),
|
preferredSize: const Size(double.maxFinite, 70),
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 50,
|
height: 50,
|
||||||
width: double.maxFinite,
|
width: double.maxFinite,
|
||||||
|
@ -494,7 +538,10 @@ class _LogsState extends State<Logs> {
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
body: generateBody()
|
body: generateBody()
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue