show icon cache size

This commit is contained in:
Fabian Freund
2024-06-16 20:40:42 +02:00
parent 42a9db63f7
commit f50391d1da
6 changed files with 80 additions and 14 deletions
@@ -200,19 +200,6 @@ class SettingsScreen extends HookConsumerWidget {
height: 16,
),
_buildSection(theme, 'Bangs'),
ButtonListTile(
title: 'Icon Cache',
subtitle: 'Stored favicons for Bangs',
button: FilledButton.icon(
onPressed: () async {
await ref
.read(bangDataRepositoryProvider.notifier)
.clearIconData();
},
icon: const Icon(Icons.delete),
label: const Text('Clear'),
),
),
ButtonListTile(
title: 'Bang Frequencies',
subtitle: 'Tracked usage for Bang recommendations',
@@ -226,6 +213,45 @@ class SettingsScreen extends HookConsumerWidget {
label: const Text('Clear'),
),
),
Consumer(
builder: (context, ref, child) {
final size = ref.watch(
bangIconCacheSizeMegabytesProvider.select(
(value) => value.valueOrNull,
),
);
return ButtonListTile(
title: 'Icon Cache',
subtitle: 'Stored favicons for Bangs',
content: Padding(
padding: const EdgeInsets.only(top: 8.0),
child: DefaultTextStyle(
style: GoogleFonts.robotoMono(),
child: Table(
children: [
TableRow(
children: [
const Text('Size'),
Text('${size?.toStringAsFixed(2) ?? 0} MB'),
],
),
],
),
),
),
button: FilledButton.icon(
onPressed: () async {
await ref
.read(bangDataRepositoryProvider.notifier)
.clearIconData();
},
icon: const Icon(Icons.delete),
label: const Text('Clear'),
),
);
},
),
Consumer(
builder: (context, ref, child) {
final lastSync = ref.watch(