mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
Read icon from fetch scene api
This commit is contained in:
@ -32,18 +32,17 @@ class DraggableCard extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<RoutineBloc, RoutineState>(
|
||||
builder: (context, state) {
|
||||
final deviceFunctions =
|
||||
state.selectedFunctions[deviceData['uniqueCustomId']] ?? [];
|
||||
final deviceFunctions = state.selectedFunctions[deviceData['uniqueCustomId']] ?? [];
|
||||
|
||||
int index = state.thenItems.indexWhere(
|
||||
(item) => item['uniqueCustomId'] == deviceData['uniqueCustomId']);
|
||||
int index = state.thenItems
|
||||
.indexWhere((item) => item['uniqueCustomId'] == deviceData['uniqueCustomId']);
|
||||
|
||||
if (index != -1) {
|
||||
return _buildCardContent(context, deviceFunctions, padding: padding);
|
||||
}
|
||||
|
||||
int ifIndex = state.ifItems.indexWhere(
|
||||
(item) => item['uniqueCustomId'] == deviceData['uniqueCustomId']);
|
||||
int ifIndex = state.ifItems
|
||||
.indexWhere((item) => item['uniqueCustomId'] == deviceData['uniqueCustomId']);
|
||||
|
||||
if (ifIndex != -1) {
|
||||
return _buildCardContent(context, deviceFunctions, padding: padding);
|
||||
@ -53,8 +52,7 @@ class DraggableCard extends StatelessWidget {
|
||||
data: deviceData,
|
||||
feedback: Transform.rotate(
|
||||
angle: -0.1,
|
||||
child:
|
||||
_buildCardContent(context, deviceFunctions, padding: padding),
|
||||
child: _buildCardContent(context, deviceFunctions, padding: padding),
|
||||
),
|
||||
childWhenDragging: _buildGreyContainer(),
|
||||
child: _buildCardContent(context, deviceFunctions, padding: padding),
|
||||
@ -63,8 +61,7 @@ class DraggableCard extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCardContent(
|
||||
BuildContext context, List<DeviceFunctionData> deviceFunctions,
|
||||
Widget _buildCardContent(BuildContext context, List<DeviceFunctionData> deviceFunctions,
|
||||
{EdgeInsetsGeometry? padding}) {
|
||||
return Stack(
|
||||
children: [
|
||||
@ -93,7 +90,7 @@ class DraggableCard extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: deviceData['type'] == 'tap_to_run'
|
||||
child: deviceData['type'] == 'tap_to_run' || deviceData['type'] == 'scene'
|
||||
? Image.memory(
|
||||
base64Decode(deviceData['icon']),
|
||||
)
|
||||
@ -162,8 +159,7 @@ class DraggableCard extends StatelessWidget {
|
||||
}
|
||||
|
||||
String _formatFunctionValue(DeviceFunctionData function) {
|
||||
if (function.functionCode == 'temp_set' ||
|
||||
function.functionCode == 'temp_current') {
|
||||
if (function.functionCode == 'temp_set' || function.functionCode == 'temp_current') {
|
||||
return '${(function.value / 10).toStringAsFixed(0)}°C';
|
||||
} else if (function.functionCode.contains('countdown')) {
|
||||
final seconds = function.value.toInt();
|
||||
|
Reference in New Issue
Block a user