mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-25 00:47:56 +00:00
fixes bugs and add project id staging
This commit is contained in:
@@ -43,6 +43,7 @@ class AcInterfaceControls extends StatelessWidget {
|
||||
PageRouteBuilder(
|
||||
pageBuilder: (context, animation1, animation2) =>
|
||||
AcTimerPage(
|
||||
deviceStatus: deviceStatus,
|
||||
device: deviceModel,
|
||||
deviceCode: deviceModel.type!,
|
||||
switchCode: '',
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'package:syncrow_app/features/devices/bloc/6_scene_switch_bloc/6_scene_st
|
||||
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_bloc.dart';
|
||||
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_event.dart';
|
||||
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_state.dart';
|
||||
|
||||
import 'package:syncrow_app/features/devices/model/ac_model.dart';
|
||||
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/ACs/custom_halfhour_timer_picker.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
|
||||
@@ -20,10 +20,13 @@ class AcTimerPage extends StatelessWidget {
|
||||
final DeviceModel device;
|
||||
final String deviceCode;
|
||||
final String switchCode;
|
||||
final AcStatusModel deviceStatus;
|
||||
|
||||
const AcTimerPage(
|
||||
{required this.device,
|
||||
required this.deviceCode,
|
||||
required this.switchCode,
|
||||
required this.deviceStatus,
|
||||
super.key});
|
||||
|
||||
@override
|
||||
@@ -37,27 +40,24 @@ class AcTimerPage extends StatelessWidget {
|
||||
create: (context) => ACsBloc(acId: device.uuid ?? ''),
|
||||
child: BlocBuilder<ACsBloc, AcsState>(
|
||||
builder: (context, state) {
|
||||
final oneGangBloc = BlocProvider.of<ACsBloc>(context);
|
||||
final acBloc = BlocProvider.of<ACsBloc>(context);
|
||||
Duration duration = Duration.zero;
|
||||
int selectedValue = 0;
|
||||
|
||||
int countNum = 0;
|
||||
if (state is UpdateTimerState) {
|
||||
if (state is AcsInitialState) {
|
||||
acBloc.add(GetCounterEvent(deviceCode: deviceCode));
|
||||
} else if (state is UpdateTimerState) {
|
||||
countNum = state.seconds;
|
||||
} else if (state is TimerRunInProgress) {
|
||||
countNum = state.remainingTime;
|
||||
} else if (state is TimerRunComplete) {
|
||||
countNum = 0;
|
||||
}
|
||||
// else if (state is LoadingNewSate) {
|
||||
// countNum = 0;
|
||||
// }
|
||||
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
onPopInvoked: (didPop) {
|
||||
if (!didPop) {
|
||||
oneGangBloc.add(OnClose());
|
||||
acBloc.add(OnClose());
|
||||
Navigator.pop(context);
|
||||
}
|
||||
},
|
||||
@@ -90,7 +90,7 @@ class AcTimerPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Center(
|
||||
child: Container(
|
||||
child: SizedBox(
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
@@ -102,7 +102,7 @@ class AcTimerPage extends StatelessWidget {
|
||||
.slidingBlueColor,
|
||||
fontSize: 40,
|
||||
)
|
||||
: Container(
|
||||
: SizedBox(
|
||||
child: CustomHalfHourPicker(
|
||||
onValueChanged: (value) {
|
||||
selectedValue =
|
||||
@@ -120,8 +120,6 @@ class AcTimerPage extends StatelessWidget {
|
||||
countNum =
|
||||
duration.inSeconds;
|
||||
}
|
||||
print(
|
||||
"Selected Value: $selectedValue, Duration: $duration");
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -131,12 +129,14 @@ class AcTimerPage extends StatelessWidget {
|
||||
return;
|
||||
}
|
||||
if (countNum > 0) {
|
||||
oneGangBloc.add(SetCounterValue(
|
||||
acBloc.add(SetCounterValue(
|
||||
seconds: countNum,
|
||||
deviceCode:'countdown_time',
|
||||
deviceCode:
|
||||
'countdown_time',
|
||||
duration: selectedValue));
|
||||
} else if (duration != Duration.zero) {
|
||||
oneGangBloc.add(SetCounterValue(
|
||||
} else if (duration !=
|
||||
Duration.zero) {
|
||||
acBloc.add(SetCounterValue(
|
||||
seconds: 0,
|
||||
deviceCode:
|
||||
'countdown_time',
|
||||
|
||||
@@ -4,7 +4,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_bloc.dart';
|
||||
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_event.dart';
|
||||
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_state.dart';
|
||||
import 'package:syncrow_app/features/devices/model/ac_model.dart';
|
||||
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/ACs/ac_interface.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/ACs/acs_list.dart';
|
||||
@@ -23,8 +22,6 @@ class ACsView extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
print("ACsView deviceModel UUID: ${deviceModel?.uuid}");
|
||||
|
||||
return BlocProvider(
|
||||
create: (context) => ACsBloc(acId: deviceModel?.uuid ?? '')
|
||||
..add(AcsInitial(allAcs: deviceModel != null ? false : true)),
|
||||
@@ -41,7 +38,6 @@ class ACsView extends StatelessWidget {
|
||||
extendBody: true,
|
||||
appBar: deviceModel != null
|
||||
? DeviceAppbar(
|
||||
//BlocProvider.of<ACsBloc>(context).deviceStatus.acSwitch.toString()
|
||||
value: true,
|
||||
deviceName: deviceModel!.name!,
|
||||
deviceUuid: deviceModel!.uuid!,
|
||||
|
||||
Reference in New Issue
Block a user