mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-10 08:07:59 -06:00
chore+fix+feat: Apply dart fixes after upgrade to flutter 3.10, add permission checks, make most api calls work again
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AnimatedTouchBubblePart extends StatefulWidget {
|
||||
AnimatedTouchBubblePart({
|
||||
const AnimatedTouchBubblePart({super.key,
|
||||
required this.dragging,
|
||||
required this.size,
|
||||
});
|
||||
@@ -35,7 +35,7 @@ class _AnimatedTouchBubblePartState extends State<AnimatedTouchBubblePart>
|
||||
).animate(
|
||||
CurvedAnimation(
|
||||
parent: _controller,
|
||||
curve: Interval(0.5, 1.0),
|
||||
curve: const Interval(0.5, 1.0),
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import 'dart:math';
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:paperless_document_scanner/paperless_document_scanner.dart';
|
||||
import 'package:paperless_document_scanner/types/edge_detection_result.dart';
|
||||
|
||||
import 'edge_painter.dart';
|
||||
|
||||
@@ -47,18 +47,11 @@ class _MagnifierState extends State<Magnifier> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
widget.child,
|
||||
if (widget.visible && widget.position != null) _getMagnifier(context)
|
||||
],
|
||||
children: [widget.child, if (widget.visible) _getMagnifier(context)],
|
||||
);
|
||||
}
|
||||
|
||||
void _calculateMatrix() {
|
||||
if (widget.position == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
setState(() {
|
||||
double newX = widget.position.dx - (_magnifierSize.width / 2 / _scale);
|
||||
double newY = widget.position.dy - (_magnifierSize.height / 2 / _scale);
|
||||
@@ -78,8 +71,7 @@ class _MagnifierState extends State<Magnifier> {
|
||||
child: BackdropFilter(
|
||||
filter: ImageFilter.matrix(_matrix.storage),
|
||||
child: CustomPaint(
|
||||
painter: MagnifierPainter(
|
||||
color: Theme.of(context).colorScheme.secondary),
|
||||
painter: MagnifierPainter(color: Theme.of(context).colorScheme.secondary),
|
||||
size: _magnifierSize,
|
||||
),
|
||||
),
|
||||
@@ -96,6 +88,5 @@ class _MagnifierState extends State<Magnifier> {
|
||||
}
|
||||
|
||||
bool _bubbleCrossesMagnifier() =>
|
||||
widget.position.dx < widget.size.width &&
|
||||
widget.position.dy < widget.size.height;
|
||||
widget.position.dx < widget.size.width && widget.position.dy < widget.size.height;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ class MagnifierPainter extends CustomPainter {
|
||||
..color = color;
|
||||
|
||||
canvas.drawCircle(
|
||||
size.center(Offset(0, 0)), size.longestSide / 2, paintObject);
|
||||
size.center(const Offset(0, 0)), size.longestSide / 2, paintObject);
|
||||
}
|
||||
|
||||
void _drawCrosshair(Canvas canvas, Size size) {
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:camera/camera.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:image/image.dart' as imglib;
|
||||
import 'scan.dart';
|
||||
|
||||
late final List<CameraDescription> cameras;
|
||||
void main() async {
|
||||
@@ -58,8 +56,8 @@ class _EdgeDetectionAppState extends State<EdgeDetectionApp> {
|
||||
final int uvRowStride = image.planes[1].bytesPerRow;
|
||||
final int uvPixelStride = image.planes[1].bytesPerPixel!;
|
||||
|
||||
print("uvRowStride: " + uvRowStride.toString());
|
||||
print("uvPixelStride: " + uvPixelStride.toString());
|
||||
print("uvRowStride: $uvRowStride");
|
||||
print("uvPixelStride: $uvPixelStride");
|
||||
|
||||
// imgLib -> Image package from https://pub.dartlang.org/packages/image
|
||||
var img = imglib.Image(
|
||||
@@ -89,7 +87,7 @@ class _EdgeDetectionAppState extends State<EdgeDetectionApp> {
|
||||
}
|
||||
}
|
||||
|
||||
imglib.PngEncoder pngEncoder = new imglib.PngEncoder(level: 0);
|
||||
imglib.PngEncoder pngEncoder = imglib.PngEncoder(level: 0);
|
||||
final png = pngEncoder.encode(img);
|
||||
return Image.memory(png);
|
||||
}
|
||||
@@ -105,7 +103,7 @@ class _EdgeDetectionAppState extends State<EdgeDetectionApp> {
|
||||
body: Center(
|
||||
child: _image != null
|
||||
? convertYUV420toImageColor(_image!)
|
||||
: Placeholder(),
|
||||
: const Placeholder(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -80,7 +80,7 @@ class _ScanState extends State<Scan> {
|
||||
return Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: FloatingActionButton(
|
||||
child: Icon(Icons.check),
|
||||
child: const Icon(Icons.check),
|
||||
onPressed: () async {
|
||||
if (croppedImagePath == null) {
|
||||
return _processImage(imagePath!, edgeDetectionResult!);
|
||||
@@ -101,8 +101,8 @@ class _ScanState extends State<Scan> {
|
||||
children: [
|
||||
FloatingActionButton(
|
||||
foregroundColor: Colors.white,
|
||||
child: Icon(Icons.camera_alt),
|
||||
onPressed: onTakePictureButtonPressed,
|
||||
child: const Icon(Icons.camera_alt),
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -167,7 +167,7 @@ class _ScanState extends State<Scan> {
|
||||
|
||||
Padding _getBottomBar() {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(bottom: 32),
|
||||
padding: const EdgeInsets.only(bottom: 32),
|
||||
child: Align(alignment: Alignment.bottomCenter, child: _getButtonRow()),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user