From 2e4f904d3a84388a9554f768e4d21b5298192ab9 Mon Sep 17 00:00:00 2001 From: Faris Armoush Date: Thu, 17 Apr 2025 14:39:33 +0300 Subject: [PATCH] style: improve code formatting and readability in SaveRoutineHelper --- .../routines/helper/save_routine_helper.dart | 45 ++++++++++++------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/lib/pages/routines/helper/save_routine_helper.dart b/lib/pages/routines/helper/save_routine_helper.dart index 0750ba07..e9d870d9 100644 --- a/lib/pages/routines/helper/save_routine_helper.dart +++ b/lib/pages/routines/helper/save_routine_helper.dart @@ -31,8 +31,10 @@ class SaveRoutineHelper { children: [ DialogHeader('Create a scene: ${state.routineName ?? ""}'), Padding( - padding: - const EdgeInsets.symmetric(horizontal: 16, vertical: 8), + padding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 8, + ), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -56,7 +58,7 @@ class SaveRoutineHelper { static DialogFooter _buildDialogFooter(BuildContext context, RoutineState state) { return DialogFooter( onCancel: () => Navigator.pop(context), - onConfirm: () async { + onConfirm: () { if (state.isAutomation) { if (state.isUpdate ?? false) { context.read().add(const UpdateAutomation()); @@ -101,7 +103,6 @@ class SaveRoutineHelper { static Expanded _buildIfConditions(RoutineState state, BuildContext context) { return Expanded( child: ListView( - // crossAxisAlignment: CrossAxisAlignment.start, shrinkWrap: true, children: [ const Text( @@ -193,13 +194,17 @@ class SaveRoutineHelper { runSpacing: 16, spacing: 4, children: functions - .map((f) => Text( - '${f.operationName}: ${f.value}', - style: context.textTheme.bodySmall?.copyWith( - color: ColorsManager.grayColor, fontSize: 8), - overflow: TextOverflow.ellipsis, - maxLines: 3, - )) + .map( + (function) => Text( + '${function.operationName}: ${function.value}', + style: context.textTheme.bodySmall?.copyWith( + color: ColorsManager.grayColor, + fontSize: 8, + ), + overflow: TextOverflow.ellipsis, + maxLines: 3, + ), + ) .toList(), ), ], @@ -219,9 +224,12 @@ class SaveRoutineHelper { spacing: 2, children: [ SizedBox( - width: 8, - height: 8, - child: SvgPicture.asset(Assets.deviceTagIcon)), + width: 8, + height: 8, + child: SvgPicture.asset( + Assets.deviceTagIcon, + ), + ), Text( item['tag'] ?? '', textAlign: TextAlign.center, @@ -242,9 +250,12 @@ class SaveRoutineHelper { spacing: 2, children: [ SizedBox( - width: 8, - height: 8, - child: SvgPicture.asset(Assets.spaceLocationIcon)), + width: 8, + height: 8, + child: SvgPicture.asset( + Assets.spaceLocationIcon, + ), + ), Text( item['subSpace'] ?? '', textAlign: TextAlign.center,