@@ -7,29 +7,19 @@ import 'package:flutter/services.dart';
77import 'package:flutter_riverpod/flutter_riverpod.dart' ;
88
99abstract class IDeviceService {
10- Future <ui.Size > getSizeInPixels ();
11-
12- static final provider = Provider <IDeviceService >((ref) {
13- const channel = MethodChannel ('org.catrobat.paintroid/device' );
14- return DeviceService (channel);
10+ static final sizeProvider = Provider <ui.Size >((ref) {
11+ throw UnimplementedError ();
1512 });
16-
17- static final sizeProvider = FutureProvider (
18- (ref) => ref.watch (provider).getSizeInPixels (),
19- );
2013}
2114
22- class DeviceService implements IDeviceService {
23- DeviceService (this ._methodChannel);
24-
25- final MethodChannel _methodChannel;
26- final ui.Size _testSize = const ui.Size (1179 , 2556 );
15+ class DeviceService {
16+ static const _channel = MethodChannel ('org.catrobat.paintroid/device' );
17+ static const ui.Size _testSize = ui.Size (1179 , 2556 );
2718
28- @override
29- Future <ui.Size > getSizeInPixels () async {
19+ static Future <ui.Size > getSizeInPixels () async {
3020 final firstView = WidgetsBinding .instance.platformDispatcher.views.first;
3121 if (Platform .isAndroid) {
32- final height = await _methodChannel .invokeMethod ('getHeightInPixels' );
22+ final height = await _channel .invokeMethod ('getHeightInPixels' );
3323 return ui.Size (firstView.physicalSize.width, height);
3424 } else if (Platform .isIOS) {
3525 return firstView.physicalSize;
0 commit comments