style: improve code formatting and readability in SaveRoutineHelper

This commit is contained in:
Faris Armoush
2025-04-17 14:39:33 +03:00
parent c46cfb48a8
commit 2e4f904d3a

View File

@ -31,8 +31,10 @@ class SaveRoutineHelper {
children: [ children: [
DialogHeader('Create a scene: ${state.routineName ?? ""}'), DialogHeader('Create a scene: ${state.routineName ?? ""}'),
Padding( Padding(
padding: padding: const EdgeInsets.symmetric(
const EdgeInsets.symmetric(horizontal: 16, vertical: 8), horizontal: 16,
vertical: 8,
),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -56,7 +58,7 @@ class SaveRoutineHelper {
static DialogFooter _buildDialogFooter(BuildContext context, RoutineState state) { static DialogFooter _buildDialogFooter(BuildContext context, RoutineState state) {
return DialogFooter( return DialogFooter(
onCancel: () => Navigator.pop(context), onCancel: () => Navigator.pop(context),
onConfirm: () async { onConfirm: () {
if (state.isAutomation) { if (state.isAutomation) {
if (state.isUpdate ?? false) { if (state.isUpdate ?? false) {
context.read<RoutineBloc>().add(const UpdateAutomation()); context.read<RoutineBloc>().add(const UpdateAutomation());
@ -101,7 +103,6 @@ class SaveRoutineHelper {
static Expanded _buildIfConditions(RoutineState state, BuildContext context) { static Expanded _buildIfConditions(RoutineState state, BuildContext context) {
return Expanded( return Expanded(
child: ListView( child: ListView(
// crossAxisAlignment: CrossAxisAlignment.start,
shrinkWrap: true, shrinkWrap: true,
children: [ children: [
const Text( const Text(
@ -193,13 +194,17 @@ class SaveRoutineHelper {
runSpacing: 16, runSpacing: 16,
spacing: 4, spacing: 4,
children: functions children: functions
.map((f) => Text( .map(
'${f.operationName}: ${f.value}', (function) => Text(
style: context.textTheme.bodySmall?.copyWith( '${function.operationName}: ${function.value}',
color: ColorsManager.grayColor, fontSize: 8), style: context.textTheme.bodySmall?.copyWith(
overflow: TextOverflow.ellipsis, color: ColorsManager.grayColor,
maxLines: 3, fontSize: 8,
)) ),
overflow: TextOverflow.ellipsis,
maxLines: 3,
),
)
.toList(), .toList(),
), ),
], ],
@ -219,9 +224,12 @@ class SaveRoutineHelper {
spacing: 2, spacing: 2,
children: [ children: [
SizedBox( SizedBox(
width: 8, width: 8,
height: 8, height: 8,
child: SvgPicture.asset(Assets.deviceTagIcon)), child: SvgPicture.asset(
Assets.deviceTagIcon,
),
),
Text( Text(
item['tag'] ?? '', item['tag'] ?? '',
textAlign: TextAlign.center, textAlign: TextAlign.center,
@ -242,9 +250,12 @@ class SaveRoutineHelper {
spacing: 2, spacing: 2,
children: [ children: [
SizedBox( SizedBox(
width: 8, width: 8,
height: 8, height: 8,
child: SvgPicture.asset(Assets.spaceLocationIcon)), child: SvgPicture.asset(
Assets.spaceLocationIcon,
),
),
Text( Text(
item['subSpace'] ?? '', item['subSpace'] ?? '',
textAlign: TextAlign.center, textAlign: TextAlign.center,