Fixed design issues, added tag and location to the save dialog

This commit is contained in:
Abdullah Alassaf
2025-04-16 03:46:10 +03:00
parent db1f29e2b2
commit d4a7dd5854
7 changed files with 311 additions and 274 deletions

View File

@ -238,8 +238,6 @@ SOS
// tempIcon = Assets.gang3touch; // tempIcon = Assets.gang3touch;
} else if (type == DeviceType.WaterLeak) { } else if (type == DeviceType.WaterLeak) {
tempIcon = Assets.waterLeakNormal; tempIcon = Assets.waterLeakNormal;
} else if (type == DeviceType.WaterLeak) {
tempIcon = Assets.waterLeakNormal;
} else { } else {
tempIcon = Assets.logoHorizontal; tempIcon = Assets.logoHorizontal;
} }

View File

@ -684,15 +684,15 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
? '${action.entityId}_automation' ? '${action.entityId}_automation'
: action.actionExecutor == 'delay' : action.actionExecutor == 'delay'
? '${action.entityId}_delay' ? '${action.entityId}_delay'
: action.entityId; : const Uuid().v4();
if (!deviceCards.containsKey(deviceId)) { // if (!deviceCards.containsKey(deviceId)) {
deviceCards[deviceId] = { deviceCards[deviceId] = {
'entityId': action.entityId, 'entityId': action.entityId,
'deviceId': action.actionExecutor == 'delay' ? 'delay' : action.entityId, 'deviceId': action.actionExecutor == 'delay' ? 'delay' : action.entityId,
'uniqueCustomId': action.type == 'automation' || action.actionExecutor == 'delay' 'uniqueCustomId': action.type == 'automation' || action.actionExecutor == 'delay'
? const Uuid().v4() ? action.entityId
: action.entityId, : const Uuid().v4(),
'title': action.actionExecutor == 'delay' 'title': action.actionExecutor == 'delay'
? 'Delay' ? 'Delay'
: action.type == 'automation' : action.type == 'automation'
@ -708,16 +708,21 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
'device': matchingDevice, 'device': matchingDevice,
'name': action.name, 'name': action.name,
'type': action.type, 'type': action.type,
'tag': matchingDevice?.deviceTags?.isNotEmpty ?? false
? matchingDevice?.deviceTags![0].name ?? ''
: '',
'subSpace': matchingDevice?.deviceSubSpace?.subspaceName ?? '',
}; };
} // }
final cardData = deviceCards[deviceId]!; final cardData = deviceCards[deviceId]!;
final uniqueCustomId = cardData['uniqueCustomId'].toString(); final uniqueCustomId = cardData['uniqueCustomId'].toString();
if (action.type == 'automation') {
if (!updatedFunctions.containsKey(uniqueCustomId)) { if (!updatedFunctions.containsKey(uniqueCustomId)) {
updatedFunctions[uniqueCustomId] = []; updatedFunctions[uniqueCustomId] = [];
} }
if (action.type == 'automation') {
updatedFunctions[uniqueCustomId]!.add( updatedFunctions[uniqueCustomId]!.add(
DeviceFunctionData( DeviceFunctionData(
entityId: action.entityId, entityId: action.entityId,
@ -728,14 +733,11 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
); );
// emit(state.copyWith(automationActionExecutor: action.actionExecutor)); // emit(state.copyWith(automationActionExecutor: action.actionExecutor));
} else if (action.executorProperty != null && action.actionExecutor != 'delay') { } else if (action.executorProperty != null && action.actionExecutor != 'delay') {
// if (!updatedFunctions.containsKey(uniqueCustomId)) { final functions = matchingDevice?.functions ?? [];
// updatedFunctions[uniqueCustomId] = [];
// }
final functions = matchingDevice?.functions;
final functionCode = action.executorProperty?.functionCode; final functionCode = action.executorProperty?.functionCode;
for (DeviceFunction function in functions ?? []) { for (DeviceFunction function in functions) {
if (function.code == functionCode) { if (function.code == functionCode) {
updatedFunctions[const Uuid().v4()]!.add( updatedFunctions[uniqueCustomId]!.add(
DeviceFunctionData( DeviceFunctionData(
entityId: action.entityId, entityId: action.entityId,
functionCode: functionCode ?? '', functionCode: functionCode ?? '',
@ -747,9 +749,6 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
} }
} }
} else if (action.actionExecutor == 'delay') { } else if (action.actionExecutor == 'delay') {
if (!updatedFunctions.containsKey(uniqueCustomId)) {
updatedFunctions[uniqueCustomId] = [];
}
final delayFunction = DelayFunction( final delayFunction = DelayFunction(
deviceId: action.entityId, deviceId: action.entityId,
deviceName: 'Delay', deviceName: 'Delay',
@ -1156,9 +1155,9 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
), ),
); );
final deviceId = condition.entityId; final deviceId = const Uuid().v4();
if (!deviceIfCards.containsKey(deviceId)) { // if (!deviceIfCards.containsKey(deviceId)) {
deviceIfCards[deviceId] = { deviceIfCards[deviceId] = {
'entityId': condition.entityId, 'entityId': condition.entityId,
'deviceId': condition.entityId, 'deviceId': condition.entityId,
@ -1169,8 +1168,12 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
'imagePath': matchingDevice.getDefaultIcon(condition.productType), 'imagePath': matchingDevice.getDefaultIcon(condition.productType),
'device': matchingDevice, 'device': matchingDevice,
'type': 'condition', 'type': 'condition',
'tag': matchingDevice.deviceTags?.isNotEmpty ?? false
? matchingDevice.deviceTags![0].name
: '',
'subSpace': matchingDevice.deviceSubSpace?.subspaceName ?? '',
}; };
} // }
final cardData = deviceIfCards[deviceId]!; final cardData = deviceIfCards[deviceId]!;
final uniqueCustomId = cardData['uniqueCustomId'].toString(); final uniqueCustomId = cardData['uniqueCustomId'].toString();
@ -1206,10 +1209,9 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
), ),
); );
final deviceId = final deviceId = const Uuid().v4();
action.actionExecutor == 'delay' ? '${action.entityId}_delay' : action.entityId;
if (!deviceThenCards.containsKey(deviceId)) { // if (!deviceThenCards.containsKey(deviceId)) {
deviceThenCards[deviceId] = { deviceThenCards[deviceId] = {
'entityId': action.entityId, 'entityId': action.entityId,
'deviceId': action.actionExecutor == 'delay' ? 'delay' : action.entityId, 'deviceId': action.actionExecutor == 'delay' ? 'delay' : action.entityId,
@ -1233,8 +1235,12 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
? 'automation' ? 'automation'
: 'action', : 'action',
'icon': action.icon ?? '', 'icon': action.icon ?? '',
'tag': matchingDevice.deviceTags?.isNotEmpty ?? false
? matchingDevice.deviceTags![0].name
: '',
'subSpace': matchingDevice.deviceSubSpace?.subspaceName ?? '',
}; };
} // }
final cardData = deviceThenCards[deviceId]!; final cardData = deviceThenCards[deviceId]!;
final uniqueCustomId = cardData['uniqueCustomId'].toString(); final uniqueCustomId = cardData['uniqueCustomId'].toString();

View File

@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:syncrow_web/pages/routines/bloc/routine_bloc/routine_bloc.dart'; import 'package:syncrow_web/pages/routines/bloc/routine_bloc/routine_bloc.dart';
import 'package:syncrow_web/pages/routines/models/device_functions.dart';
import 'package:syncrow_web/pages/routines/widgets/dialog_header.dart'; import 'package:syncrow_web/pages/routines/widgets/dialog_header.dart';
import 'package:syncrow_web/pages/routines/widgets/dialog_footer.dart'; import 'package:syncrow_web/pages/routines/widgets/dialog_footer.dart';
import 'package:syncrow_web/utils/color_manager.dart'; import 'package:syncrow_web/utils/color_manager.dart';
@ -20,7 +21,7 @@ class SaveRoutineHelper {
return AlertDialog( return AlertDialog(
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
content: Container( content: Container(
width: 600, width: MediaQuery.sizeOf(context).width * 0.5,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(20),
@ -30,14 +31,15 @@ class SaveRoutineHelper {
children: [ children: [
DialogHeader('Create a scene: ${state.routineName ?? ""}'), DialogHeader('Create a scene: ${state.routineName ?? ""}'),
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0), padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
// Left side - IF // Left side - IF
Expanded( Expanded(
child: Column( child: ListView(
crossAxisAlignment: CrossAxisAlignment.start, // crossAxisAlignment: CrossAxisAlignment.start,
shrinkWrap: true,
children: [ children: [
const Text( const Text(
'IF:', 'IF:',
@ -59,26 +61,7 @@ class SaveRoutineHelper {
...state.ifItems.map((item) { ...state.ifItems.map((item) {
final functions = final functions =
state.selectedFunctions[item['uniqueCustomId']] ?? []; state.selectedFunctions[item['uniqueCustomId']] ?? [];
return ListTile( return functionRow(item, context, functions);
leading: SvgPicture.asset(
item['imagePath'],
width: 22,
height: 22,
),
title:
Text(item['title'], style: const TextStyle(fontSize: 14)),
subtitle: Wrap(
children: functions
.map((f) => Text(
'${f.operationName}: ${f.value}, ',
style: const TextStyle(
color: ColorsManager.grayColor, fontSize: 8),
overflow: TextOverflow.ellipsis,
maxLines: 3,
))
.toList(),
),
);
}), }),
], ],
), ),
@ -87,8 +70,9 @@ class SaveRoutineHelper {
// Right side - THEN items // Right side - THEN items
Expanded( Expanded(
child: Column( child: ListView(
crossAxisAlignment: CrossAxisAlignment.start, // crossAxisAlignment: CrossAxisAlignment.start,
shrinkWrap: true,
children: [ children: [
const Text( const Text(
'THEN:', 'THEN:',
@ -100,37 +84,7 @@ class SaveRoutineHelper {
...state.thenItems.map((item) { ...state.thenItems.map((item) {
final functions = final functions =
state.selectedFunctions[item['uniqueCustomId']] ?? []; state.selectedFunctions[item['uniqueCustomId']] ?? [];
return ListTile( return functionRow(item, context, functions);
leading: item['type'] == 'tap_to_run' || item['type'] == 'scene'
? Image.memory(
base64Decode(item['icon']),
width: 22,
height: 22,
)
: SvgPicture.asset(
item['imagePath'],
width: 22,
height: 22,
),
title: Text(
item['title'],
style: context.textTheme.bodySmall?.copyWith(
fontSize: 14,
color: ColorsManager.grayColor,
),
),
subtitle: Wrap(
children: functions
.map((f) => Text(
'${f.operationName}: ${f.value}, ',
style: context.textTheme.bodySmall?.copyWith(
color: ColorsManager.grayColor, fontSize: 8),
overflow: TextOverflow.ellipsis,
maxLines: 3,
))
.toList(),
),
);
}), }),
], ],
), ),
@ -177,4 +131,112 @@ class SaveRoutineHelper {
}, },
); );
} }
static Widget functionRow(
dynamic item, BuildContext context, List<DeviceFunctionData> functions) {
return Padding(
padding: const EdgeInsets.only(top: 6),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
spacing: 8,
children: [
item['type'] == 'tap_to_run' || item['type'] == 'scene'
? Image.memory(
base64Decode(item['icon']),
width: 22,
height: 22,
)
: SvgPicture.asset(
item['imagePath'],
width: 22,
height: 22,
),
Flexible(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 2,
children: [
Text(
item['title'],
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: context.textTheme.bodySmall?.copyWith(
fontSize: 14,
color: ColorsManager.textPrimaryColor,
),
),
Wrap(
children: functions
.map((f) => Text(
'${f.operationName}: ${f.value}',
style: context.textTheme.bodySmall
?.copyWith(color: ColorsManager.grayColor, fontSize: 8),
overflow: TextOverflow.ellipsis,
maxLines: 3,
))
.toList(),
),
],
),
),
],
),
),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 2,
children: [
Visibility(
visible: item['tag'] != null && item['tag'] != '',
child: Row(
spacing: 2,
children: [
SizedBox(width: 8, height: 8, child: SvgPicture.asset(Assets.deviceTagIcon)),
Text(
item['tag'] ?? '',
textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: context.textTheme.bodySmall?.copyWith(
color: ColorsManager.lightGreyColor,
fontSize: 9,
fontWeight: FontWeight.w400,
),
),
],
),
),
Visibility(
visible: item['subSpace'] != null && item['subSpace'] != '',
child: Row(
spacing: 2,
children: [
SizedBox(
width: 8, height: 8, child: SvgPicture.asset(Assets.spaceLocationIcon)),
Text(
item['subSpace'] ?? '',
textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: context.textTheme.bodySmall?.copyWith(
color: ColorsManager.lightGreyColor,
fontSize: 9,
fontWeight: FontWeight.w400,
),
),
],
),
),
],
),
],
),
);
}
} }

View File

@ -29,8 +29,7 @@ class _RoutinesViewState extends State<RoutinesView> {
final spaceId = result['space']; final spaceId = result['space'];
final _bloc = BlocProvider.of<CreateRoutineBloc>(context); final _bloc = BlocProvider.of<CreateRoutineBloc>(context);
final routineBloc = context.read<RoutineBloc>(); final routineBloc = context.read<RoutineBloc>();
_bloc.add(SaveCommunityIdAndSpaceIdEvent( _bloc.add(SaveCommunityIdAndSpaceIdEvent(communityID: communityId, spaceID: spaceId));
communityID: communityId, spaceID: spaceId));
await Future.delayed(const Duration(seconds: 1)); await Future.delayed(const Duration(seconds: 1));
routineBloc.add(const CreateNewRoutineViewEvent(createRoutineView: true)); routineBloc.add(const CreateNewRoutineViewEvent(createRoutineView: true));
} }
@ -49,7 +48,8 @@ class _RoutinesViewState extends State<RoutinesView> {
child: SpaceTreeView( child: SpaceTreeView(
onSelect: () => context.read<RoutineBloc>() onSelect: () => context.read<RoutineBloc>()
..add(const LoadScenes()) ..add(const LoadScenes())
..add(const LoadAutomation()), ..add(const LoadAutomation())
..add(FetchDevicesInRoutine()),
), ),
), ),
Expanded( Expanded(
@ -64,8 +64,7 @@ class _RoutinesViewState extends State<RoutinesView> {
children: [ children: [
Text( Text(
"Create New Routines", "Create New Routines",
style: style: Theme.of(context).textTheme.titleLarge?.copyWith(
Theme.of(context).textTheme.titleLarge?.copyWith(
color: ColorsManager.grayColor, color: ColorsManager.grayColor,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),

View File

@ -69,9 +69,9 @@ class DraggableCard extends StatelessWidget {
Card( Card(
color: ColorsManager.whiteColors, color: ColorsManager.whiteColors,
child: Container( child: Container(
padding: padding ?? const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
width: 110, width: 110,
height: deviceFunctions.isEmpty ? 160 : 170, height: deviceFunctions.isEmpty ? 160 : 180,
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@ -103,7 +103,6 @@ class DraggableCard extends StatelessWidget {
const SizedBox(height: 8), const SizedBox(height: 8),
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 3), padding: const EdgeInsets.symmetric(horizontal: 3),
child: Flexible(
child: Text( child: Text(
deviceData['title'] ?? deviceData['name'] ?? title, deviceData['title'] ?? deviceData['name'] ?? title,
textAlign: TextAlign.center, textAlign: TextAlign.center,
@ -115,7 +114,6 @@ class DraggableCard extends StatelessWidget {
), ),
), ),
), ),
),
const SizedBox( const SizedBox(
height: 4, height: 4,
), ),
@ -131,7 +129,7 @@ class DraggableCard extends StatelessWidget {
deviceData['tag'] ?? '', deviceData['tag'] ?? '',
textAlign: TextAlign.center, textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
maxLines: 2, maxLines: 1,
style: context.textTheme.bodySmall?.copyWith( style: context.textTheme.bodySmall?.copyWith(
color: ColorsManager.lightGreyColor, color: ColorsManager.lightGreyColor,
fontSize: 9, fontSize: 9,
@ -162,7 +160,7 @@ class DraggableCard extends StatelessWidget {
deviceData['subSpace'] ?? '', deviceData['subSpace'] ?? '',
textAlign: TextAlign.center, textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
maxLines: 2, maxLines: 1,
style: context.textTheme.bodySmall?.copyWith( style: context.textTheme.bodySmall?.copyWith(
color: ColorsManager.lightGreyColor, color: ColorsManager.lightGreyColor,
fontSize: 9, fontSize: 9,

View File

@ -17,7 +17,8 @@ class IfContainer extends StatelessWidget {
builder: (context, state) { builder: (context, state) {
return DragTarget<Map<String, dynamic>>( return DragTarget<Map<String, dynamic>>(
builder: (context, candidateData, rejectedData) { builder: (context, candidateData, rejectedData) {
return Container( return SingleChildScrollView(
child: Container(
width: double.infinity, width: double.infinity,
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
child: Column( child: Column(
@ -27,8 +28,7 @@ class IfContainer extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
const Text('IF', const Text('IF',
style: TextStyle( style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
fontSize: 18, fontWeight: FontWeight.bold)),
if (state.isAutomation && state.ifItems.isNotEmpty) if (state.isAutomation && state.ifItems.isNotEmpty)
AutomationOperatorSelector( AutomationOperatorSelector(
selectedOperator: state.selectedAutomationOperator), selectedOperator: state.selectedAutomationOperator),
@ -55,17 +55,16 @@ class IfContainer extends StatelessWidget {
(index) => GestureDetector( (index) => GestureDetector(
onTap: () async { onTap: () async {
if (!state.isTabToRun) { if (!state.isTabToRun) {
final result = await DeviceDialogHelper final result = await DeviceDialogHelper.showDeviceDialog(
.showDeviceDialog(
context: context, context: context,
data: state.ifItems[index], data: state.ifItems[index],
removeComparetors: false, removeComparetors: false,
dialogType: "IF"); dialogType: "IF");
if (result != null) { if (result != null) {
context.read<RoutineBloc>().add( context
AddToIfContainer( .read<RoutineBloc>()
state.ifItems[index], false)); .add(AddToIfContainer(state.ifItems[index], false));
} else if (![ } else if (![
'AC', 'AC',
'1G', '1G',
@ -73,36 +72,32 @@ class IfContainer extends StatelessWidget {
'3G', '3G',
'WPS' 'WPS'
'GW', 'GW',
].contains( ].contains(state.ifItems[index]['productType'])) {
state.ifItems[index]['productType'])) { context
context.read<RoutineBloc>().add( .read<RoutineBloc>()
AddToIfContainer( .add(AddToIfContainer(state.ifItems[index], false));
state.ifItems[index], false));
} }
} }
}, },
child: DraggableCard( child: DraggableCard(
imagePath: imagePath: state.ifItems[index]['imagePath'] ?? '',
state.ifItems[index]['imagePath'] ?? '',
title: state.ifItems[index]['title'] ?? '', title: state.ifItems[index]['title'] ?? '',
deviceData: state.ifItems[index], deviceData: state.ifItems[index],
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 8),
horizontal: 4, vertical: 8),
isFromThen: false, isFromThen: false,
isFromIf: true, isFromIf: true,
onRemove: () { onRemove: () {
context.read<RoutineBloc>().add( context.read<RoutineBloc>().add(RemoveDragCard(
RemoveDragCard(
index: index, index: index,
isFromThen: false, isFromThen: false,
key: state.ifItems[index] key: state.ifItems[index]['uniqueCustomId']));
['uniqueCustomId']));
}, },
), ),
)), )),
), ),
], ],
), ),
),
); );
}, },
onAcceptWithDetails: (data) async { onAcceptWithDetails: (data) async {
@ -116,9 +111,7 @@ class IfContainer extends StatelessWidget {
if (!state.isTabToRun) { if (!state.isTabToRun) {
if (mutableData['deviceId'] == 'tab_to_run') { if (mutableData['deviceId'] == 'tab_to_run') {
context context.read<RoutineBloc>().add(AddToIfContainer(mutableData, true));
.read<RoutineBloc>()
.add(AddToIfContainer(mutableData, true));
} else { } else {
final result = await DeviceDialogHelper.showDeviceDialog( final result = await DeviceDialogHelper.showDeviceDialog(
dialogType: 'IF', dialogType: 'IF',
@ -127,14 +120,10 @@ class IfContainer extends StatelessWidget {
removeComparetors: false); removeComparetors: false);
if (result != null) { if (result != null) {
context context.read<RoutineBloc>().add(AddToIfContainer(mutableData, false));
.read<RoutineBloc>()
.add(AddToIfContainer(mutableData, false));
} else if (!['AC', '1G', '2G', '3G', 'WPS', 'GW'] } else if (!['AC', '1G', '2G', '3G', 'WPS', 'GW']
.contains(mutableData['productType'])) { .contains(mutableData['productType'])) {
context context.read<RoutineBloc>().add(AddToIfContainer(mutableData, false));
.read<RoutineBloc>()
.add(AddToIfContainer(mutableData, false));
} }
} }
} }
@ -180,9 +169,7 @@ class AutomationOperatorSelector extends StatelessWidget {
), ),
), ),
onPressed: () { onPressed: () {
context context.read<RoutineBloc>().add(const ChangeAutomationOperator(operator: 'or'));
.read<RoutineBloc>()
.add(const ChangeAutomationOperator(operator: 'or'));
}, },
), ),
Container( Container(
@ -208,9 +195,7 @@ class AutomationOperatorSelector extends StatelessWidget {
), ),
), ),
onPressed: () { onPressed: () {
context context.read<RoutineBloc>().add(const ChangeAutomationOperator(operator: 'and'));
.read<RoutineBloc>()
.add(const ChangeAutomationOperator(operator: 'and'));
}, },
), ),
], ],

View File

@ -121,8 +121,7 @@ class _RoutineViewCardState extends State<RoutineViewCard> {
child: SizedBox( child: SizedBox(
width: 16, width: 16,
height: 16, height: 16,
child: child: CircularProgressIndicator(strokeWidth: 2),
CircularProgressIndicator(strokeWidth: 2),
), ),
), ),
) )
@ -159,9 +158,7 @@ class _RoutineViewCardState extends State<RoutineViewCard> {
height: iconSize, height: iconSize,
width: iconSize, width: iconSize,
fit: BoxFit.contain, fit: BoxFit.contain,
errorBuilder: errorBuilder: (context, error, stackTrace) => Image.asset(
(context, error, stackTrace) =>
Image.asset(
Assets.logo, Assets.logo,
height: iconSize, height: iconSize,
width: iconSize, width: iconSize,
@ -174,8 +171,7 @@ class _RoutineViewCardState extends State<RoutineViewCard> {
width: iconSize, width: iconSize,
fit: BoxFit.contain, fit: BoxFit.contain,
) )
: (widget.icon is String && : (widget.icon is String && widget.icon.endsWith('.svg'))
widget.icon.endsWith('.svg'))
? SvgPicture.asset( ? SvgPicture.asset(
height: iconSize, height: iconSize,
width: iconSize, width: iconSize,
@ -185,9 +181,7 @@ class _RoutineViewCardState extends State<RoutineViewCard> {
: Icon( : Icon(
widget.icon, widget.icon,
color: ColorsManager.dialogBlueTitle, color: ColorsManager.dialogBlueTitle,
size: widget.isSmallScreenSize(context) size: widget.isSmallScreenSize(context) ? 30 : 40,
? 30
: 40,
), ),
), ),
), ),
@ -200,11 +194,10 @@ class _RoutineViewCardState extends State<RoutineViewCard> {
widget.textString, widget.textString,
textAlign: TextAlign.center, textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
maxLines: 2, maxLines: 1,
style: context.textTheme.bodySmall?.copyWith( style: context.textTheme.bodySmall?.copyWith(
color: ColorsManager.blackColor, color: ColorsManager.blackColor,
fontSize: fontSize: widget.isSmallScreenSize(context) ? 10 : 12,
widget.isSmallScreenSize(context) ? 10 : 12,
), ),
), ),
if (widget.spaceName != '') if (widget.spaceName != '')
@ -220,14 +213,10 @@ class _RoutineViewCardState extends State<RoutineViewCard> {
widget.spaceName, widget.spaceName,
textAlign: TextAlign.center, textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
maxLines: 2, maxLines: 1,
style: style: context.textTheme.bodySmall?.copyWith(
context.textTheme.bodySmall?.copyWith(
color: ColorsManager.blackColor, color: ColorsManager.blackColor,
fontSize: fontSize: widget.isSmallScreenSize(context) ? 10 : 12,
widget.isSmallScreenSize(context)
? 10
: 12,
), ),
), ),
], ],