mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-10 16:07:58 -06:00
Changed file directories, added clear storage setting, updated readme w/ Google Play reference
This commit is contained in:
21
lib/features/settings/view/pages/storage_settings_page.dart
Normal file
21
lib/features/settings/view/pages/storage_settings_page.dart
Normal file
@@ -0,0 +1,21 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:paperless_mobile/features/settings/view/widgets/clear_storage_setting.dart';
|
||||
import 'package:paperless_mobile/generated/l10n.dart';
|
||||
|
||||
class StorageSettingsPage extends StatelessWidget {
|
||||
const StorageSettingsPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(S.of(context).settingsPageStorageSettingsLabel),
|
||||
),
|
||||
body: ListView(
|
||||
children: const [
|
||||
ClearStorageSetting(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -3,16 +3,12 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:paperless_mobile/features/settings/bloc/application_settings_cubit.dart';
|
||||
import 'package:paperless_mobile/features/settings/view/pages/application_settings_page.dart';
|
||||
import 'package:paperless_mobile/features/settings/view/pages/security_settings_page.dart';
|
||||
import 'package:paperless_mobile/features/settings/view/pages/storage_settings_page.dart';
|
||||
import 'package:paperless_mobile/generated/l10n.dart';
|
||||
|
||||
class SettingsPage extends StatefulWidget {
|
||||
class SettingsPage extends StatelessWidget {
|
||||
const SettingsPage({super.key});
|
||||
|
||||
@override
|
||||
State<SettingsPage> createState() => _SettingsPageState();
|
||||
}
|
||||
|
||||
class _SettingsPageState extends State<SettingsPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -25,20 +21,26 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
title: Text(S.of(context).settingsPageApplicationSettingsLabel),
|
||||
subtitle: Text(
|
||||
S.of(context).settingsPageApplicationSettingsDescriptionText),
|
||||
onTap: () => _goto(const ApplicationSettingsPage()),
|
||||
onTap: () => _goto(const ApplicationSettingsPage(), context),
|
||||
),
|
||||
ListTile(
|
||||
title: Text(S.of(context).settingsPageSecuritySettingsLabel),
|
||||
subtitle:
|
||||
Text(S.of(context).settingsPageSecuritySettingsDescriptionText),
|
||||
onTap: () => _goto(const SecuritySettingsPage()),
|
||||
onTap: () => _goto(const SecuritySettingsPage(), context),
|
||||
),
|
||||
ListTile(
|
||||
title: Text(S.of(context).settingsPageStorageSettingsLabel),
|
||||
subtitle:
|
||||
Text(S.of(context).settingsPageStorageSettingsDescriptionText),
|
||||
onTap: () => _goto(const StorageSettingsPage(), context),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _goto(Widget page) {
|
||||
void _goto(Widget page, BuildContext context) {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_cache_manager/flutter_cache_manager.dart' as cm;
|
||||
import 'package:paperless_mobile/core/service/file_service.dart';
|
||||
import 'package:paperless_mobile/di_initializer.dart';
|
||||
|
||||
class ClearStorageSetting extends StatelessWidget {
|
||||
const ClearStorageSetting({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListTile(
|
||||
title: Text("Clear data"),
|
||||
subtitle:
|
||||
Text("Remove downloaded files, scans and clear the cache's content"),
|
||||
onTap: _clearCache,
|
||||
);
|
||||
}
|
||||
|
||||
void _clearCache() async {
|
||||
getIt<cm.CacheManager>().emptyCache();
|
||||
FileService.clearUserData();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user