mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-04-29 01:58:08 +00:00
Added sliver app bar client logs
This commit is contained in:
parent
ce8d38958e
commit
d65ea6520c
2 changed files with 157 additions and 128 deletions
|
@ -260,7 +260,7 @@ class _ClientScreenState extends State<ClientScreen> {
|
|||
],
|
||||
body: SafeArea(
|
||||
top: false,
|
||||
bottom: true,
|
||||
bottom: false,
|
||||
child: Builder(
|
||||
builder: (context) => CustomScrollView(
|
||||
slivers: [
|
||||
|
|
|
@ -131,10 +131,38 @@ class _LogsListClientState extends State<LogsListClient> {
|
|||
setState(() => previousIp = widget.ip);
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(widget.name != null && widget.name != '' ? widget.name! : widget.ip),
|
||||
centerTitle: true,
|
||||
return Material(
|
||||
child: NestedScrollView(
|
||||
headerSliverBuilder: (context, innerBoxIsScrolled) => [
|
||||
SliverOverlapAbsorber(
|
||||
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
||||
sliver: SliverAppBar.large(
|
||||
pinned: true,
|
||||
floating: true,
|
||||
centerTitle: false,
|
||||
forceElevated: innerBoxIsScrolled,
|
||||
title: SafeArea(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
AppLocalizations.of(context)!.client,
|
||||
style: const TextStyle(
|
||||
fontSize: 24
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
widget.name != null && widget.name != '' ? widget.name! : widget.ip,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).colorScheme.secondary
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
surfaceTintColor: isDesktop(MediaQuery.of(context).size.width)
|
||||
? Colors.transparent
|
||||
: null,
|
||||
|
@ -148,13 +176,23 @@ class _LogsListClientState extends State<LogsListClient> {
|
|||
const SizedBox(width: 8)
|
||||
]
|
||||
],
|
||||
),
|
||||
)
|
||||
)
|
||||
],
|
||||
body: SafeArea(
|
||||
top: false,
|
||||
bottom: false,
|
||||
child: Builder(
|
||||
builder: (context) {
|
||||
switch (loadStatus) {
|
||||
case 0:
|
||||
return SizedBox(
|
||||
builder: (context) => RefreshIndicator(
|
||||
onRefresh: fetchLogs,
|
||||
displacement: 95,
|
||||
child: CustomScrollView(
|
||||
slivers: [
|
||||
SliverOverlapInjector(
|
||||
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
||||
),
|
||||
if (loadStatus == 0) SliverFillRemaining(
|
||||
child: SizedBox(
|
||||
width: double.maxFinite,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
|
@ -172,15 +210,9 @@ class _LogsListClientState extends State<LogsListClient> {
|
|||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
case 1:
|
||||
if (logsData!.data.isNotEmpty) {
|
||||
return RefreshIndicator(
|
||||
onRefresh: fetchLogs,
|
||||
child: ListView.builder(
|
||||
controller: scrollController,
|
||||
padding: const EdgeInsets.only(top: 0),
|
||||
)
|
||||
),
|
||||
if (loadStatus == 1 && logsData!.data.isNotEmpty) SliverList.builder(
|
||||
itemCount: isLoadingMore == true
|
||||
? logsData!.data.length+1
|
||||
: logsData!.data.length,
|
||||
|
@ -225,10 +257,8 @@ class _LogsListClientState extends State<LogsListClient> {
|
|||
}
|
||||
}
|
||||
),
|
||||
);
|
||||
}
|
||||
else {
|
||||
return Center(
|
||||
if (loadStatus == 1 && logsData!.data.isEmpty) SliverFillRemaining(
|
||||
child: Center(
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.noLogsDisplay,
|
||||
textAlign: TextAlign.center,
|
||||
|
@ -237,11 +267,10 @@ class _LogsListClientState extends State<LogsListClient> {
|
|||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
case 2:
|
||||
return SizedBox(
|
||||
),
|
||||
),
|
||||
if (loadStatus == 2) SliverFillRemaining(
|
||||
child: SizedBox(
|
||||
width: double.maxFinite,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
|
@ -263,14 +292,14 @@ class _LogsListClientState extends State<LogsListClient> {
|
|||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
default:
|
||||
return const SizedBox();
|
||||
}
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue