Skip to content

Commit

Permalink
Fix changing color slider does not move
Browse files Browse the repository at this point in the history
  • Loading branch information
guyluz11 committed Jan 29, 2024
1 parent a71ff3a commit 42321d5
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 19 deletions.
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>

<application
Expand Down
1 change: 1 addition & 0 deletions lib/domain/connections_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:cybearjinni/infrastructure/core/logger.dart';
import 'package:cybearjinni/infrastructure/network_utilities_flutter.dart';
import 'package:dartz/dartz.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:grpc/grpc.dart';
import 'package:location/location.dart';
import 'package:network_info_plus/network_info_plus.dart';
Expand Down
4 changes: 3 additions & 1 deletion lib/infrastructure/network_utilities_flutter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'dart:async';
import 'package:cbj_integrations_controller/integrations_controller.dart';
import 'package:network_tools_flutter/network_tools_flutter.dart'
as network_flutter;
import 'package:network_tools_flutter/network_tools_flutter.dart';

class NetworkUtilitiesFlutter extends NetworkUtilities {
@override
Expand All @@ -13,7 +14,8 @@ class NetworkUtilitiesFlutter extends NetworkUtilities {
}) =>
network_flutter.HostScannerFlutter.getAllPingableDevices(
subnet,
firstHostId: 127,
firstHostId: firstHostId ?? HostScanner.defaultFirstHostId,
lastHostId: lastHostId ?? HostScanner.defaultLastHostId,
);

@override
Expand Down
20 changes: 4 additions & 16 deletions lib/presentation/molecules/devices/rgb_light_molecule.dart
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ class _LightColorMods extends State<LightColorMods> {
late HSVColor hsvColor;
late double brightness;
late ColorMode colorMode;
late Widget colorModeWidget;

@override
void initState() {
Expand All @@ -170,7 +169,6 @@ class _LightColorMods extends State<LightColorMods> {
hsvColor = widget.hsvColor ?? HSVColor.fromColor(Colors.white);
colorTemperature = widget.colorTemperature;
brightness = widget.brightness;
colorModeWidget = getColorModeWidget(colorMode);

_initialized();
}
Expand Down Expand Up @@ -283,22 +281,9 @@ class _LightColorMods extends State<LightColorMods> {
);
}

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;
});
}

Expand All @@ -309,7 +294,10 @@ class _LightColorMods extends State<LightColorMods> {

return Column(
children: [
colorModeWidget,
if (colorMode == ColorMode.white)
getHsvColorModeWidget()
else if (colorMode == ColorMode.rgb)
getWhiteModeWidget(),
const SeparatorAtom(variant: SeparatorVariant.reletedElements),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 42321d5

Please sign in to comment.