From 42321d5c64beb38c810b751dd52bdc47e6f7bf0d Mon Sep 17 00:00:00 2001 From: Guy Luz Date: Tue, 30 Jan 2024 01:40:57 +0200 Subject: [PATCH] Fix changing color slider does not move --- android/app/src/main/AndroidManifest.xml | 1 + lib/domain/connections_service.dart | 1 + .../network_utilities_flutter.dart | 4 +++- .../molecules/devices/rgb_light_molecule.dart | 20 ++++--------------- .../computer_connection_check_widget.dart | 2 +- .../configure_new_cbj_comp_widget.dart | 2 +- 6 files changed, 11 insertions(+), 19 deletions(-) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 6e88767c..020e5df0 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -19,6 +19,7 @@ + network_flutter.HostScannerFlutter.getAllPingableDevices( subnet, - firstHostId: 127, + firstHostId: firstHostId ?? HostScanner.defaultFirstHostId, + lastHostId: lastHostId ?? HostScanner.defaultLastHostId, ); @override diff --git a/lib/presentation/molecules/devices/rgb_light_molecule.dart b/lib/presentation/molecules/devices/rgb_light_molecule.dart index c8539aa4..ae78e220 100644 --- a/lib/presentation/molecules/devices/rgb_light_molecule.dart +++ b/lib/presentation/molecules/devices/rgb_light_molecule.dart @@ -161,7 +161,6 @@ class _LightColorMods extends State { late HSVColor hsvColor; late double brightness; late ColorMode colorMode; - late Widget colorModeWidget; @override void initState() { @@ -170,7 +169,6 @@ class _LightColorMods extends State { hsvColor = widget.hsvColor ?? HSVColor.fromColor(Colors.white); colorTemperature = widget.colorTemperature; brightness = widget.brightness; - colorModeWidget = getColorModeWidget(colorMode); _initialized(); } @@ -283,22 +281,9 @@ class _LightColorMods extends State { ); } - Widget getColorModeWidget(ColorMode colorMode) { - switch (colorMode) { - case ColorMode.undefined: - return const SizedBox(); - case ColorMode.rgb: - return getHsvColorModeWidget(); - case ColorMode.white: - return getWhiteModeWidget(); - } - } - void setColorModeState(ColorMode colorMode) { - final Widget colorModeWidget = getColorModeWidget(colorMode); setState(() { this.colorMode = colorMode; - this.colorModeWidget = colorModeWidget; }); } @@ -309,7 +294,10 @@ class _LightColorMods extends State { return Column( children: [ - colorModeWidget, + if (colorMode == ColorMode.white) + getHsvColorModeWidget() + else if (colorMode == ColorMode.rgb) + getWhiteModeWidget(), const SeparatorAtom(variant: SeparatorVariant.reletedElements), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, diff --git a/lib/presentation/pages/add_new_devices_process/computer_connection_check/widgets/computer_connection_check_widget.dart b/lib/presentation/pages/add_new_devices_process/computer_connection_check/widgets/computer_connection_check_widget.dart index 6131c0e5..1b4237ce 100644 --- a/lib/presentation/pages/add_new_devices_process/computer_connection_check/widgets/computer_connection_check_widget.dart +++ b/lib/presentation/pages/add_new_devices_process/computer_connection_check/widgets/computer_connection_check_widget.dart @@ -122,7 +122,7 @@ class _ComputerConnectionCheckWidgetState '$deviceNameFieldKey/${deviceE.uniqueId.getOrCrash()}']! .text; deviceEntityList.add( - deviceE..cbjEntityName = CbjEntityName(deviceName), + deviceE..cbjEntityName = CbjEntityName(value: deviceName), ); } catch (e) { logger.w("Can't add unsupported device"); diff --git a/lib/presentation/pages/add_new_devices_process/configure_new_cbj_comp/widgets/configure_new_cbj_comp_widget.dart b/lib/presentation/pages/add_new_devices_process/configure_new_cbj_comp/widgets/configure_new_cbj_comp_widget.dart index d22b8324..59efb79f 100644 --- a/lib/presentation/pages/add_new_devices_process/configure_new_cbj_comp/widgets/configure_new_cbj_comp_widget.dart +++ b/lib/presentation/pages/add_new_devices_process/configure_new_cbj_comp/widgets/configure_new_cbj_comp_widget.dart @@ -110,7 +110,7 @@ class _ConfigureNewCbjCompWidgetsState '$deviceNameFieldKey/${deviceE.uniqueId.getOrCrash()}']! .text; deviceEntityList.add( - deviceE..cbjEntityName = CbjEntityName(deviceName), + deviceE..cbjEntityName = CbjEntityName(value: deviceName), ); } catch (e) { logger.w("Can't add unsupported device");