mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-08-24 20:42:27 +00:00
Enhance garage door scheduling functionality and UI improvements
This commit is contained in:
@ -6,6 +6,7 @@ import 'package:syncrow_web/pages/device_managment/garage_door/bloc/garage_door_
|
||||
import 'package:syncrow_web/pages/device_managment/garage_door/helper/garage_door_helper.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/garage_door/models/garage_door_model.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/garage_door/schedule_view/schedule_garage_view.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/schedule_device/schedule_widgets/schedual_view.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/icon_name_status_container.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/table/report_table.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/shared/toggle_widget.dart';
|
||||
@ -94,11 +95,18 @@ class GarageDoorControlView extends StatelessWidget
|
||||
FetchGarageDoorSchedulesEvent(
|
||||
deviceId: deviceId, category: 'doorcontact_state'),
|
||||
);
|
||||
showDialog(
|
||||
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (ctx) => BlocProvider.value(
|
||||
value: BlocProvider.of<GarageDoorBloc>(context),
|
||||
child: BuildGarageDoorScheduleView(status: status),
|
||||
child: BuildScheduleView(
|
||||
deviceUuid: deviceId,
|
||||
category: 'Timer',
|
||||
code: 'doorcontact_state',
|
||||
countdownCode: 'Timer',
|
||||
deviceType: 'GD',
|
||||
),
|
||||
));
|
||||
},
|
||||
name: 'Scheduling',
|
||||
|
@ -287,7 +287,8 @@ class ScheduleBloc extends Bloc<ScheduleEvent, ScheduleState> {
|
||||
try {
|
||||
if (state is ScheduleLoaded) {
|
||||
Status status = Status(code: '', value: '');
|
||||
if (event.deviceType == 'CUR_2') {
|
||||
if (event.deviceType == 'CUR_2' ||
|
||||
event.deviceType == 'GD' ) {
|
||||
status = status.copyWith(
|
||||
code: 'control',
|
||||
value: event.functionOn == true ? 'open' : 'close');
|
||||
|
@ -69,7 +69,7 @@ class CountdownModeButtons extends StatelessWidget {
|
||||
countDownCode: countDownCode),
|
||||
);
|
||||
},
|
||||
backgroundColor: ColorsManager.primaryColorWithOpacity,
|
||||
backgroundColor: ColorsManager.secondaryColor,
|
||||
child: const Text('Save'),
|
||||
),
|
||||
),
|
||||
|
@ -63,7 +63,7 @@ class InchingModeButtons extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
},
|
||||
backgroundColor: ColorsManager.primaryColor,
|
||||
backgroundColor: ColorsManager.secondaryColor,
|
||||
child: const Text('Save'),
|
||||
),
|
||||
),
|
||||
|
@ -31,11 +31,12 @@ class BuildScheduleView extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (_) => ScheduleBloc(deviceId: deviceUuid,)
|
||||
create: (_) => ScheduleBloc(
|
||||
deviceId: deviceUuid,
|
||||
)
|
||||
..add(ScheduleGetEvent(category: category))
|
||||
..add(ScheduleFetchStatusEvent(
|
||||
deviceId: deviceUuid,
|
||||
countdownCode: countdownCode ?? '')),
|
||||
deviceId: deviceUuid, countdownCode: countdownCode ?? '')),
|
||||
child: Dialog(
|
||||
backgroundColor: Colors.white,
|
||||
insetPadding: const EdgeInsets.all(20),
|
||||
@ -56,7 +57,7 @@ class BuildScheduleView extends StatelessWidget {
|
||||
children: [
|
||||
const ScheduleHeader(),
|
||||
const SizedBox(height: 20),
|
||||
if (deviceType == 'CUR_2')
|
||||
if (deviceType == 'CUR_2' || deviceType == 'GD')
|
||||
const SizedBox()
|
||||
else
|
||||
ScheduleModeSelector(
|
||||
@ -76,8 +77,7 @@ class BuildScheduleView extends StatelessWidget {
|
||||
category: category,
|
||||
time: '',
|
||||
function: Status(
|
||||
code: code.toString(),
|
||||
value: true),
|
||||
code: code.toString(), value: true),
|
||||
days: [],
|
||||
),
|
||||
isEdit: false,
|
||||
@ -96,7 +96,7 @@ class BuildScheduleView extends StatelessWidget {
|
||||
}
|
||||
},
|
||||
),
|
||||
if (deviceType != 'CUR_2')
|
||||
if (deviceType != 'CUR_2'|| deviceType != 'GD')
|
||||
if (state.scheduleMode == ScheduleModes.countdown ||
|
||||
state.scheduleMode == ScheduleModes.inching)
|
||||
CountdownInchingView(
|
||||
|
@ -24,12 +24,13 @@ class ScheduleManagementUI extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 170,
|
||||
width: 177,
|
||||
height: 40,
|
||||
child: DefaultButton(
|
||||
borderColor: ColorsManager.grayColor.withOpacity(0.5),
|
||||
padding: 2,
|
||||
backgroundColor: ColorsManager.graysColor,
|
||||
borderWidth: 4,
|
||||
borderColor: ColorsManager.neutralGray,
|
||||
padding: 8,
|
||||
backgroundColor: ColorsManager.textFieldGreyColor,
|
||||
borderRadius: 15,
|
||||
onPressed: onAddSchedule,
|
||||
child: Row(
|
||||
|
@ -39,7 +39,7 @@ class ScheduleModeButtons extends StatelessWidget {
|
||||
borderRadius: 8,
|
||||
height: 40,
|
||||
onPressed: onSave,
|
||||
backgroundColor: ColorsManager.primaryColorWithOpacity,
|
||||
backgroundColor: ColorsManager.secondaryColor,
|
||||
child: const Text('Save'),
|
||||
),
|
||||
),
|
||||
|
@ -194,7 +194,7 @@ class _ScheduleTableView extends StatelessWidget {
|
||||
child: Text(_getSelectedDays(
|
||||
ScheduleModel.parseSelectedDays(schedule.days)))),
|
||||
Center(child: Text(formatIsoStringToTime(schedule.time, context))),
|
||||
if (deviceType == 'CUR_2')
|
||||
if (deviceType == 'CUR_2' || deviceType == 'GD')
|
||||
Center(
|
||||
child: Text(schedule.function.value == true ? 'open' : 'close'))
|
||||
else
|
||||
|
@ -23,7 +23,7 @@ class ScheduleDialogHelper {
|
||||
required String deviceType,
|
||||
}) {
|
||||
bool temp;
|
||||
if (deviceType == 'CUR_2') {
|
||||
if (deviceType == 'CUR_2' || deviceType == 'GD') {
|
||||
temp = schedule!.function.value == 'open' ? true : false;
|
||||
} else {
|
||||
temp = schedule!.function.value;
|
||||
@ -116,7 +116,7 @@ class ScheduleDialogHelper {
|
||||
ScheduleModeButtons(
|
||||
onSave: () {
|
||||
dynamic temp;
|
||||
if (deviceType == 'CUR_2') {
|
||||
if (deviceType == 'CUR_2' || deviceType == 'GD') {
|
||||
temp = functionOn! ? 'open' : 'close';
|
||||
} else {
|
||||
temp = functionOn;
|
||||
@ -202,18 +202,23 @@ class ScheduleDialogHelper {
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Radio<bool>(
|
||||
activeColor: ColorsManager.secondaryColor,
|
||||
focusColor: ColorsManager.secondaryColor,
|
||||
value: true,
|
||||
groupValue: isOn,
|
||||
onChanged: (val) => onChanged(true),
|
||||
),
|
||||
Text(categor == 'CUR_2' ? 'open' : 'On'),
|
||||
Text(categor == 'CUR_2' || categor == 'GD' ? 'open' : 'On'),
|
||||
const SizedBox(width: 10),
|
||||
Radio<bool>(
|
||||
activeColor: ColorsManager.secondaryColor,
|
||||
focusColor: ColorsManager.secondaryColor,
|
||||
|
||||
value: false,
|
||||
groupValue: isOn,
|
||||
onChanged: (val) => onChanged(false),
|
||||
),
|
||||
Text(categor == 'CUR_2' ? 'close' : 'Off'),
|
||||
Text(categor == 'CUR_2' || categor == 'GDCUR_2' ? 'close' : 'Off'),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user