mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-27 21:54:55 +00:00
Changed the action executor of the tab to run scenes and changed the order of the effective days
This commit is contained in:
@ -13,16 +13,7 @@ class RepeatDays extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final daysMap = {
|
||||
'Mon': 'M',
|
||||
'Tue': 'T',
|
||||
'Wed': 'W',
|
||||
'Thu': 'T',
|
||||
'Fri': 'F',
|
||||
'Sat': 'S',
|
||||
'Sun': 'S',
|
||||
};
|
||||
|
||||
final effectiveBloc = context.read<EffectPeriodBloc>();
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
@ -37,25 +28,22 @@ class RepeatDays extends StatelessWidget {
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: daysMap.entries.map((entry) {
|
||||
children: effectiveBloc.daysMap.entries.map((entry) {
|
||||
final day = entry.key;
|
||||
final abbreviation = entry.value;
|
||||
final dayIndex = _getDayIndex(day);
|
||||
final isSelected =
|
||||
state.selectedDaysBinary[dayIndex] == '1';
|
||||
final dayIndex = effectiveBloc.getDayIndex(day);
|
||||
final isSelected = state.selectedDaysBinary[dayIndex] == '1';
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 3.0),
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
context.read<EffectPeriodBloc>().add(ToggleDay(day));
|
||||
effectiveBloc.add(ToggleDay(day));
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
color: isSelected
|
||||
? Colors.grey
|
||||
: Colors.grey.shade300,
|
||||
color: isSelected ? Colors.grey : Colors.grey.shade300,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
@ -66,9 +54,7 @@ class RepeatDays extends StatelessWidget {
|
||||
abbreviation,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: isSelected
|
||||
? Colors.grey
|
||||
: Colors.grey.shade300,
|
||||
color: isSelected ? Colors.grey : Colors.grey.shade300,
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -83,8 +69,7 @@ class RepeatDays extends StatelessWidget {
|
||||
if (state.selectedDaysBinary == '0000000')
|
||||
BodySmall(
|
||||
text: 'At least one day must be selected',
|
||||
style:
|
||||
context.bodyMedium.copyWith(color: ColorsManager.red),
|
||||
style: context.bodyMedium.copyWith(color: ColorsManager.red),
|
||||
),
|
||||
],
|
||||
);
|
||||
@ -93,9 +78,4 @@ class RepeatDays extends StatelessWidget {
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
int _getDayIndex(String day) {
|
||||
const days = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
|
||||
return days.indexOf(day);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user