mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-11 10:08:02 -06:00
Removed unused files, code cleanup
This commit is contained in:
@@ -17,17 +17,18 @@ import 'package:paperless_mobile/core/repository/state/impl/document_type_reposi
|
||||
import 'package:paperless_mobile/core/repository/state/impl/tag_repository_state.dart';
|
||||
import 'package:paperless_mobile/core/service/file_service.dart';
|
||||
import 'package:paperless_mobile/core/store/local_vault.dart';
|
||||
import 'package:paperless_mobile/core/widgets/hint_card.dart';
|
||||
import 'package:paperless_mobile/core/widgets/offline_banner.dart';
|
||||
import 'package:paperless_mobile/features/document_upload/cubit/document_upload_cubit.dart';
|
||||
import 'package:paperless_mobile/features/document_upload/view/document_upload_preparation_page.dart';
|
||||
import 'package:paperless_mobile/features/documents/view/pages/document_view.dart';
|
||||
import 'package:paperless_mobile/features/home/view/widget/app_drawer.dart';
|
||||
import 'package:paperless_mobile/features/scan/bloc/document_scanner_cubit.dart';
|
||||
import 'package:paperless_mobile/features/scan/view/widgets/grid_image_item_widget.dart';
|
||||
import 'package:paperless_mobile/features/scan/view/widgets/scanned_image_item.dart';
|
||||
import 'package:paperless_mobile/features/tasks/cubit/task_status_cubit.dart';
|
||||
import 'package:paperless_mobile/generated/l10n.dart';
|
||||
import 'package:paperless_mobile/util.dart';
|
||||
import 'package:paperless_mobile/helpers/file_helpers.dart';
|
||||
import 'package:paperless_mobile/helpers/message_helpers.dart';
|
||||
import 'package:paperless_mobile/helpers/permission_helpers.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:pdf/pdf.dart';
|
||||
import 'package:pdf/widgets.dart' as pw;
|
||||
@@ -218,7 +219,7 @@ class _ScannerPageState extends State<ScannerPage>
|
||||
mainAxisSpacing: 10,
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
return GridImageItemWidget(
|
||||
return ScannedImageItem(
|
||||
file: scans[index],
|
||||
onDelete: () async {
|
||||
try {
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'package:photo_view/photo_view.dart';
|
||||
typedef DeleteCallback = void Function();
|
||||
typedef OnImageOperation = void Function(File);
|
||||
|
||||
class GridImageItemWidget extends StatefulWidget {
|
||||
class ScannedImageItem extends StatefulWidget {
|
||||
final File file;
|
||||
final DeleteCallback onDelete;
|
||||
//final OnImageOperation onImageOperation;
|
||||
@@ -15,7 +15,7 @@ class GridImageItemWidget extends StatefulWidget {
|
||||
final int index;
|
||||
final int totalNumberOfFiles;
|
||||
|
||||
const GridImageItemWidget({
|
||||
const ScannedImageItem({
|
||||
Key? key,
|
||||
required this.file,
|
||||
required this.onDelete,
|
||||
@@ -25,10 +25,10 @@ class GridImageItemWidget extends StatefulWidget {
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<GridImageItemWidget> createState() => _GridImageItemWidgetState();
|
||||
State<ScannedImageItem> createState() => _ScannedImageItemState();
|
||||
}
|
||||
|
||||
class _GridImageItemWidgetState extends State<GridImageItemWidget> {
|
||||
class _ScannedImageItemState extends State<ScannedImageItem> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
@@ -1,42 +0,0 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:paperless_mobile/util.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
typedef OnImageScannedCallback = void Function(File);
|
||||
|
||||
class ScannerWidget extends StatefulWidget {
|
||||
final OnImageScannedCallback onImageScannedCallback;
|
||||
const ScannerWidget({
|
||||
Key? key,
|
||||
required this.onImageScannedCallback,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_ScannerWidgetState createState() => _ScannerWidgetState();
|
||||
}
|
||||
|
||||
class _ScannerWidgetState extends State<ScannerWidget> {
|
||||
List<File> documents = List.empty(growable: true);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text("Scan document")),
|
||||
body: FutureBuilder<bool>(
|
||||
future: askForPermission(Permission.camera),
|
||||
builder: (BuildContext context, AsyncSnapshot<bool> snapshot) {
|
||||
if (!snapshot.hasData) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
if (snapshot.data!) {
|
||||
return Container();
|
||||
}
|
||||
return const Center(
|
||||
child: Text("No camera permissions, please enable in settings!"),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class UploadDialog extends StatefulWidget {
|
||||
const UploadDialog({
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<UploadDialog> createState() => _UploadDialogState();
|
||||
}
|
||||
|
||||
class _UploadDialogState extends State<UploadDialog> {
|
||||
late TextEditingController _controller;
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
final DateFormat format = DateFormat("yyyy_MM_dd_hh_mm_ss");
|
||||
final today = format.format(DateTime.now());
|
||||
_controller = TextEditingController.fromValue(
|
||||
TextEditingValue(text: "Scan_$today.pdf"));
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: const Text("Upload to paperless-ng"),
|
||||
content: Form(
|
||||
key: _formKey,
|
||||
child: TextFormField(
|
||||
controller: _controller,
|
||||
validator: (text) {
|
||||
if (text == null || text.isEmpty) {
|
||||
return "Filename must be specified!";
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: const Text("Cancel"),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
if (!_formKey.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
var txt = _controller.text;
|
||||
if (!txt.endsWith(".pdf")) {
|
||||
txt += ".pdf";
|
||||
}
|
||||
Navigator.of(context).pop(txt);
|
||||
},
|
||||
child: const Text("Upload"),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user