@@ -7,8 +7,7 @@ import 'package:magicepaperapp/image_library/model/saved_image_model.dart';
7
7
import 'package:magicepaperapp/constants/color_constants.dart' ;
8
8
import 'package:magicepaperapp/image_library/provider/image_library_provider.dart' ;
9
9
import 'package:magicepaperapp/image_library/utils/epd_utils.dart' ;
10
- import 'package:magicepaperapp/util/epd/epd.dart' ;
11
- import 'package:magicepaperapp/util/protocol.dart' ;
10
+ import 'package:magicepaperapp/util/epd/display_device.dart' ;
12
11
import 'package:image/image.dart' as img;
13
12
import 'dart:typed_data' ;
14
13
@@ -17,7 +16,7 @@ class ImageOperationsService {
17
16
18
17
ImageOperationsService (this .context);
19
18
20
- Epd getEpdFromImage (SavedImage image) {
19
+ DisplayDevice getEpdFromImage (SavedImage image) {
21
20
return EpdUtils .getEpdFromMetadata (image.metadata);
22
21
}
23
22
@@ -117,7 +116,10 @@ class ImageOperationsService {
117
116
final decodedImage = img.decodeImage (imageData);
118
117
if (decodedImage != null ) {
119
118
final rotatedImage = img.copyRotate (decodedImage, angle: - 90 );
120
- Protocol (epd: imageEpd).writeImages (rotatedImage);
119
+ imageEpd.transfer (
120
+ context,
121
+ rotatedImage,
122
+ );
121
123
} else {
122
124
_showErrorSnackBar ('Failed to decode image "${image .name }"' );
123
125
}
@@ -296,7 +298,7 @@ class ImageOperationsService {
296
298
297
299
void _showSaveLoadingSnackBar () {
298
300
ScaffoldMessenger .of (context).showSnackBar (
299
- SnackBar (
301
+ const SnackBar (
300
302
content: Row (
301
303
children: [
302
304
SizedBox (
@@ -307,28 +309,28 @@ class ImageOperationsService {
307
309
valueColor: AlwaysStoppedAnimation <Color >(Colors .white),
308
310
),
309
311
),
310
- const SizedBox (width: 12 ),
311
- const Text ('Saving image...' ),
312
+ SizedBox (width: 12 ),
313
+ Text ('Saving image...' ),
312
314
],
313
315
),
314
316
backgroundColor: colorAccent,
315
- duration: const Duration (seconds: 2 ),
317
+ duration: Duration (seconds: 2 ),
316
318
),
317
319
);
318
320
}
319
321
320
322
void _showSaveSuccessSnackBar () {
321
323
ScaffoldMessenger .of (context).showSnackBar (
322
324
SnackBar (
323
- content: Row (
325
+ content: const Row (
324
326
children: [
325
- const Icon (
327
+ Icon (
326
328
Icons .check_circle,
327
329
color: Colors .white,
328
330
size: 20 ,
329
331
),
330
- const SizedBox (width: 12 ),
331
- const Text ('Image saved to library!' ),
332
+ SizedBox (width: 12 ),
333
+ Text ('Image saved to library!' ),
332
334
],
333
335
),
334
336
backgroundColor: Colors .green,
0 commit comments