mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-04-26 16:56:08 +00:00
Updated scroll screens
This commit is contained in:
parent
31f5e045c8
commit
a57a65f12a
2 changed files with 490 additions and 418 deletions
|
@ -82,111 +82,15 @@ 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,
|
title: AppLocalizations.of(context)!.result,
|
||||||
title: AppLocalizations.of(context)!.result,
|
subtitleWidget: getResult(),
|
||||||
subtitleWidget: getResult(),
|
trailing: log.cached == true
|
||||||
trailing: log.cached == true
|
? Container(
|
||||||
? Container(
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
horizontal: 10,
|
|
||||||
vertical: 5
|
|
||||||
),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Theme.of(context).floatingActionButtonTheme.backgroundColor,
|
|
||||||
borderRadius: BorderRadius.circular(30)
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
"CACHE",
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
color: Theme.of(context).floatingActionButtonTheme.foregroundColor,
|
|
||||||
fontWeight: FontWeight.w500
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: null,
|
|
||||||
),
|
|
||||||
if (log.rule != null) LogListTile(
|
|
||||||
icon: Icons.block,
|
|
||||||
title: AppLocalizations.of(context)!.blockingRule,
|
|
||||||
subtitle: log.rule
|
|
||||||
),
|
|
||||||
LogListTile(
|
|
||||||
icon: Icons.schedule,
|
|
||||||
title: AppLocalizations.of(context)!.time,
|
|
||||||
subtitle: convertTimestampLocalTimezone(log.time, 'HH:mm:ss')
|
|
||||||
),
|
|
||||||
SectionLabel(label: AppLocalizations.of(context)!.request),
|
|
||||||
LogListTile(
|
|
||||||
icon: Icons.domain_rounded,
|
|
||||||
title: AppLocalizations.of(context)!.domain,
|
|
||||||
subtitle: log.question.name
|
|
||||||
),
|
|
||||||
LogListTile(
|
|
||||||
icon: Icons.category_rounded,
|
|
||||||
title: AppLocalizations.of(context)!.type,
|
|
||||||
subtitle: log.question.type
|
|
||||||
),
|
|
||||||
LogListTile(
|
|
||||||
icon: Icons.class_rounded,
|
|
||||||
title: AppLocalizations.of(context)!.clas,
|
|
||||||
subtitle: log.question.questionClass
|
|
||||||
),
|
|
||||||
SectionLabel(label: AppLocalizations.of(context)!.response),
|
|
||||||
if (log.upstream != null && log.upstream != '') LogListTile(
|
|
||||||
icon: Icons.dns_rounded,
|
|
||||||
title: AppLocalizations.of(context)!.dnsServer,
|
|
||||||
subtitle: log.upstream
|
|
||||||
),
|
|
||||||
LogListTile(
|
|
||||||
icon: Icons.timer_rounded,
|
|
||||||
title: AppLocalizations.of(context)!.elapsedTime,
|
|
||||||
subtitle: "${double.parse(log.elapsedMs).toStringAsFixed(2)} ms"
|
|
||||||
),
|
|
||||||
if (log.status != null) LogListTile(
|
|
||||||
icon: Icons.system_update_alt_rounded,
|
|
||||||
title: AppLocalizations.of(context)!.responseCode,
|
|
||||||
subtitle: log.status
|
|
||||||
),
|
|
||||||
SectionLabel(label: AppLocalizations.of(context)!.client),
|
|
||||||
LogListTile(
|
|
||||||
icon: Icons.smartphone_rounded,
|
|
||||||
title: AppLocalizations.of(context)!.deviceIp,
|
|
||||||
subtitle: log.client
|
|
||||||
),
|
|
||||||
if (log.clientInfo != null && log.clientInfo!.name != '') LogListTile(
|
|
||||||
icon: Icons.abc_rounded,
|
|
||||||
title: AppLocalizations.of(context)!.deviceName,
|
|
||||||
subtitle: log.clientInfo!.name
|
|
||||||
),
|
|
||||||
if (log.rules.isNotEmpty) ...[
|
|
||||||
SectionLabel(label: AppLocalizations.of(context)!.rules),
|
|
||||||
...log.rules.map((rule) {
|
|
||||||
final Filter? list = getList(rule.filterListId);
|
|
||||||
if (list != null) {
|
|
||||||
return LogListTile(
|
|
||||||
icon: Icons.rule_rounded,
|
|
||||||
title: rule.text,
|
|
||||||
subtitle: list.name
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return const SizedBox();
|
|
||||||
}
|
|
||||||
}).toList()
|
|
||||||
],
|
|
||||||
if (log.answer.isNotEmpty) ...[
|
|
||||||
SectionLabel(label: AppLocalizations.of(context)!.answers),
|
|
||||||
...log.answer.map((a) => LogListTile(
|
|
||||||
icon: Icons.download_rounded,
|
|
||||||
title: a.value,
|
|
||||||
subtitle: "TTL: ${a.ttl.toString()}",
|
|
||||||
trailing: Container(
|
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: 10,
|
horizontal: 10,
|
||||||
vertical: 5
|
vertical: 5
|
||||||
|
@ -196,7 +100,7 @@ class LogDetailsScreen extends StatelessWidget {
|
||||||
borderRadius: BorderRadius.circular(30)
|
borderRadius: BorderRadius.circular(30)
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
a.type,
|
"CACHE",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color: Theme.of(context).floatingActionButtonTheme.foregroundColor,
|
color: Theme.of(context).floatingActionButtonTheme.foregroundColor,
|
||||||
|
@ -204,10 +108,104 @@ class LogDetailsScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
)).toList()
|
: null,
|
||||||
]
|
),
|
||||||
|
if (log.rule != null) LogListTile(
|
||||||
|
icon: Icons.block,
|
||||||
|
title: AppLocalizations.of(context)!.blockingRule,
|
||||||
|
subtitle: log.rule
|
||||||
|
),
|
||||||
|
LogListTile(
|
||||||
|
icon: Icons.schedule,
|
||||||
|
title: AppLocalizations.of(context)!.time,
|
||||||
|
subtitle: convertTimestampLocalTimezone(log.time, 'HH:mm:ss')
|
||||||
|
),
|
||||||
|
SectionLabel(label: AppLocalizations.of(context)!.request),
|
||||||
|
LogListTile(
|
||||||
|
icon: Icons.domain_rounded,
|
||||||
|
title: AppLocalizations.of(context)!.domain,
|
||||||
|
subtitle: log.question.name
|
||||||
|
),
|
||||||
|
LogListTile(
|
||||||
|
icon: Icons.category_rounded,
|
||||||
|
title: AppLocalizations.of(context)!.type,
|
||||||
|
subtitle: log.question.type
|
||||||
|
),
|
||||||
|
LogListTile(
|
||||||
|
icon: Icons.class_rounded,
|
||||||
|
title: AppLocalizations.of(context)!.clas,
|
||||||
|
subtitle: log.question.questionClass
|
||||||
|
),
|
||||||
|
SectionLabel(label: AppLocalizations.of(context)!.response),
|
||||||
|
if (log.upstream != null && log.upstream != '') LogListTile(
|
||||||
|
icon: Icons.dns_rounded,
|
||||||
|
title: AppLocalizations.of(context)!.dnsServer,
|
||||||
|
subtitle: log.upstream
|
||||||
|
),
|
||||||
|
LogListTile(
|
||||||
|
icon: Icons.timer_rounded,
|
||||||
|
title: AppLocalizations.of(context)!.elapsedTime,
|
||||||
|
subtitle: "${double.parse(log.elapsedMs).toStringAsFixed(2)} ms"
|
||||||
|
),
|
||||||
|
if (log.status != null) LogListTile(
|
||||||
|
icon: Icons.system_update_alt_rounded,
|
||||||
|
title: AppLocalizations.of(context)!.responseCode,
|
||||||
|
subtitle: log.status
|
||||||
|
),
|
||||||
|
SectionLabel(label: AppLocalizations.of(context)!.client),
|
||||||
|
LogListTile(
|
||||||
|
icon: Icons.smartphone_rounded,
|
||||||
|
title: AppLocalizations.of(context)!.deviceIp,
|
||||||
|
subtitle: log.client
|
||||||
|
),
|
||||||
|
if (log.clientInfo != null && log.clientInfo!.name != '') LogListTile(
|
||||||
|
icon: Icons.abc_rounded,
|
||||||
|
title: AppLocalizations.of(context)!.deviceName,
|
||||||
|
subtitle: log.clientInfo!.name
|
||||||
|
),
|
||||||
|
if (log.rules.isNotEmpty) ...[
|
||||||
|
SectionLabel(label: AppLocalizations.of(context)!.rules),
|
||||||
|
...log.rules.map((rule) {
|
||||||
|
final Filter? list = getList(rule.filterListId);
|
||||||
|
if (list != null) {
|
||||||
|
return LogListTile(
|
||||||
|
icon: Icons.rule_rounded,
|
||||||
|
title: rule.text,
|
||||||
|
subtitle: list.name
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return const SizedBox();
|
||||||
|
}
|
||||||
|
}).toList()
|
||||||
],
|
],
|
||||||
);
|
if (log.answer.isNotEmpty) ...[
|
||||||
|
SectionLabel(label: AppLocalizations.of(context)!.answers),
|
||||||
|
...log.answer.map((a) => LogListTile(
|
||||||
|
icon: Icons.download_rounded,
|
||||||
|
title: a.value,
|
||||||
|
subtitle: "TTL: ${a.ttl.toString()}",
|
||||||
|
trailing: Container(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 10,
|
||||||
|
vertical: 5
|
||||||
|
),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context).floatingActionButtonTheme.backgroundColor,
|
||||||
|
borderRadius: BorderRadius.circular(30)
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
a.type,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
color: Theme.of(context).floatingActionButtonTheme.foregroundColor,
|
||||||
|
fontWeight: FontWeight.w500
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
)).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,35 +279,60 @@ class LogDetailsScreen extends StatelessWidget {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
body: NestedScrollView(
|
||||||
centerTitle: false,
|
headerSliverBuilder: (context, innerBoxIsScrolled) => [
|
||||||
title: Text(AppLocalizations.of(context)!.logDetails),
|
SliverOverlapAbsorber(
|
||||||
actions: [
|
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
||||||
IconButton(
|
sliver: SliverAppBar.large(
|
||||||
onPressed: () => openUrl("${Urls.googleSearchUrl}?q=${log.question.name}"),
|
pinned: true,
|
||||||
icon: const Icon(Icons.travel_explore_rounded),
|
floating: true,
|
||||||
tooltip: AppLocalizations.of(context)!.searchDomainInternet
|
centerTitle: false,
|
||||||
),
|
forceElevated: innerBoxIsScrolled,
|
||||||
if (statusProvider.filteringStatus != null) IconButton(
|
title: Text(AppLocalizations.of(context)!.logDetails),
|
||||||
onPressed: log.question.name != null
|
actions: [
|
||||||
? () => blockUnblock(
|
IconButton(
|
||||||
log.question.name!,
|
onPressed: () => openUrl("${Urls.googleSearchUrl}?q=${log.question.name}"),
|
||||||
getFilteredStatus(context, appConfigProvider, log.reason, true)['filtered'] == true ? 'unblock' : 'block'
|
icon: const Icon(Icons.travel_explore_rounded),
|
||||||
)
|
tooltip: AppLocalizations.of(context)!.searchDomainInternet
|
||||||
: null,
|
),
|
||||||
icon: Icon(
|
if (statusProvider.filteringStatus != null) IconButton(
|
||||||
getFilteredStatus(context, appConfigProvider, log.reason, true)['filtered'] == true
|
onPressed: log.question.name != null
|
||||||
? Icons.check_circle_rounded
|
? () => blockUnblock(
|
||||||
: Icons.block
|
log.question.name!,
|
||||||
|
getFilteredStatus(context, appConfigProvider, log.reason, true)['filtered'] == true ? 'unblock' : 'block'
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
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)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
tooltip: getFilteredStatus(context, appConfigProvider, log.reason, true)['filtered'] == true
|
)
|
||||||
? AppLocalizations.of(context)!.unblockDomain
|
|
||||||
: AppLocalizations.of(context)!.blockDomain,
|
|
||||||
),
|
|
||||||
const SizedBox(width: 10)
|
|
||||||
],
|
],
|
||||||
|
body: SafeArea(
|
||||||
|
top: false,
|
||||||
|
bottom: false,
|
||||||
|
child: Builder(
|
||||||
|
builder: (context) => CustomScrollView(
|
||||||
|
slivers: [
|
||||||
|
SliverOverlapInjector(
|
||||||
|
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
||||||
|
),
|
||||||
|
SliverList.list(
|
||||||
|
children: content()
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
)
|
||||||
),
|
),
|
||||||
body: content(),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,123 +192,158 @@ 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(
|
||||||
width: double.maxFinite,
|
top: false,
|
||||||
child: Column(
|
bottom: false,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
child: Builder(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
builder: (context) => CustomScrollView(
|
||||||
children: [
|
slivers: [
|
||||||
const CircularProgressIndicator(),
|
SliverOverlapInjector(
|
||||||
const SizedBox(height: 30),
|
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
||||||
Text(
|
|
||||||
AppLocalizations.of(context)!.loadingLogs,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 22,
|
|
||||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
|
||||||
),
|
),
|
||||||
)
|
SliverFillRemaining(
|
||||||
],
|
child: SizedBox(
|
||||||
),
|
width: double.maxFinite,
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
const CircularProgressIndicator(),
|
||||||
|
const SizedBox(height: 30),
|
||||||
|
Text(
|
||||||
|
AppLocalizations.of(context)!.loadingLogs,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 22,
|
||||||
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
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
|
|
||||||
: logsProvider.logsData!.data.length,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
if (logsProvider.isLoadingMore == true && index == logsProvider.logsData!.data.length) {
|
|
||||||
return const Padding(
|
|
||||||
padding: EdgeInsets.symmetric(vertical: 20),
|
|
||||||
child: Center(
|
|
||||||
child: CircularProgressIndicator(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else if (logsProvider.logsData!.data[index].question.name != null) {
|
|
||||||
return LogTile(
|
|
||||||
log: logsProvider.logsData!.data[index],
|
|
||||||
index: index,
|
|
||||||
length: logsProvider.logsData!.data.length,
|
|
||||||
isLogSelected: selectedLog != null && selectedLog == logsProvider.logsData!.data[index],
|
|
||||||
onLogTap: (log) {
|
|
||||||
if (width <= 1100) {
|
|
||||||
Navigator.push(context, MaterialPageRoute(
|
|
||||||
builder: (context) => LogDetailsScreen(
|
|
||||||
log: log,
|
|
||||||
dialog: false,
|
|
||||||
)
|
|
||||||
));
|
|
||||||
}
|
|
||||||
setState(() => selectedLog = log);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
: Center(
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
AppLocalizations.of(context)!.noLogsDisplay,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 24,
|
|
||||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (logsProvider.logsOlderThan != null) Padding(
|
|
||||||
padding: const EdgeInsets.only(
|
|
||||||
top: 30,
|
|
||||||
left: 20,
|
|
||||||
right: 20
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
AppLocalizations.of(context)!.noLogsThatOld,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
),
|
),
|
||||||
)
|
if (logsProvider.logsData!.data.isNotEmpty) SliverList.builder(
|
||||||
|
itemCount: logsProvider.logsData!.data.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
if (logsProvider.isLoadingMore == true && index == logsProvider.logsData!.data.length) {
|
||||||
|
return const Padding(
|
||||||
|
padding: EdgeInsets.symmetric(vertical: 20),
|
||||||
|
child: Center(
|
||||||
|
child: CircularProgressIndicator(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else if (logsProvider.logsData!.data[index].question.name != null) {
|
||||||
|
return LogTile(
|
||||||
|
log: logsProvider.logsData!.data[index],
|
||||||
|
index: index,
|
||||||
|
length: logsProvider.logsData!.data.length,
|
||||||
|
isLogSelected: selectedLog != null && selectedLog == logsProvider.logsData!.data[index],
|
||||||
|
onLogTap: (log) {
|
||||||
|
if (width <= 1100) {
|
||||||
|
Navigator.push(context, MaterialPageRoute(
|
||||||
|
builder: (context) => LogDetailsScreen(
|
||||||
|
log: log,
|
||||||
|
dialog: false,
|
||||||
|
)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
setState(() => selectedLog = log);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
),
|
||||||
|
if (logsProvider.logsData!.data.isEmpty) SliverFillRemaining(
|
||||||
|
child: Center(
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
AppLocalizations.of(context)!.noLogsDisplay,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 24,
|
||||||
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (logsProvider.logsOlderThan != null) Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
top: 30,
|
||||||
|
left: 20,
|
||||||
|
right: 20
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
AppLocalizations.of(context)!.noLogsThatOld,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
case LoadStatus.error:
|
case LoadStatus.error:
|
||||||
return SizedBox(
|
return SafeArea(
|
||||||
width: double.maxFinite,
|
top: false,
|
||||||
child: Column(
|
bottom: false,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
child: Builder(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
builder: (context) => CustomScrollView(
|
||||||
children: [
|
slivers: [
|
||||||
const Icon(
|
SliverOverlapInjector(
|
||||||
Icons.error,
|
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
||||||
color: Colors.red,
|
|
||||||
size: 50,
|
|
||||||
),
|
|
||||||
const SizedBox(height: 30),
|
|
||||||
Text(
|
|
||||||
AppLocalizations.of(context)!.logsNotLoaded,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 22,
|
|
||||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
|
||||||
),
|
),
|
||||||
)
|
SliverFillRemaining(
|
||||||
],
|
child: SizedBox(
|
||||||
),
|
width: double.maxFinite,
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
const Icon(
|
||||||
|
Icons.error,
|
||||||
|
color: Colors.red,
|
||||||
|
size: 50,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 30),
|
||||||
|
Text(
|
||||||
|
AppLocalizations.of(context)!.logsNotLoaded,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 22,
|
||||||
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -318,183 +353,195 @@ 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) => [
|
||||||
centerTitle: false,
|
SliverOverlapAbsorber(
|
||||||
actions: [
|
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
||||||
if (!(Platform.isAndroid || Platform.isIOS)) IconButton(
|
sliver: SliverAppBar.large(
|
||||||
onPressed: () => logsProvider.fetchLogs(inOffset: 0),
|
pinned: true,
|
||||||
icon: const Icon(Icons.refresh_rounded),
|
floating: true,
|
||||||
tooltip: AppLocalizations.of(context)!.refresh,
|
centerTitle: false,
|
||||||
),
|
forceElevated: innerBoxIsScrolled,
|
||||||
logsProvider.loadStatus == LoadStatus.loaded
|
title: Text(AppLocalizations.of(context)!.logs),
|
||||||
? IconButton(
|
expandedHeight: logsProvider.appliedFilters.searchText != null || logsProvider.appliedFilters.selectedResultStatus != 'all' || logsProvider.appliedFilters.clients != null
|
||||||
onPressed: openFilersModal,
|
? 170 : null,
|
||||||
icon: const Icon(Icons.filter_list_rounded),
|
actions: [
|
||||||
tooltip: AppLocalizations.of(context)!.filters,
|
if (!(Platform.isAndroid || Platform.isIOS)) IconButton(
|
||||||
)
|
onPressed: () => logsProvider.fetchLogs(inOffset: 0),
|
||||||
: const SizedBox(),
|
icon: const Icon(Icons.refresh_rounded),
|
||||||
if (statusProvider.serverStatus != null) IconButton(
|
tooltip: AppLocalizations.of(context)!.refresh,
|
||||||
tooltip: AppLocalizations.of(context)!.settings,
|
),
|
||||||
onPressed: () => {
|
logsProvider.loadStatus == LoadStatus.loaded
|
||||||
if (width > 700 || !(Platform.isAndroid || Platform.isIOS)) {
|
? IconButton(
|
||||||
showDialog(
|
onPressed: openFilersModal,
|
||||||
context: context,
|
icon: const Icon(Icons.filter_list_rounded),
|
||||||
builder: (context) => LogsConfigModal(
|
tooltip: AppLocalizations.of(context)!.filters,
|
||||||
onConfirm: updateConfig,
|
)
|
||||||
onClear: clearQueries,
|
: const SizedBox(),
|
||||||
dialog: true,
|
if (statusProvider.serverStatus != null) IconButton(
|
||||||
serverVersion: statusProvider.serverStatus!.serverVersion,
|
tooltip: AppLocalizations.of(context)!.settings,
|
||||||
),
|
onPressed: () => {
|
||||||
barrierDismissible: false
|
if (width > 700 || !(Platform.isAndroid || Platform.isIOS)) {
|
||||||
)
|
showDialog(
|
||||||
}
|
context: context,
|
||||||
else {
|
builder: (context) => LogsConfigModal(
|
||||||
showModalBottomSheet(
|
onConfirm: updateConfig,
|
||||||
context: context,
|
onClear: clearQueries,
|
||||||
builder: (context) => LogsConfigModal(
|
dialog: true,
|
||||||
onConfirm: updateConfig,
|
serverVersion: statusProvider.serverStatus!.serverVersion,
|
||||||
onClear: clearQueries,
|
),
|
||||||
dialog: false,
|
barrierDismissible: false
|
||||||
serverVersion: statusProvider.serverStatus!.serverVersion,
|
)
|
||||||
),
|
}
|
||||||
backgroundColor: Colors.transparent,
|
else {
|
||||||
isScrollControlled: true
|
showModalBottomSheet(
|
||||||
)
|
context: context,
|
||||||
}
|
builder: (context) => LogsConfigModal(
|
||||||
},
|
onConfirm: updateConfig,
|
||||||
icon: const Icon(Icons.settings)
|
onClear: clearQueries,
|
||||||
),
|
dialog: false,
|
||||||
const SizedBox(width: 5),
|
serverVersion: statusProvider.serverStatus!.serverVersion,
|
||||||
],
|
),
|
||||||
bottom: logsProvider.appliedFilters.searchText != null || logsProvider.appliedFilters.selectedResultStatus != 'all' || logsProvider.appliedFilters.clients != null
|
backgroundColor: Colors.transparent,
|
||||||
? PreferredSize(
|
isScrollControlled: true
|
||||||
preferredSize: const Size(double.maxFinite, 50),
|
)
|
||||||
child: Container(
|
}
|
||||||
height: 50,
|
},
|
||||||
width: double.maxFinite,
|
icon: const Icon(Icons.settings)
|
||||||
padding: const EdgeInsets.only(bottom: 10),
|
),
|
||||||
decoration: BoxDecoration(
|
const SizedBox(width: 5),
|
||||||
border: Border(
|
],
|
||||||
bottom: BorderSide(
|
bottom: logsProvider.appliedFilters.searchText != null || logsProvider.appliedFilters.selectedResultStatus != 'all' || logsProvider.appliedFilters.clients != null
|
||||||
color: showDivider == true
|
? PreferredSize(
|
||||||
? Theme.of(context).colorScheme.onSurface.withOpacity(0.1)
|
preferredSize: const Size(double.maxFinite, 70),
|
||||||
: Colors.transparent,
|
child: Container(
|
||||||
|
height: 50,
|
||||||
|
width: double.maxFinite,
|
||||||
|
padding: const EdgeInsets.only(bottom: 10),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border(
|
||||||
|
bottom: BorderSide(
|
||||||
|
color: showDivider == true
|
||||||
|
? Theme.of(context).colorScheme.onSurface.withOpacity(0.1)
|
||||||
|
: Colors.transparent,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
child: ListView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
children: [
|
||||||
|
if (logsProvider.appliedFilters.searchText != null) ...[
|
||||||
|
const SizedBox(width: 15),
|
||||||
|
Chip(
|
||||||
|
avatar: const Icon(
|
||||||
|
Icons.search_rounded,
|
||||||
|
),
|
||||||
|
label: Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
logsProvider.appliedFilters.searchText!,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
deleteIcon: const Icon(
|
||||||
|
Icons.clear,
|
||||||
|
size: 18,
|
||||||
|
),
|
||||||
|
onDeleted: () {
|
||||||
|
logsProvider.setAppliedFilters(
|
||||||
|
AppliedFiters(
|
||||||
|
selectedResultStatus: logsProvider.appliedFilters.selectedResultStatus,
|
||||||
|
searchText: null,
|
||||||
|
clients: logsProvider.appliedFilters.clients
|
||||||
|
)
|
||||||
|
);
|
||||||
|
logsProvider.setSearchText(null);
|
||||||
|
logsProvider.fetchLogs(
|
||||||
|
inOffset: 0,
|
||||||
|
searchText: ''
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
if (logsProvider.appliedFilters.selectedResultStatus != 'all') ...[
|
||||||
|
const SizedBox(width: 15),
|
||||||
|
Chip(
|
||||||
|
avatar: const Icon(
|
||||||
|
Icons.shield_rounded,
|
||||||
|
),
|
||||||
|
label: Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
translatedString[logsProvider.appliedFilters.selectedResultStatus]!,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
deleteIcon: const Icon(
|
||||||
|
Icons.clear,
|
||||||
|
size: 18,
|
||||||
|
),
|
||||||
|
onDeleted: () {
|
||||||
|
logsProvider.setAppliedFilters(
|
||||||
|
AppliedFiters(
|
||||||
|
selectedResultStatus: 'all',
|
||||||
|
searchText: logsProvider.appliedFilters.searchText,
|
||||||
|
clients: logsProvider.appliedFilters.clients
|
||||||
|
)
|
||||||
|
);
|
||||||
|
logsProvider.setSelectedResultStatus('all');
|
||||||
|
logsProvider.fetchLogs(
|
||||||
|
inOffset: 0,
|
||||||
|
responseStatus: 'all'
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
if (logsProvider.appliedFilters.clients != null) ...[
|
||||||
|
const SizedBox(width: 15),
|
||||||
|
Chip(
|
||||||
|
avatar: const Icon(
|
||||||
|
Icons.smartphone_rounded,
|
||||||
|
),
|
||||||
|
label: Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
logsProvider.appliedFilters.clients!.length == 1
|
||||||
|
? logsProvider.appliedFilters.clients![0]
|
||||||
|
: "${logsProvider.appliedFilters.clients!.length} ${AppLocalizations.of(context)!.clients}",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
deleteIcon: const Icon(
|
||||||
|
Icons.clear,
|
||||||
|
size: 18,
|
||||||
|
),
|
||||||
|
onDeleted: () {
|
||||||
|
logsProvider.setAppliedFilters(
|
||||||
|
AppliedFiters(
|
||||||
|
selectedResultStatus: logsProvider.appliedFilters.selectedResultStatus,
|
||||||
|
searchText: logsProvider.appliedFilters.searchText,
|
||||||
|
clients: null
|
||||||
|
)
|
||||||
|
);
|
||||||
|
logsProvider.setSelectedClients(null);
|
||||||
|
logsProvider.fetchLogs(
|
||||||
|
inOffset: 0,
|
||||||
|
responseStatus: logsProvider.appliedFilters.selectedResultStatus
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
const SizedBox(width: 15),
|
||||||
|
],
|
||||||
|
),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
: null,
|
||||||
child: ListView(
|
),
|
||||||
scrollDirection: Axis.horizontal,
|
)
|
||||||
children: [
|
],
|
||||||
if (logsProvider.appliedFilters.searchText != null) ...[
|
body: generateBody()
|
||||||
const SizedBox(width: 15),
|
|
||||||
Chip(
|
|
||||||
avatar: const Icon(
|
|
||||||
Icons.search_rounded,
|
|
||||||
),
|
|
||||||
label: Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
logsProvider.appliedFilters.searchText!,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
deleteIcon: const Icon(
|
|
||||||
Icons.clear,
|
|
||||||
size: 18,
|
|
||||||
),
|
|
||||||
onDeleted: () {
|
|
||||||
logsProvider.setAppliedFilters(
|
|
||||||
AppliedFiters(
|
|
||||||
selectedResultStatus: logsProvider.appliedFilters.selectedResultStatus,
|
|
||||||
searchText: null,
|
|
||||||
clients: logsProvider.appliedFilters.clients
|
|
||||||
)
|
|
||||||
);
|
|
||||||
logsProvider.setSearchText(null);
|
|
||||||
logsProvider.fetchLogs(
|
|
||||||
inOffset: 0,
|
|
||||||
searchText: ''
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
if (logsProvider.appliedFilters.selectedResultStatus != 'all') ...[
|
|
||||||
const SizedBox(width: 15),
|
|
||||||
Chip(
|
|
||||||
avatar: const Icon(
|
|
||||||
Icons.shield_rounded,
|
|
||||||
),
|
|
||||||
label: Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
translatedString[logsProvider.appliedFilters.selectedResultStatus]!,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
deleteIcon: const Icon(
|
|
||||||
Icons.clear,
|
|
||||||
size: 18,
|
|
||||||
),
|
|
||||||
onDeleted: () {
|
|
||||||
logsProvider.setAppliedFilters(
|
|
||||||
AppliedFiters(
|
|
||||||
selectedResultStatus: 'all',
|
|
||||||
searchText: logsProvider.appliedFilters.searchText,
|
|
||||||
clients: logsProvider.appliedFilters.clients
|
|
||||||
)
|
|
||||||
);
|
|
||||||
logsProvider.setSelectedResultStatus('all');
|
|
||||||
logsProvider.fetchLogs(
|
|
||||||
inOffset: 0,
|
|
||||||
responseStatus: 'all'
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
if (logsProvider.appliedFilters.clients != null) ...[
|
|
||||||
const SizedBox(width: 15),
|
|
||||||
Chip(
|
|
||||||
avatar: const Icon(
|
|
||||||
Icons.smartphone_rounded,
|
|
||||||
),
|
|
||||||
label: Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
logsProvider.appliedFilters.clients!.length == 1
|
|
||||||
? logsProvider.appliedFilters.clients![0]
|
|
||||||
: "${logsProvider.appliedFilters.clients!.length} ${AppLocalizations.of(context)!.clients}",
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
deleteIcon: const Icon(
|
|
||||||
Icons.clear,
|
|
||||||
size: 18,
|
|
||||||
),
|
|
||||||
onDeleted: () {
|
|
||||||
logsProvider.setAppliedFilters(
|
|
||||||
AppliedFiters(
|
|
||||||
selectedResultStatus: logsProvider.appliedFilters.selectedResultStatus,
|
|
||||||
searchText: logsProvider.appliedFilters.searchText,
|
|
||||||
clients: null
|
|
||||||
)
|
|
||||||
);
|
|
||||||
logsProvider.setSelectedClients(null);
|
|
||||||
logsProvider.fetchLogs(
|
|
||||||
inOffset: 0,
|
|
||||||
responseStatus: logsProvider.appliedFilters.selectedResultStatus
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
const SizedBox(width: 15),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
: null,
|
|
||||||
),
|
),
|
||||||
body: generateBody()
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue