fix the string for motor without underscore

This commit is contained in:
Rafeek-Khoudare
2025-06-27 17:56:41 +03:00
parent e365aa3faa
commit 1d95915f57

View File

@ -69,7 +69,8 @@ class CurtainModulePrefrencesDialog extends StatelessWidget {
},
),
PrefReversCardWidget(
title: state.curtainModuleStatus.elecMachineryMode,
title: formatDeviceType(
state.curtainModuleStatus.elecMachineryMode),
body: 'Motor Mode',
onTap: () => context.read<CurtainModuleBloc>().add(
ChangeElecMachineryModeEvent(
@ -136,4 +137,13 @@ class CurtainModulePrefrencesDialog extends StatelessWidget {
),
);
}
String formatDeviceType(String raw) {
return raw
.split('_')
.map((word) => word.isNotEmpty
? '${word[0].toUpperCase()}${word.substring(1)}'
: '')
.join(' ');
}
}