Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion example/lib/screen/touch_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class _TouchScreenState extends State<TouchScreen> {
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!
Expand Down
2 changes: 1 addition & 1 deletion example/macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
}
6 changes: 3 additions & 3 deletions lib/src/util/connectivity/connectivity.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ class ConnectivityHelper {

/// Returns true if the device is connected to an IP network
Future<bool> 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<bool> 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<ConnectivityResult> getConnectivityResult() async {
Future<List<ConnectivityResult>> getConnectivityResult() async {
return await (_connectivityProvider?.call() ?? Connectivity())
.checkConnectivity();
}
Expand Down
8 changes: 4 additions & 4 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
127 changes: 49 additions & 78 deletions test/provider/change_notifier_ex_test.mocks.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions test/test_util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand All @@ -25,8 +23,6 @@ extension ScreenTypeProperties on ScreenType {
return 88;
case ScreenType.IPADPRO:
return 40;
default:
return 48;
}
}

Expand All @@ -36,8 +32,6 @@ extension ScreenTypeProperties on ScreenType {
return 'iphone_11';
case ScreenType.IPADPRO:
return 'ipad_pro';
default:
return 'unknown_device';
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions test/util/connectivity/connectivity_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,31 @@ 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(),
true);
});
test('Test connectivity wifi', () async {
when(connectivity.checkConnectivity())
.thenAnswer((_) => Future.value(ConnectivityResult.wifi));
.thenAnswer((_) => Future.value([ConnectivityResult.wifi]));
expect(
await ConnectivityHelper(connectivityProvider: () => connectivity)
.hasConnection(),
true);
});
test('Test connectivity none', () async {
when(connectivity.checkConnectivity())
.thenAnswer((_) => Future.value(ConnectivityResult.none));
.thenAnswer((_) => Future.value([ConnectivityResult.none]));
expect(
await ConnectivityHelper(connectivityProvider: () => connectivity)
.hasConnection(),
false);
});
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()
Expand All @@ -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()
Expand All @@ -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()
Expand Down
29 changes: 16 additions & 13 deletions test/util/connectivity/connectivity_test.mocks.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading