Skip to content

Commit b37db71

Browse files
committed
Add release application
1 parent f69dab9 commit b37db71

File tree

3 files changed

+53
-56
lines changed

3 files changed

+53
-56
lines changed

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
### Android ###
66
# Built application files
7-
*.apk
7+
#*.apk
88
*.aar
99
*.ap_
1010
*.aab
@@ -278,8 +278,6 @@ modules.xml
278278
# NDK
279279
obj/
280280

281-
# IntelliJ IDEA
282-
/out/
283281

284282
# User-specific configurations
285283
.idea/caches/

lib/ui/camera_picker.dart

Lines changed: 52 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -64,39 +64,6 @@ class TakePictureScreenState extends State<TakePictureScreen> {
6464
super.dispose();
6565
}
6666

67-
Future<File> fixExifRotation(String imagePath) async {
68-
final originalFile = File(imagePath);
69-
List<int> imageBytes = await originalFile.readAsBytes();
70-
71-
final originalImage = img.decodeImage(imageBytes);
72-
final height = originalImage.height;
73-
final width = originalImage.width;
74-
75-
if (height >= width) {
76-
return originalFile;
77-
}
78-
79-
final exifData = await readExifFromBytes(imageBytes);
80-
img.Image fixedImage;
81-
82-
if (height < width) {
83-
if (exifData['Image Orientation'].printable.contains('Horizontal')) {
84-
fixedImage = img.copyRotate(originalImage, 90);
85-
} else if (exifData['Image Orientation'].printable.contains('180')) {
86-
fixedImage = img.copyRotate(originalImage, -90);
87-
} else if (exifData['Image Orientation'].printable.contains('CCW')) {
88-
fixedImage = img.copyRotate(originalImage, 180);
89-
} else {
90-
fixedImage = img.copyRotate(originalImage, 0);
91-
}
92-
}
93-
94-
final fixedFile =
95-
await originalFile.writeAsBytes(img.encodeJpg(fixedImage));
96-
97-
return fixedFile;
98-
}
99-
10067
@override
10168
Widget build(BuildContext context) {
10269
return Scaffold(
@@ -128,8 +95,6 @@ class TakePictureScreenState extends State<TakePictureScreen> {
12895
// Take an picture with the best resolution
12996
await _controller.takePicture(path);
13097
// await FlutterExifRotation.rotateAndSaveImage(path: path);
131-
await fixExifRotation(path);
132-
13398
Navigator.push(
13499
context,
135100
MaterialPageRoute(
@@ -155,6 +120,7 @@ class DisplayPictureScreenState extends State<DisplayPictureScreen> {
155120
final GlobalKey<ScaffoldState> key2 = GlobalKey<ScaffoldState>();
156121
Color _acceptButtonColor = Colors.green;
157122
Color _declineButtonColor = Colors.red;
123+
double _progress = 0.0;
158124
ProgressDialog pr;
159125

160126
bool _isButtonDisabled;
@@ -167,25 +133,59 @@ class DisplayPictureScreenState extends State<DisplayPictureScreen> {
167133
_isButtonDisabled = false;
168134
}
169135

136+
Future<File> fixExifRotation(String imagePath) async {
137+
final originalFile = File(imagePath);
138+
List<int> imageBytes = await originalFile.readAsBytes();
139+
140+
final originalImage = img.decodeImage(imageBytes);
141+
final height = originalImage.height;
142+
final width = originalImage.width;
143+
144+
if (height >= width) {
145+
return originalFile;
146+
}
147+
148+
final exifData = await readExifFromBytes(imageBytes);
149+
img.Image fixedImage;
150+
151+
if (height < width) {
152+
if (exifData['Image Orientation'].printable.contains('Horizontal')) {
153+
fixedImage = img.copyRotate(originalImage, 90);
154+
} else if (exifData['Image Orientation'].printable.contains('180')) {
155+
fixedImage = img.copyRotate(originalImage, -90);
156+
} else if (exifData['Image Orientation'].printable.contains('CCW')) {
157+
fixedImage = img.copyRotate(originalImage, 180);
158+
} else {
159+
fixedImage = img.copyRotate(originalImage, 0);
160+
}
161+
}
162+
163+
final fixedFile =
164+
await originalFile.writeAsBytes(img.encodeJpg(fixedImage));
165+
166+
return fixedFile;
167+
}
168+
170169
@override
171170
Widget build(BuildContext context) {
172-
pr = ProgressDialog(
173-
context,
174-
type: ProgressDialogType.Normal,
175-
textDirection: TextDirection.ltr,
176-
isDismissible: false,
177-
);
171+
pr = ProgressDialog(context,
172+
type: ProgressDialogType.Download,
173+
isDismissible: false,
174+
showLogs: true);
178175

179176
pr.style(
180-
message:
181-
'Parsing image using tesseract. This takes some time.',
182-
borderRadius: 10.0,
183-
backgroundColor: Colors.white,
184-
elevation: 10.0,
185-
insetAnimCurve: Curves.easeInCirc,
186-
messageTextStyle: TextStyle(
187-
color: Colors.black, fontSize: 15.0, fontWeight: FontWeight.w600),
188-
);
177+
message: 'Downloading file...',
178+
borderRadius: 10.0,
179+
backgroundColor: Colors.white,
180+
progressWidget: CircularProgressIndicator(),
181+
elevation: 10.0,
182+
insetAnimCurve: Curves.easeInOut,
183+
progress: 0.0,
184+
maxProgress: 100.0,
185+
progressTextStyle: TextStyle(
186+
color: Colors.black, fontSize: 13.0, fontWeight: FontWeight.w400),
187+
messageTextStyle: TextStyle(
188+
color: Colors.black, fontSize: 19.0, fontWeight: FontWeight.w600));
189189

190190
return Scaffold(
191191
appBar: AppBar(title: Text('Display the Picture')),
@@ -231,11 +231,10 @@ class DisplayPictureScreenState extends State<DisplayPictureScreen> {
231231
await SharedPreferences.getInstance();
232232
String ip = sharedPrefs.get("ipv4");
233233

234-
pr.show();
234+
await fixExifRotation(imagePath);
235235
await NetworkClient.sendImage(
236236
File(imagePath), ip, context, key2);
237-
238-
pr.hide();
237+
_progress = _progress + 80.0;
239238
})))),
240239
],
241240
)

release_apk/receipt-manager.apk

22.8 MB
Binary file not shown.

0 commit comments

Comments
 (0)