added initial draft of inbox

This commit is contained in:
Anton Stubenbord
2022-11-22 01:33:50 +01:00
parent a7295fb739
commit 8e7a5dddbf
16 changed files with 243 additions and 27 deletions

View File

@@ -27,6 +27,4 @@ abstract class LabelRepository {
Future<StoragePath> saveStoragePath(StoragePath path);
Future<StoragePath> updateStoragePath(StoragePath path);
Future<int> deleteStoragePath(StoragePath path);
Future<int> getStatistics();
}

View File

@@ -120,15 +120,6 @@ class LabelRepositoryImpl implements LabelRepository {
throw const ErrorMessage(ErrorCode.tagCreateFailed);
}
@override
Future<int> getStatistics() async {
final response = await httpClient.get(Uri.parse('/api/statistics/'));
if (response.statusCode == 200) {
return jsonDecode(utf8.decode(response.bodyBytes))['documents_total'];
}
throw const ErrorMessage(ErrorCode.unknown);
}
@override
Future<int> deleteCorrespondent(Correspondent correspondent) async {
assert(correspondent.id != null);

View File

@@ -10,7 +10,13 @@ import 'package:paperless_mobile/util.dart';
class TagWidget extends StatelessWidget {
final Tag tag;
final void Function()? afterTagTapped;
const TagWidget({super.key, required this.tag, required this.afterTagTapped});
final bool isClickable;
const TagWidget({
super.key,
required this.tag,
required this.afterTagTapped,
this.isClickable = true,
});
@override
Widget build(BuildContext context) {
@@ -43,6 +49,9 @@ class TagWidget extends StatelessWidget {
}
void _addTagToFilter(BuildContext context) {
if (!isClickable) {
return;
}
final cubit = BlocProvider.of<DocumentsCubit>(context);
try {
final tagsQuery = cubit.state.filter.tags is IdsTagsQuery

View File

@@ -35,6 +35,7 @@ class _TagsWidgetState extends State<TagsWidget> {
(id) => TagWidget(
tag: state[id]!,
afterTagTapped: widget.afterTagTapped,
isClickable: widget.isClickable,
),
)
.toList();