diff --git a/lib/pages/device_managment/all_devices/models/devices_model.dart b/lib/pages/device_managment/all_devices/models/devices_model.dart index c7c35eca..0ac3f776 100644 --- a/lib/pages/device_managment/all_devices/models/devices_model.dart +++ b/lib/pages/device_managment/all_devices/models/devices_model.dart @@ -238,8 +238,6 @@ SOS // tempIcon = Assets.gang3touch; } else if (type == DeviceType.WaterLeak) { tempIcon = Assets.waterLeakNormal; - } else if (type == DeviceType.WaterLeak) { - tempIcon = Assets.waterLeakNormal; } else { tempIcon = Assets.logoHorizontal; } diff --git a/lib/pages/routines/bloc/routine_bloc/routine_bloc.dart b/lib/pages/routines/bloc/routine_bloc/routine_bloc.dart index b698c19e..d60f8d64 100644 --- a/lib/pages/routines/bloc/routine_bloc/routine_bloc.dart +++ b/lib/pages/routines/bloc/routine_bloc/routine_bloc.dart @@ -684,40 +684,45 @@ class RoutineBloc extends Bloc { ? '${action.entityId}_automation' : action.actionExecutor == 'delay' ? '${action.entityId}_delay' - : action.entityId; + : const Uuid().v4(); - if (!deviceCards.containsKey(deviceId)) { - deviceCards[deviceId] = { - 'entityId': action.entityId, - 'deviceId': action.actionExecutor == 'delay' ? 'delay' : action.entityId, - 'uniqueCustomId': action.type == 'automation' || action.actionExecutor == 'delay' - ? const Uuid().v4() - : action.entityId, - 'title': action.actionExecutor == 'delay' - ? 'Delay' - : action.type == 'automation' - ? action.name ?? 'Automation' - : (matchingDevice?.name ?? 'Device'), - 'productType': action.productType, - 'functions': matchingDevice?.functions, - 'imagePath': action.type == 'automation' - ? Assets.automation - : action.actionExecutor == 'delay' - ? Assets.delay - : matchingDevice?.getDefaultIcon(action.productType), - 'device': matchingDevice, - 'name': action.name, - 'type': action.type, - }; - } + // if (!deviceCards.containsKey(deviceId)) { + deviceCards[deviceId] = { + 'entityId': action.entityId, + 'deviceId': action.actionExecutor == 'delay' ? 'delay' : action.entityId, + 'uniqueCustomId': action.type == 'automation' || action.actionExecutor == 'delay' + ? action.entityId + : const Uuid().v4(), + 'title': action.actionExecutor == 'delay' + ? 'Delay' + : action.type == 'automation' + ? action.name ?? 'Automation' + : (matchingDevice?.name ?? 'Device'), + 'productType': action.productType, + 'functions': matchingDevice?.functions, + 'imagePath': action.type == 'automation' + ? Assets.automation + : action.actionExecutor == 'delay' + ? Assets.delay + : matchingDevice?.getDefaultIcon(action.productType), + 'device': matchingDevice, + 'name': action.name, + 'type': action.type, + 'tag': matchingDevice?.deviceTags?.isNotEmpty ?? false + ? matchingDevice?.deviceTags![0].name ?? '' + : '', + 'subSpace': matchingDevice?.deviceSubSpace?.subspaceName ?? '', + }; + // } final cardData = deviceCards[deviceId]!; final uniqueCustomId = cardData['uniqueCustomId'].toString(); + if (!updatedFunctions.containsKey(uniqueCustomId)) { + updatedFunctions[uniqueCustomId] = []; + } + if (action.type == 'automation') { - if (!updatedFunctions.containsKey(uniqueCustomId)) { - updatedFunctions[uniqueCustomId] = []; - } updatedFunctions[uniqueCustomId]!.add( DeviceFunctionData( entityId: action.entityId, @@ -728,14 +733,11 @@ class RoutineBloc extends Bloc { ); // emit(state.copyWith(automationActionExecutor: action.actionExecutor)); } else if (action.executorProperty != null && action.actionExecutor != 'delay') { - // if (!updatedFunctions.containsKey(uniqueCustomId)) { - // updatedFunctions[uniqueCustomId] = []; - // } - final functions = matchingDevice?.functions; + final functions = matchingDevice?.functions ?? []; final functionCode = action.executorProperty?.functionCode; - for (DeviceFunction function in functions ?? []) { + for (DeviceFunction function in functions) { if (function.code == functionCode) { - updatedFunctions[const Uuid().v4()]!.add( + updatedFunctions[uniqueCustomId]!.add( DeviceFunctionData( entityId: action.entityId, functionCode: functionCode ?? '', @@ -747,9 +749,6 @@ class RoutineBloc extends Bloc { } } } else if (action.actionExecutor == 'delay') { - if (!updatedFunctions.containsKey(uniqueCustomId)) { - updatedFunctions[uniqueCustomId] = []; - } final delayFunction = DelayFunction( deviceId: action.entityId, deviceName: 'Delay', @@ -1156,21 +1155,25 @@ class RoutineBloc extends Bloc { ), ); - final deviceId = condition.entityId; + final deviceId = const Uuid().v4(); - if (!deviceIfCards.containsKey(deviceId)) { - deviceIfCards[deviceId] = { - 'entityId': condition.entityId, - 'deviceId': condition.entityId, - 'uniqueCustomId': const Uuid().v4(), - 'title': matchingDevice.name ?? 'Device', - 'productType': condition.productType, - 'functions': matchingDevice.functions, - 'imagePath': matchingDevice.getDefaultIcon(condition.productType), - 'device': matchingDevice, - 'type': 'condition', - }; - } + // if (!deviceIfCards.containsKey(deviceId)) { + deviceIfCards[deviceId] = { + 'entityId': condition.entityId, + 'deviceId': condition.entityId, + 'uniqueCustomId': const Uuid().v4(), + 'title': matchingDevice.name ?? 'Device', + 'productType': condition.productType, + 'functions': matchingDevice.functions, + 'imagePath': matchingDevice.getDefaultIcon(condition.productType), + 'device': matchingDevice, + 'type': 'condition', + 'tag': matchingDevice.deviceTags?.isNotEmpty ?? false + ? matchingDevice.deviceTags![0].name + : '', + 'subSpace': matchingDevice.deviceSubSpace?.subspaceName ?? '', + }; + // } final cardData = deviceIfCards[deviceId]!; final uniqueCustomId = cardData['uniqueCustomId'].toString(); @@ -1206,35 +1209,38 @@ class RoutineBloc extends Bloc { ), ); - final deviceId = - action.actionExecutor == 'delay' ? '${action.entityId}_delay' : action.entityId; + final deviceId = const Uuid().v4(); - if (!deviceThenCards.containsKey(deviceId)) { - deviceThenCards[deviceId] = { - 'entityId': action.entityId, - 'deviceId': action.actionExecutor == 'delay' ? 'delay' : action.entityId, - 'uniqueCustomId': const Uuid().v4(), - 'title': action.actionExecutor == 'delay' - ? 'Delay' - : (action.type == 'scene' || action.type == 'automation') - ? action.name - : (matchingDevice.name ?? 'Device'), - 'productType': action.productType, - 'functions': matchingDevice.functions, - 'imagePath': action.actionExecutor == 'delay' - ? Assets.delay - : action.type == 'automation' - ? Assets.automation - : matchingDevice.getDefaultIcon(action.productType), - 'device': matchingDevice, - 'type': action.type == 'scene' - ? 'scene' - : action.type == 'automation' - ? 'automation' - : 'action', - 'icon': action.icon ?? '', - }; - } + // if (!deviceThenCards.containsKey(deviceId)) { + deviceThenCards[deviceId] = { + 'entityId': action.entityId, + 'deviceId': action.actionExecutor == 'delay' ? 'delay' : action.entityId, + 'uniqueCustomId': const Uuid().v4(), + 'title': action.actionExecutor == 'delay' + ? 'Delay' + : (action.type == 'scene' || action.type == 'automation') + ? action.name + : (matchingDevice.name ?? 'Device'), + 'productType': action.productType, + 'functions': matchingDevice.functions, + 'imagePath': action.actionExecutor == 'delay' + ? Assets.delay + : action.type == 'automation' + ? Assets.automation + : matchingDevice.getDefaultIcon(action.productType), + 'device': matchingDevice, + 'type': action.type == 'scene' + ? 'scene' + : action.type == 'automation' + ? 'automation' + : 'action', + 'icon': action.icon ?? '', + 'tag': matchingDevice.deviceTags?.isNotEmpty ?? false + ? matchingDevice.deviceTags![0].name + : '', + 'subSpace': matchingDevice.deviceSubSpace?.subspaceName ?? '', + }; + // } final cardData = deviceThenCards[deviceId]!; final uniqueCustomId = cardData['uniqueCustomId'].toString(); diff --git a/lib/pages/routines/helper/save_routine_helper.dart b/lib/pages/routines/helper/save_routine_helper.dart index e2ca5ede..457f74dc 100644 --- a/lib/pages/routines/helper/save_routine_helper.dart +++ b/lib/pages/routines/helper/save_routine_helper.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.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/models/device_functions.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/utils/color_manager.dart'; @@ -20,7 +21,7 @@ class SaveRoutineHelper { return AlertDialog( contentPadding: EdgeInsets.zero, content: Container( - width: 600, + width: MediaQuery.sizeOf(context).width * 0.5, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(20), @@ -30,14 +31,15 @@ class SaveRoutineHelper { children: [ DialogHeader('Create a scene: ${state.routineName ?? ""}'), Padding( - padding: const EdgeInsets.symmetric(horizontal: 8.0), + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ // Left side - IF Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + child: ListView( + // crossAxisAlignment: CrossAxisAlignment.start, + shrinkWrap: true, children: [ const Text( 'IF:', @@ -59,26 +61,7 @@ class SaveRoutineHelper { ...state.ifItems.map((item) { final functions = state.selectedFunctions[item['uniqueCustomId']] ?? []; - return ListTile( - 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(), - ), - ); + return functionRow(item, context, functions); }), ], ), @@ -87,8 +70,9 @@ class SaveRoutineHelper { // Right side - THEN items Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + child: ListView( + // crossAxisAlignment: CrossAxisAlignment.start, + shrinkWrap: true, children: [ const Text( 'THEN:', @@ -100,37 +84,7 @@ class SaveRoutineHelper { ...state.thenItems.map((item) { final functions = state.selectedFunctions[item['uniqueCustomId']] ?? []; - return ListTile( - 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(), - ), - ); + return functionRow(item, context, functions); }), ], ), @@ -177,4 +131,112 @@ class SaveRoutineHelper { }, ); } + + static Widget functionRow( + dynamic item, BuildContext context, List 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, + ), + ), + ], + ), + ), + ], + ), + ], + ), + ); + } } diff --git a/lib/pages/routines/view/routines_view.dart b/lib/pages/routines/view/routines_view.dart index c398243c..2d6ee648 100644 --- a/lib/pages/routines/view/routines_view.dart +++ b/lib/pages/routines/view/routines_view.dart @@ -29,8 +29,7 @@ class _RoutinesViewState extends State { final spaceId = result['space']; final _bloc = BlocProvider.of(context); final routineBloc = context.read(); - _bloc.add(SaveCommunityIdAndSpaceIdEvent( - communityID: communityId, spaceID: spaceId)); + _bloc.add(SaveCommunityIdAndSpaceIdEvent(communityID: communityId, spaceID: spaceId)); await Future.delayed(const Duration(seconds: 1)); routineBloc.add(const CreateNewRoutineViewEvent(createRoutineView: true)); } @@ -49,7 +48,8 @@ class _RoutinesViewState extends State { child: SpaceTreeView( onSelect: () => context.read() ..add(const LoadScenes()) - ..add(const LoadAutomation()), + ..add(const LoadAutomation()) + ..add(FetchDevicesInRoutine()), ), ), Expanded( @@ -64,11 +64,10 @@ class _RoutinesViewState extends State { children: [ Text( "Create New Routines", - style: - Theme.of(context).textTheme.titleLarge?.copyWith( - color: ColorsManager.grayColor, - fontWeight: FontWeight.bold, - ), + style: Theme.of(context).textTheme.titleLarge?.copyWith( + color: ColorsManager.grayColor, + fontWeight: FontWeight.bold, + ), ), const SizedBox(height: 10), RoutineViewCard( diff --git a/lib/pages/routines/widgets/dragable_card.dart b/lib/pages/routines/widgets/dragable_card.dart index 7395d2d6..7ac29375 100644 --- a/lib/pages/routines/widgets/dragable_card.dart +++ b/lib/pages/routines/widgets/dragable_card.dart @@ -69,9 +69,9 @@ class DraggableCard extends StatelessWidget { Card( color: ColorsManager.whiteColors, child: Container( - padding: padding ?? const EdgeInsets.all(16), + padding: const EdgeInsets.all(16), width: 110, - height: deviceFunctions.isEmpty ? 160 : 170, + height: deviceFunctions.isEmpty ? 160 : 180, child: Column( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, @@ -103,16 +103,14 @@ class DraggableCard extends StatelessWidget { const SizedBox(height: 8), Padding( padding: const EdgeInsets.symmetric(horizontal: 3), - child: Flexible( - child: Text( - deviceData['title'] ?? deviceData['name'] ?? title, - textAlign: TextAlign.center, - overflow: TextOverflow.ellipsis, - maxLines: 2, - style: context.textTheme.bodySmall?.copyWith( - color: ColorsManager.blackColor, - fontSize: 12, - ), + child: Text( + deviceData['title'] ?? deviceData['name'] ?? title, + textAlign: TextAlign.center, + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: context.textTheme.bodySmall?.copyWith( + color: ColorsManager.blackColor, + fontSize: 12, ), ), ), @@ -131,7 +129,7 @@ class DraggableCard extends StatelessWidget { deviceData['tag'] ?? '', textAlign: TextAlign.center, overflow: TextOverflow.ellipsis, - maxLines: 2, + maxLines: 1, style: context.textTheme.bodySmall?.copyWith( color: ColorsManager.lightGreyColor, fontSize: 9, @@ -162,7 +160,7 @@ class DraggableCard extends StatelessWidget { deviceData['subSpace'] ?? '', textAlign: TextAlign.center, overflow: TextOverflow.ellipsis, - maxLines: 2, + maxLines: 1, style: context.textTheme.bodySmall?.copyWith( color: ColorsManager.lightGreyColor, fontSize: 9, diff --git a/lib/pages/routines/widgets/if_container.dart b/lib/pages/routines/widgets/if_container.dart index b65e99c7..007e4dc5 100644 --- a/lib/pages/routines/widgets/if_container.dart +++ b/lib/pages/routines/widgets/if_container.dart @@ -17,91 +17,86 @@ class IfContainer extends StatelessWidget { builder: (context, state) { return DragTarget>( builder: (context, candidateData, rejectedData) { - return Container( - width: double.infinity, - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - const Text('IF', - style: TextStyle( - fontSize: 18, fontWeight: FontWeight.bold)), - if (state.isAutomation && state.ifItems.isNotEmpty) - AutomationOperatorSelector( - selectedOperator: state.selectedAutomationOperator), - ], - ), - const SizedBox(height: 16), - if (state.isTabToRun) - const Row( - mainAxisAlignment: MainAxisAlignment.center, + return SingleChildScrollView( + child: Container( + width: double.infinity, + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - DraggableCard( - imagePath: Assets.tabToRun, - title: 'Tab to run', - deviceData: {}, - ), + const Text('IF', + style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)), + if (state.isAutomation && state.ifItems.isNotEmpty) + AutomationOperatorSelector( + selectedOperator: state.selectedAutomationOperator), ], ), - if (!state.isTabToRun) - Wrap( - spacing: 8, - runSpacing: 8, - children: List.generate( - state.ifItems.length, - (index) => GestureDetector( - onTap: () async { - if (!state.isTabToRun) { - final result = await DeviceDialogHelper - .showDeviceDialog( - context: context, - data: state.ifItems[index], - removeComparetors: false, - dialogType: "IF"); + const SizedBox(height: 16), + if (state.isTabToRun) + const Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + DraggableCard( + imagePath: Assets.tabToRun, + title: 'Tab to run', + deviceData: {}, + ), + ], + ), + if (!state.isTabToRun) + Wrap( + spacing: 8, + runSpacing: 8, + children: List.generate( + state.ifItems.length, + (index) => GestureDetector( + onTap: () async { + if (!state.isTabToRun) { + final result = await DeviceDialogHelper.showDeviceDialog( + context: context, + data: state.ifItems[index], + removeComparetors: false, + dialogType: "IF"); - if (result != null) { - context.read().add( - AddToIfContainer( - state.ifItems[index], false)); - } else if (![ - 'AC', - '1G', - '2G', - '3G', - 'WPS' - 'GW', - ].contains( - state.ifItems[index]['productType'])) { - context.read().add( - AddToIfContainer( - state.ifItems[index], false)); + if (result != null) { + context + .read() + .add(AddToIfContainer(state.ifItems[index], false)); + } else if (![ + 'AC', + '1G', + '2G', + '3G', + 'WPS' + 'GW', + ].contains(state.ifItems[index]['productType'])) { + context + .read() + .add(AddToIfContainer(state.ifItems[index], false)); + } } - } - }, - child: DraggableCard( - imagePath: - state.ifItems[index]['imagePath'] ?? '', - title: state.ifItems[index]['title'] ?? '', - deviceData: state.ifItems[index], - padding: const EdgeInsets.symmetric( - horizontal: 4, vertical: 8), - isFromThen: false, - isFromIf: true, - onRemove: () { - context.read().add( - RemoveDragCard( - index: index, - isFromThen: false, - key: state.ifItems[index] - ['uniqueCustomId'])); }, - ), - )), - ), - ], + child: DraggableCard( + imagePath: state.ifItems[index]['imagePath'] ?? '', + title: state.ifItems[index]['title'] ?? '', + deviceData: state.ifItems[index], + padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 8), + isFromThen: false, + isFromIf: true, + onRemove: () { + context.read().add(RemoveDragCard( + index: index, + isFromThen: false, + key: state.ifItems[index]['uniqueCustomId'])); + }, + ), + )), + ), + ], + ), ), ); }, @@ -116,9 +111,7 @@ class IfContainer extends StatelessWidget { if (!state.isTabToRun) { if (mutableData['deviceId'] == 'tab_to_run') { - context - .read() - .add(AddToIfContainer(mutableData, true)); + context.read().add(AddToIfContainer(mutableData, true)); } else { final result = await DeviceDialogHelper.showDeviceDialog( dialogType: 'IF', @@ -127,14 +120,10 @@ class IfContainer extends StatelessWidget { removeComparetors: false); if (result != null) { - context - .read() - .add(AddToIfContainer(mutableData, false)); + context.read().add(AddToIfContainer(mutableData, false)); } else if (!['AC', '1G', '2G', '3G', 'WPS', 'GW'] .contains(mutableData['productType'])) { - context - .read() - .add(AddToIfContainer(mutableData, false)); + context.read().add(AddToIfContainer(mutableData, false)); } } } @@ -180,9 +169,7 @@ class AutomationOperatorSelector extends StatelessWidget { ), ), onPressed: () { - context - .read() - .add(const ChangeAutomationOperator(operator: 'or')); + context.read().add(const ChangeAutomationOperator(operator: 'or')); }, ), Container( @@ -208,9 +195,7 @@ class AutomationOperatorSelector extends StatelessWidget { ), ), onPressed: () { - context - .read() - .add(const ChangeAutomationOperator(operator: 'and')); + context.read().add(const ChangeAutomationOperator(operator: 'and')); }, ), ], diff --git a/lib/pages/routines/widgets/main_routine_view/routine_view_card.dart b/lib/pages/routines/widgets/main_routine_view/routine_view_card.dart index 841ffa6e..7be5a959 100644 --- a/lib/pages/routines/widgets/main_routine_view/routine_view_card.dart +++ b/lib/pages/routines/widgets/main_routine_view/routine_view_card.dart @@ -121,8 +121,7 @@ class _RoutineViewCardState extends State { child: SizedBox( width: 16, height: 16, - child: - CircularProgressIndicator(strokeWidth: 2), + child: CircularProgressIndicator(strokeWidth: 2), ), ), ) @@ -159,9 +158,7 @@ class _RoutineViewCardState extends State { height: iconSize, width: iconSize, fit: BoxFit.contain, - errorBuilder: - (context, error, stackTrace) => - Image.asset( + errorBuilder: (context, error, stackTrace) => Image.asset( Assets.logo, height: iconSize, width: iconSize, @@ -174,8 +171,7 @@ class _RoutineViewCardState extends State { width: iconSize, fit: BoxFit.contain, ) - : (widget.icon is String && - widget.icon.endsWith('.svg')) + : (widget.icon is String && widget.icon.endsWith('.svg')) ? SvgPicture.asset( height: iconSize, width: iconSize, @@ -185,9 +181,7 @@ class _RoutineViewCardState extends State { : Icon( widget.icon, color: ColorsManager.dialogBlueTitle, - size: widget.isSmallScreenSize(context) - ? 30 - : 40, + size: widget.isSmallScreenSize(context) ? 30 : 40, ), ), ), @@ -200,11 +194,10 @@ class _RoutineViewCardState extends State { widget.textString, textAlign: TextAlign.center, overflow: TextOverflow.ellipsis, - maxLines: 2, + maxLines: 1, style: context.textTheme.bodySmall?.copyWith( color: ColorsManager.blackColor, - fontSize: - widget.isSmallScreenSize(context) ? 10 : 12, + fontSize: widget.isSmallScreenSize(context) ? 10 : 12, ), ), if (widget.spaceName != '') @@ -220,14 +213,10 @@ class _RoutineViewCardState extends State { widget.spaceName, textAlign: TextAlign.center, overflow: TextOverflow.ellipsis, - maxLines: 2, - style: - context.textTheme.bodySmall?.copyWith( + maxLines: 1, + style: context.textTheme.bodySmall?.copyWith( color: ColorsManager.blackColor, - fontSize: - widget.isSmallScreenSize(context) - ? 10 - : 12, + fontSize: widget.isSmallScreenSize(context) ? 10 : 12, ), ), ],