diff --git a/CHANGELOG.md b/CHANGELOG.md index 74bb7ee..446e41f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,10 @@ # Changelog +## [2.2.5] - 2025-12-30 +### Updated +- Dependencies +- Connectivity Plus to v7 +- Device Info Plus to v12 + ## [2.2.4] - 2025-10-15 ### Updated - Fixed issue where sum would not work for an empty list of double values diff --git a/example/lib/screen/touch_screen.dart b/example/lib/screen/touch_screen.dart index eede972..2424913 100644 --- a/example/lib/screen/touch_screen.dart +++ b/example/lib/screen/touch_screen.dart @@ -80,7 +80,7 @@ class _TouchScreenState extends State { child: TouchFeedBack( onTapped: () {}, child: Text( - '0x${color.value.toRadixString(16).padLeft(8, '0')}: $count', + '0x${color.toARGB32().toRadixString(16).padLeft(8, '0')}: $count', style: Theme.of(context) .textTheme .headlineMedium! diff --git a/example/macos/Flutter/GeneratedPluginRegistrant.swift b/example/macos/Flutter/GeneratedPluginRegistrant.swift index b91d239..22ccf61 100644 --- a/example/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/example/macos/Flutter/GeneratedPluginRegistrant.swift @@ -10,7 +10,7 @@ import device_info_plus import shared_preferences_foundation func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { - ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin")) + ConnectivityPlusPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlusPlugin")) DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) } diff --git a/lib/src/util/connectivity/connectivity.dart b/lib/src/util/connectivity/connectivity.dart index 12ceefc..37cb7d9 100644 --- a/lib/src/util/connectivity/connectivity.dart +++ b/lib/src/util/connectivity/connectivity.dart @@ -11,18 +11,18 @@ class ConnectivityHelper { /// Returns true if the device is connected to an IP network Future hasConnection() async { - return await getConnectivityResult() != ConnectivityResult.none; + return (await getConnectivityResult()).where((e) => e != ConnectivityResult.none).isNotEmpty; } /// Returns a stream that monitors the connectivity state of the device Stream monitorConnection() { return (_connectivityProvider?.call() ?? Connectivity()) .onConnectivityChanged - .map((event) => event != ConnectivityResult.none); + .map((event) => event.where((e) => e != ConnectivityResult.none).isNotEmpty); } /// Returns the method used to connect e.g: Bluetooth, WiFi, Ethernet, Mobile or None - Future getConnectivityResult() async { + Future> getConnectivityResult() async { return await (_connectivityProvider?.call() ?? Connectivity()) .checkConnectivity(); } diff --git a/pubspec.yaml b/pubspec.yaml index 7e66fdd..d4b1f12 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,15 +3,15 @@ description: icapps architecture components for flutter projects. Contains commo homepage: https://github.com/icapps/flutter-icapps-architecture repository: https://github.com/icapps/flutter-icapps-architecture issue_tracker: https://github.com/icapps/flutter-icapps-architecture/issues -version: 2.2.4 +version: 2.2.5 environment: sdk: '>=3.0.0 <4.0.0' dependencies: computer: ^3.2.1 - connectivity_plus: ^5.0.2 - device_info_plus: ^9.1.2 + connectivity_plus: ^7.0.0 + device_info_plus: ^12.3.0 dio: ^5.4.0 flutter: sdk: flutter @@ -25,6 +25,6 @@ dev_dependencies: flutter_test: sdk: flutter mockito: ^5.4.4 - flutter_lints: ^2.0.3 + flutter_lints: ^6.0.0 flutter: \ No newline at end of file diff --git a/test/provider/change_notifier_ex_test.mocks.dart b/test/provider/change_notifier_ex_test.mocks.dart index f1f993e..2884d9e 100644 --- a/test/provider/change_notifier_ex_test.mocks.dart +++ b/test/provider/change_notifier_ex_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.4 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in icapps_architecture/test/provider/change_notifier_ex_test.dart. // Do not manually edit this file. @@ -18,19 +18,16 @@ import 'package:mockito/src/dummies.dart' as _i3; // ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: must_be_immutable // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class +// ignore_for_file: invalid_use_of_internal_member class _FakeFuture_0 extends _i1.SmartFake implements _i2.Future { - _FakeFuture_0( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeFuture_0(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } /// A class which mocks [StreamSubscription]. @@ -43,90 +40,67 @@ class MockStreamSubscription extends _i1.Mock } @override - bool get isPaused => (super.noSuchMethod( - Invocation.getter(#isPaused), - returnValue: false, - ) as bool); + bool get isPaused => + (super.noSuchMethod(Invocation.getter(#isPaused), returnValue: false) + as bool); @override - _i2.Future cancel() => (super.noSuchMethod( - Invocation.method( - #cancel, - [], - ), - returnValue: _i2.Future.value(), - returnValueForMissingStub: _i2.Future.value(), - ) as _i2.Future); + _i2.Future cancel() => + (super.noSuchMethod( + Invocation.method(#cancel, []), + returnValue: _i2.Future.value(), + returnValueForMissingStub: _i2.Future.value(), + ) + as _i2.Future); @override void onData(void Function(T)? handleData) => super.noSuchMethod( - Invocation.method( - #onData, - [handleData], - ), - returnValueForMissingStub: null, - ); + Invocation.method(#onData, [handleData]), + returnValueForMissingStub: null, + ); @override void onError(Function? handleError) => super.noSuchMethod( - Invocation.method( - #onError, - [handleError], - ), - returnValueForMissingStub: null, - ); + Invocation.method(#onError, [handleError]), + returnValueForMissingStub: null, + ); @override void onDone(void Function()? handleDone) => super.noSuchMethod( - Invocation.method( - #onDone, - [handleDone], - ), - returnValueForMissingStub: null, - ); + Invocation.method(#onDone, [handleDone]), + returnValueForMissingStub: null, + ); @override void pause([_i2.Future? resumeSignal]) => super.noSuchMethod( - Invocation.method( - #pause, - [resumeSignal], - ), - returnValueForMissingStub: null, - ); + Invocation.method(#pause, [resumeSignal]), + returnValueForMissingStub: null, + ); @override void resume() => super.noSuchMethod( - Invocation.method( - #resume, - [], - ), - returnValueForMissingStub: null, - ); + Invocation.method(#resume, []), + returnValueForMissingStub: null, + ); @override - _i2.Future asFuture([E? futureValue]) => (super.noSuchMethod( - Invocation.method( - #asFuture, - [futureValue], - ), - returnValue: _i3.ifNotNull( - _i3.dummyValueOrNull( - this, - Invocation.method( - #asFuture, - [futureValue], + _i2.Future asFuture([E? futureValue]) => + (super.noSuchMethod( + Invocation.method(#asFuture, [futureValue]), + returnValue: + _i3.ifNotNull( + _i3.dummyValueOrNull( + this, + Invocation.method(#asFuture, [futureValue]), + ), + (E v) => _i2.Future.value(v), + ) ?? + _FakeFuture_0( + this, + Invocation.method(#asFuture, [futureValue]), ), - ), - (E v) => _i2.Future.value(v), - ) ?? - _FakeFuture_0( - this, - Invocation.method( - #asFuture, - [futureValue], - ), - ), - ) as _i2.Future); + ) + as _i2.Future); } /// A class which mocks [DisposeAware]. @@ -139,10 +113,7 @@ class MockDisposeAware extends _i1.Mock implements _i4.DisposeAware { @override void dispose() => super.noSuchMethod( - Invocation.method( - #dispose, - [], - ), - returnValueForMissingStub: null, - ); + Invocation.method(#dispose, []), + returnValueForMissingStub: null, + ); } diff --git a/test/test_util.dart b/test/test_util.dart index e933607..874f819 100644 --- a/test/test_util.dart +++ b/test/test_util.dart @@ -14,8 +14,6 @@ extension ScreenTypeProperties on ScreenType { return Size(828 * 1.5, 1792 * 1.5 - getStatusBarHeight); case ScreenType.IPADPRO: return Size(2048 * 1.5, 2732 * 1.5 - getStatusBarHeight); - default: - return const Size(500, 500); } } @@ -25,8 +23,6 @@ extension ScreenTypeProperties on ScreenType { return 88; case ScreenType.IPADPRO: return 40; - default: - return 48; } } @@ -36,8 +32,6 @@ extension ScreenTypeProperties on ScreenType { return 'iphone_11'; case ScreenType.IPADPRO: return 'ipad_pro'; - default: - return 'unknown_device'; } } } diff --git a/test/util/connectivity/connectivity_test.dart b/test/util/connectivity/connectivity_test.dart index 174bc6f..1f3e105 100644 --- a/test/util/connectivity/connectivity_test.dart +++ b/test/util/connectivity/connectivity_test.dart @@ -17,7 +17,7 @@ void main() { group('Connectivity tests', () { test('Test connectivity mobile', () async { when(connectivity.checkConnectivity()) - .thenAnswer((_) => Future.value(ConnectivityResult.mobile)); + .thenAnswer((_) => Future.value([ConnectivityResult.mobile])); expect( await ConnectivityHelper(connectivityProvider: () => connectivity) .hasConnection(), @@ -25,7 +25,7 @@ void main() { }); test('Test connectivity wifi', () async { when(connectivity.checkConnectivity()) - .thenAnswer((_) => Future.value(ConnectivityResult.wifi)); + .thenAnswer((_) => Future.value([ConnectivityResult.wifi])); expect( await ConnectivityHelper(connectivityProvider: () => connectivity) .hasConnection(), @@ -33,7 +33,7 @@ void main() { }); test('Test connectivity none', () async { when(connectivity.checkConnectivity()) - .thenAnswer((_) => Future.value(ConnectivityResult.none)); + .thenAnswer((_) => Future.value([ConnectivityResult.none])); expect( await ConnectivityHelper(connectivityProvider: () => connectivity) .hasConnection(), @@ -41,7 +41,7 @@ void main() { }); test('Test connectivity stream none', () async { when(connectivity.onConnectivityChanged) - .thenAnswer((_) => Stream.value(ConnectivityResult.none)); + .thenAnswer((_) => Stream.value([ConnectivityResult.none])); expect( await ConnectivityHelper(connectivityProvider: () => connectivity) .monitorConnection() @@ -50,7 +50,7 @@ void main() { }); test('Test connectivity stream wifi', () async { when(connectivity.onConnectivityChanged) - .thenAnswer((_) => Stream.value(ConnectivityResult.wifi)); + .thenAnswer((_) => Stream.value([ConnectivityResult.wifi])); expect( await ConnectivityHelper(connectivityProvider: () => connectivity) .monitorConnection() @@ -59,7 +59,7 @@ void main() { }); test('Test connectivity stream mobile', () async { when(connectivity.onConnectivityChanged) - .thenAnswer((_) => Stream.value(ConnectivityResult.mobile)); + .thenAnswer((_) => Stream.value([ConnectivityResult.mobile])); expect( await ConnectivityHelper(connectivityProvider: () => connectivity) .monitorConnection() diff --git a/test/util/connectivity/connectivity_test.mocks.dart b/test/util/connectivity/connectivity_test.mocks.dart index d6e49a4..e69467f 100644 --- a/test/util/connectivity/connectivity_test.mocks.dart +++ b/test/util/connectivity/connectivity_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.4 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in icapps_architecture/test/util/connectivity/connectivity_test.dart. // Do not manually edit this file. @@ -18,10 +18,12 @@ import 'package:mockito/mockito.dart' as _i1; // ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: must_be_immutable // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class +// ignore_for_file: invalid_use_of_internal_member /// A class which mocks [Connectivity]. /// @@ -32,19 +34,20 @@ class MockConnectivity extends _i1.Mock implements _i2.Connectivity { } @override - _i3.Stream<_i4.ConnectivityResult> get onConnectivityChanged => + _i3.Stream> get onConnectivityChanged => (super.noSuchMethod( - Invocation.getter(#onConnectivityChanged), - returnValue: _i3.Stream<_i4.ConnectivityResult>.empty(), - ) as _i3.Stream<_i4.ConnectivityResult>); + Invocation.getter(#onConnectivityChanged), + returnValue: _i3.Stream>.empty(), + ) + as _i3.Stream>); @override - _i3.Future<_i4.ConnectivityResult> checkConnectivity() => (super.noSuchMethod( - Invocation.method( - #checkConnectivity, - [], - ), - returnValue: _i3.Future<_i4.ConnectivityResult>.value( - _i4.ConnectivityResult.bluetooth), - ) as _i3.Future<_i4.ConnectivityResult>); + _i3.Future> checkConnectivity() => + (super.noSuchMethod( + Invocation.method(#checkConnectivity, []), + returnValue: _i3.Future>.value( + <_i4.ConnectivityResult>[], + ), + ) + as _i3.Future>); } diff --git a/test/util/environment/os_config_test.dart b/test/util/environment/os_config_test.dart index 8e4fe53..dd2312e 100644 --- a/test/util/environment/os_config_test.dart +++ b/test/util/environment/os_config_test.dart @@ -14,7 +14,6 @@ import 'os_config_test.mocks.dart'; DeviceInfoPlugin, AndroidBuildVersion, IosUtsname, - AndroidDisplayMetrics, ]) void main() { group('OS config tests', () { @@ -79,6 +78,11 @@ void main() { 'sdkInt': 10, 'securityPatch': 'securityPatch', }, + 'freeDiskSize': 1024, + 'totalDiskSize': 2048, + 'isLowRamDevice': false, + 'physicalRamSize': 2048, + 'availableRamSize': 1024, }))); final info = await io.initOsConfig( deviceInfoPluginProvider: () => mock, @@ -106,6 +110,13 @@ void main() { 'version': 'version', 'machine': 'machine', }, + 'modelName': "iPhone 17", + 'isiOSAppOnMac': false, + 'freeDiskSize': 1024, + 'totalDiskSize': 2048, + 'isLowRamDevice': false, + 'physicalRamSize': 2048, + 'availableRamSize': 1024, }))); final info = await io.initOsConfig( deviceInfoPluginProvider: () => mock, diff --git a/test/util/environment/os_config_test.mocks.dart b/test/util/environment/os_config_test.mocks.dart index 2992f4e..1007a7c 100644 --- a/test/util/environment/os_config_test.mocks.dart +++ b/test/util/environment/os_config_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.4 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in icapps_architecture/test/util/environment/os_config_test.dart. // Do not manually edit this file. @@ -25,85 +25,52 @@ import 'package:mockito/src/dummies.dart' as _i11; // ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: must_be_immutable // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class +// ignore_for_file: invalid_use_of_internal_member class _FakeAndroidDeviceInfo_0 extends _i1.SmartFake implements _i2.AndroidDeviceInfo { - _FakeAndroidDeviceInfo_0( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeAndroidDeviceInfo_0(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeIosDeviceInfo_1 extends _i1.SmartFake implements _i3.IosDeviceInfo { - _FakeIosDeviceInfo_1( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeIosDeviceInfo_1(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeLinuxDeviceInfo_2 extends _i1.SmartFake implements _i4.LinuxDeviceInfo { - _FakeLinuxDeviceInfo_2( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeLinuxDeviceInfo_2(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeWebBrowserInfo_3 extends _i1.SmartFake implements _i5.WebBrowserInfo { - _FakeWebBrowserInfo_3( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeWebBrowserInfo_3(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeMacOsDeviceInfo_4 extends _i1.SmartFake implements _i6.MacOsDeviceInfo { - _FakeMacOsDeviceInfo_4( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeMacOsDeviceInfo_4(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeWindowsDeviceInfo_5 extends _i1.SmartFake implements _i7.WindowsDeviceInfo { - _FakeWindowsDeviceInfo_5( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeWindowsDeviceInfo_5(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeBaseDeviceInfo_6 extends _i1.SmartFake implements _i8.BaseDeviceInfo { - _FakeBaseDeviceInfo_6( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeBaseDeviceInfo_6(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } /// A class which mocks [DeviceInfoPlugin]. @@ -115,73 +82,74 @@ class MockDeviceInfoPlugin extends _i1.Mock implements _i9.DeviceInfoPlugin { } @override - _i10.Future<_i2.AndroidDeviceInfo> get androidInfo => (super.noSuchMethod( - Invocation.getter(#androidInfo), - returnValue: - _i10.Future<_i2.AndroidDeviceInfo>.value(_FakeAndroidDeviceInfo_0( - this, - Invocation.getter(#androidInfo), - )), - ) as _i10.Future<_i2.AndroidDeviceInfo>); + _i10.Future<_i2.AndroidDeviceInfo> get androidInfo => + (super.noSuchMethod( + Invocation.getter(#androidInfo), + returnValue: _i10.Future<_i2.AndroidDeviceInfo>.value( + _FakeAndroidDeviceInfo_0(this, Invocation.getter(#androidInfo)), + ), + ) + as _i10.Future<_i2.AndroidDeviceInfo>); @override - _i10.Future<_i3.IosDeviceInfo> get iosInfo => (super.noSuchMethod( - Invocation.getter(#iosInfo), - returnValue: _i10.Future<_i3.IosDeviceInfo>.value(_FakeIosDeviceInfo_1( - this, - Invocation.getter(#iosInfo), - )), - ) as _i10.Future<_i3.IosDeviceInfo>); + _i10.Future<_i3.IosDeviceInfo> get iosInfo => + (super.noSuchMethod( + Invocation.getter(#iosInfo), + returnValue: _i10.Future<_i3.IosDeviceInfo>.value( + _FakeIosDeviceInfo_1(this, Invocation.getter(#iosInfo)), + ), + ) + as _i10.Future<_i3.IosDeviceInfo>); @override - _i10.Future<_i4.LinuxDeviceInfo> get linuxInfo => (super.noSuchMethod( - Invocation.getter(#linuxInfo), - returnValue: - _i10.Future<_i4.LinuxDeviceInfo>.value(_FakeLinuxDeviceInfo_2( - this, - Invocation.getter(#linuxInfo), - )), - ) as _i10.Future<_i4.LinuxDeviceInfo>); + _i10.Future<_i4.LinuxDeviceInfo> get linuxInfo => + (super.noSuchMethod( + Invocation.getter(#linuxInfo), + returnValue: _i10.Future<_i4.LinuxDeviceInfo>.value( + _FakeLinuxDeviceInfo_2(this, Invocation.getter(#linuxInfo)), + ), + ) + as _i10.Future<_i4.LinuxDeviceInfo>); @override - _i10.Future<_i5.WebBrowserInfo> get webBrowserInfo => (super.noSuchMethod( - Invocation.getter(#webBrowserInfo), - returnValue: - _i10.Future<_i5.WebBrowserInfo>.value(_FakeWebBrowserInfo_3( - this, - Invocation.getter(#webBrowserInfo), - )), - ) as _i10.Future<_i5.WebBrowserInfo>); + _i10.Future<_i5.WebBrowserInfo> get webBrowserInfo => + (super.noSuchMethod( + Invocation.getter(#webBrowserInfo), + returnValue: _i10.Future<_i5.WebBrowserInfo>.value( + _FakeWebBrowserInfo_3(this, Invocation.getter(#webBrowserInfo)), + ), + ) + as _i10.Future<_i5.WebBrowserInfo>); @override - _i10.Future<_i6.MacOsDeviceInfo> get macOsInfo => (super.noSuchMethod( - Invocation.getter(#macOsInfo), - returnValue: - _i10.Future<_i6.MacOsDeviceInfo>.value(_FakeMacOsDeviceInfo_4( - this, - Invocation.getter(#macOsInfo), - )), - ) as _i10.Future<_i6.MacOsDeviceInfo>); + _i10.Future<_i6.MacOsDeviceInfo> get macOsInfo => + (super.noSuchMethod( + Invocation.getter(#macOsInfo), + returnValue: _i10.Future<_i6.MacOsDeviceInfo>.value( + _FakeMacOsDeviceInfo_4(this, Invocation.getter(#macOsInfo)), + ), + ) + as _i10.Future<_i6.MacOsDeviceInfo>); @override - _i10.Future<_i7.WindowsDeviceInfo> get windowsInfo => (super.noSuchMethod( - Invocation.getter(#windowsInfo), - returnValue: - _i10.Future<_i7.WindowsDeviceInfo>.value(_FakeWindowsDeviceInfo_5( - this, - Invocation.getter(#windowsInfo), - )), - ) as _i10.Future<_i7.WindowsDeviceInfo>); + _i10.Future<_i7.WindowsDeviceInfo> get windowsInfo => + (super.noSuchMethod( + Invocation.getter(#windowsInfo), + returnValue: _i10.Future<_i7.WindowsDeviceInfo>.value( + _FakeWindowsDeviceInfo_5(this, Invocation.getter(#windowsInfo)), + ), + ) + as _i10.Future<_i7.WindowsDeviceInfo>); @override - _i10.Future<_i8.BaseDeviceInfo> get deviceInfo => (super.noSuchMethod( - Invocation.getter(#deviceInfo), - returnValue: - _i10.Future<_i8.BaseDeviceInfo>.value(_FakeBaseDeviceInfo_6( - this, - Invocation.getter(#deviceInfo), - )), - ) as _i10.Future<_i8.BaseDeviceInfo>); + _i10.Future<_i8.BaseDeviceInfo> get deviceInfo => + (super.noSuchMethod( + Invocation.getter(#deviceInfo), + returnValue: _i10.Future<_i8.BaseDeviceInfo>.value( + _FakeBaseDeviceInfo_6(this, Invocation.getter(#deviceInfo)), + ), + ) + as _i10.Future<_i8.BaseDeviceInfo>); } /// A class which mocks [AndroidBuildVersion]. @@ -194,46 +162,49 @@ class MockAndroidBuildVersion extends _i1.Mock } @override - String get codename => (super.noSuchMethod( - Invocation.getter(#codename), - returnValue: _i11.dummyValue( - this, - Invocation.getter(#codename), - ), - ) as String); + String get codename => + (super.noSuchMethod( + Invocation.getter(#codename), + returnValue: _i11.dummyValue( + this, + Invocation.getter(#codename), + ), + ) + as String); @override - String get incremental => (super.noSuchMethod( - Invocation.getter(#incremental), - returnValue: _i11.dummyValue( - this, - Invocation.getter(#incremental), - ), - ) as String); + String get incremental => + (super.noSuchMethod( + Invocation.getter(#incremental), + returnValue: _i11.dummyValue( + this, + Invocation.getter(#incremental), + ), + ) + as String); @override - String get release => (super.noSuchMethod( - Invocation.getter(#release), - returnValue: _i11.dummyValue( - this, - Invocation.getter(#release), - ), - ) as String); + String get release => + (super.noSuchMethod( + Invocation.getter(#release), + returnValue: _i11.dummyValue( + this, + Invocation.getter(#release), + ), + ) + as String); @override - int get sdkInt => (super.noSuchMethod( - Invocation.getter(#sdkInt), - returnValue: 0, - ) as int); + int get sdkInt => + (super.noSuchMethod(Invocation.getter(#sdkInt), returnValue: 0) as int); @override - Map toMap() => (super.noSuchMethod( - Invocation.method( - #toMap, - [], - ), - returnValue: {}, - ) as Map); + Map toMap() => + (super.noSuchMethod( + Invocation.method(#toMap, []), + returnValue: {}, + ) + as Map); } /// A class which mocks [IosUtsname]. @@ -245,108 +216,57 @@ class MockIosUtsname extends _i1.Mock implements _i3.IosUtsname { } @override - String get sysname => (super.noSuchMethod( - Invocation.getter(#sysname), - returnValue: _i11.dummyValue( - this, - Invocation.getter(#sysname), - ), - ) as String); + String get sysname => + (super.noSuchMethod( + Invocation.getter(#sysname), + returnValue: _i11.dummyValue( + this, + Invocation.getter(#sysname), + ), + ) + as String); @override - String get nodename => (super.noSuchMethod( - Invocation.getter(#nodename), - returnValue: _i11.dummyValue( - this, - Invocation.getter(#nodename), - ), - ) as String); + String get nodename => + (super.noSuchMethod( + Invocation.getter(#nodename), + returnValue: _i11.dummyValue( + this, + Invocation.getter(#nodename), + ), + ) + as String); @override - String get release => (super.noSuchMethod( - Invocation.getter(#release), - returnValue: _i11.dummyValue( - this, - Invocation.getter(#release), - ), - ) as String); + String get release => + (super.noSuchMethod( + Invocation.getter(#release), + returnValue: _i11.dummyValue( + this, + Invocation.getter(#release), + ), + ) + as String); @override - String get version => (super.noSuchMethod( - Invocation.getter(#version), - returnValue: _i11.dummyValue( - this, - Invocation.getter(#version), - ), - ) as String); + String get version => + (super.noSuchMethod( + Invocation.getter(#version), + returnValue: _i11.dummyValue( + this, + Invocation.getter(#version), + ), + ) + as String); @override - String get machine => (super.noSuchMethod( - Invocation.getter(#machine), - returnValue: _i11.dummyValue( - this, - Invocation.getter(#machine), - ), - ) as String); -} - -/// A class which mocks [AndroidDisplayMetrics]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockAndroidDisplayMetrics extends _i1.Mock - implements _i2.AndroidDisplayMetrics { - MockAndroidDisplayMetrics() { - _i1.throwOnMissingStub(this); - } - - @override - double get widthPx => (super.noSuchMethod( - Invocation.getter(#widthPx), - returnValue: 0.0, - ) as double); - - @override - double get heightPx => (super.noSuchMethod( - Invocation.getter(#heightPx), - returnValue: 0.0, - ) as double); - - @override - double get xDpi => (super.noSuchMethod( - Invocation.getter(#xDpi), - returnValue: 0.0, - ) as double); - - @override - double get yDpi => (super.noSuchMethod( - Invocation.getter(#yDpi), - returnValue: 0.0, - ) as double); - - @override - double get widthInches => (super.noSuchMethod( - Invocation.getter(#widthInches), - returnValue: 0.0, - ) as double); - - @override - double get heightInches => (super.noSuchMethod( - Invocation.getter(#heightInches), - returnValue: 0.0, - ) as double); - - @override - double get sizeInches => (super.noSuchMethod( - Invocation.getter(#sizeInches), - returnValue: 0.0, - ) as double); - - @override - Map toMap() => (super.noSuchMethod( - Invocation.method( - #toMap, - [], - ), - returnValue: {}, - ) as Map); + String get machine => + (super.noSuchMethod( + Invocation.getter(#machine), + returnValue: _i11.dummyValue( + this, + Invocation.getter(#machine), + ), + ) + as String); } diff --git a/test/util/logging/logging_test.mocks.dart b/test/util/logging/logging_test.mocks.dart index e0ae06d..cfe7d5f 100644 --- a/test/util/logging/logging_test.mocks.dart +++ b/test/util/logging/logging_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.4 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in icapps_architecture/test/util/logging/logging_test.dart. // Do not manually edit this file. @@ -15,220 +15,143 @@ import 'package:mockito/mockito.dart' as _i1; // ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: must_be_immutable // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class +// ignore_for_file: invalid_use_of_internal_member /// A class which mocks [Log]. /// /// See the documentation for Mockito's code generation for more information. class MockLog extends _i1.Mock implements _i2.Log { @override - void trace( - String? message, { - dynamic error, - StackTrace? stackTrace, - }) => + void trace(String? message, {dynamic error, StackTrace? stackTrace}) => super.noSuchMethod( Invocation.method( #trace, [message], - { - #error: error, - #stackTrace: stackTrace, - }, + {#error: error, #stackTrace: stackTrace}, ), returnValueForMissingStub: null, ); @override - void debug( - String? message, { - dynamic error, - StackTrace? stackTrace, - }) => + void debug(String? message, {dynamic error, StackTrace? stackTrace}) => super.noSuchMethod( Invocation.method( #debug, [message], - { - #error: error, - #stackTrace: stackTrace, - }, + {#error: error, #stackTrace: stackTrace}, ), returnValueForMissingStub: null, ); @override - void info( - String? message, { - dynamic error, - StackTrace? stackTrace, - }) => + void info(String? message, {dynamic error, StackTrace? stackTrace}) => super.noSuchMethod( Invocation.method( #info, [message], - { - #error: error, - #stackTrace: stackTrace, - }, + {#error: error, #stackTrace: stackTrace}, ), returnValueForMissingStub: null, ); @override - void warning( - String? message, { - dynamic error, - StackTrace? stackTrace, - }) => + void warning(String? message, {dynamic error, StackTrace? stackTrace}) => super.noSuchMethod( Invocation.method( #warning, [message], - { - #error: error, - #stackTrace: stackTrace, - }, + {#error: error, #stackTrace: stackTrace}, ), returnValueForMissingStub: null, ); @override - void error( - String? message, { - dynamic error, - StackTrace? stackTrace, - }) => + void error(String? message, {dynamic error, StackTrace? stackTrace}) => super.noSuchMethod( Invocation.method( #error, [message], - { - #error: error, - #stackTrace: stackTrace, - }, + {#error: error, #stackTrace: stackTrace}, ), returnValueForMissingStub: null, ); @override - void t( - String? message, { - dynamic error, - StackTrace? stackTrace, - }) => + void t(String? message, {dynamic error, StackTrace? stackTrace}) => super.noSuchMethod( Invocation.method( #t, [message], - { - #error: error, - #stackTrace: stackTrace, - }, + {#error: error, #stackTrace: stackTrace}, ), returnValueForMissingStub: null, ); @override - void d( - String? message, { - dynamic error, - StackTrace? stackTrace, - }) => + void d(String? message, {dynamic error, StackTrace? stackTrace}) => super.noSuchMethod( Invocation.method( #d, [message], - { - #error: error, - #stackTrace: stackTrace, - }, + {#error: error, #stackTrace: stackTrace}, ), returnValueForMissingStub: null, ); @override - void i( - String? message, { - dynamic error, - StackTrace? stackTrace, - }) => + void i(String? message, {dynamic error, StackTrace? stackTrace}) => super.noSuchMethod( Invocation.method( #i, [message], - { - #error: error, - #stackTrace: stackTrace, - }, + {#error: error, #stackTrace: stackTrace}, ), returnValueForMissingStub: null, ); @override - void w( - String? message, { - dynamic error, - StackTrace? stackTrace, - }) => + void w(String? message, {dynamic error, StackTrace? stackTrace}) => super.noSuchMethod( Invocation.method( #w, [message], - { - #error: error, - #stackTrace: stackTrace, - }, + {#error: error, #stackTrace: stackTrace}, ), returnValueForMissingStub: null, ); @override - void e( - String? message, { - dynamic error, - StackTrace? stackTrace, - }) => + void e(String? message, {dynamic error, StackTrace? stackTrace}) => super.noSuchMethod( Invocation.method( #e, [message], - { - #error: error, - #stackTrace: stackTrace, - }, + {#error: error, #stackTrace: stackTrace}, ), returnValueForMissingStub: null, ); @override void logNetworkError(_i2.NetworkError? error) => super.noSuchMethod( - Invocation.method( - #logNetworkError, - [error], - ), - returnValueForMissingStub: null, - ); + Invocation.method(#logNetworkError, [error]), + returnValueForMissingStub: null, + ); @override void logNetworkRequest(_i3.RequestOptions? request) => super.noSuchMethod( - Invocation.method( - #logNetworkRequest, - [request], - ), - returnValueForMissingStub: null, - ); + Invocation.method(#logNetworkRequest, [request]), + returnValueForMissingStub: null, + ); @override void logNetworkResponse(_i3.Response? response) => super.noSuchMethod( - Invocation.method( - #logNetworkResponse, - [response], - ), + Invocation.method(#logNetworkResponse, [response]), returnValueForMissingStub: null, ); } diff --git a/test/util/preferences/preferences_storage_test.mocks.dart b/test/util/preferences/preferences_storage_test.mocks.dart index 05f0dca..3e9b1d5 100644 --- a/test/util/preferences/preferences_storage_test.mocks.dart +++ b/test/util/preferences/preferences_storage_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.4 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in icapps_architecture/test/util/preferences/preferences_storage_test.dart. // Do not manually edit this file. @@ -6,7 +6,7 @@ import 'dart:async' as _i3; import 'package:mockito/mockito.dart' as _i1; -import 'package:shared_preferences/shared_preferences.dart' as _i2; +import 'package:shared_preferences/src/shared_preferences_legacy.dart' as _i2; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -16,10 +16,12 @@ import 'package:shared_preferences/shared_preferences.dart' as _i2; // ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: must_be_immutable // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class +// ignore_for_file: invalid_use_of_internal_member /// A class which mocks [SharedPreferences]. /// @@ -30,174 +32,116 @@ class MockSharedPreferences extends _i1.Mock implements _i2.SharedPreferences { } @override - Set getKeys() => (super.noSuchMethod( - Invocation.method( - #getKeys, - [], - ), - returnValue: {}, - ) as Set); + Set getKeys() => + (super.noSuchMethod( + Invocation.method(#getKeys, []), + returnValue: {}, + ) + as Set); @override - Object? get(String? key) => (super.noSuchMethod(Invocation.method( - #get, - [key], - )) as Object?); + Object? get(String? key) => + (super.noSuchMethod(Invocation.method(#get, [key])) as Object?); @override - bool? getBool(String? key) => (super.noSuchMethod(Invocation.method( - #getBool, - [key], - )) as bool?); + bool? getBool(String? key) => + (super.noSuchMethod(Invocation.method(#getBool, [key])) as bool?); @override - int? getInt(String? key) => (super.noSuchMethod(Invocation.method( - #getInt, - [key], - )) as int?); + int? getInt(String? key) => + (super.noSuchMethod(Invocation.method(#getInt, [key])) as int?); @override - double? getDouble(String? key) => (super.noSuchMethod(Invocation.method( - #getDouble, - [key], - )) as double?); + double? getDouble(String? key) => + (super.noSuchMethod(Invocation.method(#getDouble, [key])) as double?); @override - String? getString(String? key) => (super.noSuchMethod(Invocation.method( - #getString, - [key], - )) as String?); + String? getString(String? key) => + (super.noSuchMethod(Invocation.method(#getString, [key])) as String?); @override - bool containsKey(String? key) => (super.noSuchMethod( - Invocation.method( - #containsKey, - [key], - ), - returnValue: false, - ) as bool); + bool containsKey(String? key) => + (super.noSuchMethod( + Invocation.method(#containsKey, [key]), + returnValue: false, + ) + as bool); @override List? getStringList(String? key) => - (super.noSuchMethod(Invocation.method( - #getStringList, - [key], - )) as List?); + (super.noSuchMethod(Invocation.method(#getStringList, [key])) + as List?); + + @override + _i3.Future setBool(String? key, bool? value) => + (super.noSuchMethod( + Invocation.method(#setBool, [key, value]), + returnValue: _i3.Future.value(false), + ) + as _i3.Future); + + @override + _i3.Future setInt(String? key, int? value) => + (super.noSuchMethod( + Invocation.method(#setInt, [key, value]), + returnValue: _i3.Future.value(false), + ) + as _i3.Future); + + @override + _i3.Future setDouble(String? key, double? value) => + (super.noSuchMethod( + Invocation.method(#setDouble, [key, value]), + returnValue: _i3.Future.value(false), + ) + as _i3.Future); @override - _i3.Future setBool( - String? key, - bool? value, - ) => + _i3.Future setString(String? key, String? value) => (super.noSuchMethod( - Invocation.method( - #setBool, - [ - key, - value, - ], - ), - returnValue: _i3.Future.value(false), - ) as _i3.Future); - - @override - _i3.Future setInt( - String? key, - int? value, - ) => + Invocation.method(#setString, [key, value]), + returnValue: _i3.Future.value(false), + ) + as _i3.Future); + + @override + _i3.Future setStringList(String? key, List? value) => (super.noSuchMethod( - Invocation.method( - #setInt, - [ - key, - value, - ], - ), - returnValue: _i3.Future.value(false), - ) as _i3.Future); - - @override - _i3.Future setDouble( - String? key, - double? value, - ) => + Invocation.method(#setStringList, [key, value]), + returnValue: _i3.Future.value(false), + ) + as _i3.Future); + + @override + _i3.Future remove(String? key) => (super.noSuchMethod( - Invocation.method( - #setDouble, - [ - key, - value, - ], - ), - returnValue: _i3.Future.value(false), - ) as _i3.Future); - - @override - _i3.Future setString( - String? key, - String? value, - ) => + Invocation.method(#remove, [key]), + returnValue: _i3.Future.value(false), + ) + as _i3.Future); + + @override + _i3.Future commit() => (super.noSuchMethod( - Invocation.method( - #setString, - [ - key, - value, - ], - ), - returnValue: _i3.Future.value(false), - ) as _i3.Future); - - @override - _i3.Future setStringList( - String? key, - List? value, - ) => + Invocation.method(#commit, []), + returnValue: _i3.Future.value(false), + ) + as _i3.Future); + + @override + _i3.Future clear() => + (super.noSuchMethod( + Invocation.method(#clear, []), + returnValue: _i3.Future.value(false), + ) + as _i3.Future); + + @override + _i3.Future reload() => (super.noSuchMethod( - Invocation.method( - #setStringList, - [ - key, - value, - ], - ), - returnValue: _i3.Future.value(false), - ) as _i3.Future); - - @override - _i3.Future remove(String? key) => (super.noSuchMethod( - Invocation.method( - #remove, - [key], - ), - returnValue: _i3.Future.value(false), - ) as _i3.Future); - - @override - _i3.Future commit() => (super.noSuchMethod( - Invocation.method( - #commit, - [], - ), - returnValue: _i3.Future.value(false), - ) as _i3.Future); - - @override - _i3.Future clear() => (super.noSuchMethod( - Invocation.method( - #clear, - [], - ), - returnValue: _i3.Future.value(false), - ) as _i3.Future); - - @override - _i3.Future reload() => (super.noSuchMethod( - Invocation.method( - #reload, - [], - ), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + Invocation.method(#reload, []), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); } diff --git a/test/widget/touch_feedback/touch_feedback_test.dart b/test/widget/touch_feedback/touch_feedback_test.dart index 55b5c08..bf6b429 100644 --- a/test/widget/touch_feedback/touch_feedback_test.dart +++ b/test/widget/touch_feedback/touch_feedback_test.dart @@ -5,12 +5,13 @@ import 'package:icapps_architecture/icapps_architecture.dart'; import '../../test_util.dart'; void main() { + final alpha = 128 / 255; // Old withOpacity rounds the values differently so we need to do exactly the same here for screenshot testing testWidgets('TouchFeedBack on Android', (tester) async { final sut = Theme( data: ThemeData(platform: TargetPlatform.android), child: TouchFeedBack( child: Container( - color: Colors.amber.withOpacity(0.5), + color: Colors.amber.withValues(alpha: alpha,), ), onTapped: () {}, ), @@ -24,7 +25,7 @@ void main() { data: ThemeData(platform: TargetPlatform.android), child: TouchFeedBack( child: Container( - color: Colors.amber.withOpacity(0.5), + color: Colors.amber.withValues(alpha: alpha,), ), onTapped: null, ), @@ -38,7 +39,7 @@ void main() { data: ThemeData(platform: TargetPlatform.iOS), child: TouchFeedBack( child: Container( - color: Colors.amber.withOpacity(0.5), + color: Colors.amber.withValues(alpha: alpha,), ), onTapped: () {}, ), @@ -54,7 +55,7 @@ void main() { data: ThemeData(platform: TargetPlatform.android), child: TouchFeedBack( child: Container( - color: Colors.amber.withOpacity(0.5), + color: Colors.amber.withValues(alpha: alpha,), ), onTapped: () { onClickCalled = true; @@ -75,7 +76,7 @@ void main() { data: ThemeData(platform: TargetPlatform.iOS), child: TouchFeedBack( child: Container( - color: Colors.amber.withOpacity(0.5), + color: Colors.amber.withValues(alpha: alpha,), ), onTapped: () { onClickCalled = true; @@ -95,7 +96,7 @@ void main() { data: ThemeData(platform: TargetPlatform.iOS), child: TouchFeedBack( child: Container( - color: Colors.amber.withOpacity(0.5), + color: Colors.amber.withValues(alpha: alpha,), ), onTapped: () { onClickCalled = true; @@ -115,7 +116,7 @@ void main() { data: ThemeData(platform: TargetPlatform.iOS), child: TouchFeedBack( child: Container( - color: Colors.amber.withOpacity(0.5), + color: Colors.amber.withValues(alpha: alpha,), ), onTapped: () { onClickCalled = true;