Merge pull request #100 from SyncrowIOT/fix-flush-bugs

fix flush bugs
This commit is contained in:
mohammadnemer1
2025-05-13 10:51:06 +03:00
committed by GitHub
4 changed files with 7 additions and 8 deletions

View File

@ -22,7 +22,7 @@ class FlushSensorBloc extends Bloc<FlushSensorEvent, FlushSensorState> {
on<FlushSensorChangeValueEvent>(_changeValue);
on<FlushSensorUpdatedEvent>(_flushSensorUpdated);
on<FlushSensorGetDeviceReportsEvent>(_getDeviceReports);
on<FlushSensorInitialDeviseInfo>(fetchDeviceInfo);
on<FlushSensorInitialDeviceInfo>(fetchDeviceInfo);
}
void _fetchFlushSensorStatus(
@ -163,7 +163,7 @@ class FlushSensorBloc extends Bloc<FlushSensorEvent, FlushSensorState> {
);
static String deviceName = '';
void fetchDeviceInfo(FlushSensorInitialDeviseInfo event,
void fetchDeviceInfo(FlushSensorInitialDeviceInfo event,
Emitter<FlushSensorState> emit) async {
try {
emit(FlushSensorLoadingInitialState());

View File

@ -11,7 +11,7 @@ class FlushSensorLoadingEvent extends FlushSensorEvent {}
class FlushSensorInitialEvent extends FlushSensorEvent {}
class FlushSensorInitialDeviseInfo extends FlushSensorEvent {}
class FlushSensorInitialDeviceInfo extends FlushSensorEvent {}
class FlushSensorUpdatedEvent extends FlushSensorEvent {}

View File

@ -9,7 +9,6 @@ import 'package:syncrow_app/features/devices/bloc/flush_sensor_bloc/flush_sensor
import 'package:syncrow_app/features/devices/model/device_model.dart';
import 'package:syncrow_app/features/devices/model/flush_sensor_model.dart';
import 'package:syncrow_app/features/devices/view/device_settings/settings_page.dart';
import 'package:syncrow_app/features/devices/view/widgets/device_appbar.dart';
import 'package:syncrow_app/features/devices/view/widgets/flush_sensor/flush_persence_records.dart';
import 'package:syncrow_app/features/devices/view/widgets/flush_sensor/flush_sensor_option.dart';
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
@ -20,7 +19,6 @@ import 'package:syncrow_app/utils/context_extension.dart';
import 'package:syncrow_app/utils/helpers/misc_string_helpers.dart';
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
import 'package:syncrow_app/utils/resource_manager/constants.dart';
import 'package:syncrow_app/utils/resource_manager/font_manager.dart';
part "presence_indicator.dart";
part "flush_sensor_options_list.dart";
@ -33,7 +31,8 @@ class FlushMountedInterface extends StatelessWidget {
Widget build(BuildContext context) {
return BlocProvider(
create: (context) => FlushSensorBloc(deviceId: deviceModel.uuid ?? '')
..add(FlushSensorInitialEvent()),
..add(FlushSensorInitialEvent())
..add(FlushSensorInitialDeviceInfo()),
child: BlocBuilder<FlushSensorBloc, FlushSensorState>(
builder: (context, state) {
final bloc = BlocProvider.of<FlushSensorBloc>(context);
@ -72,7 +71,7 @@ class FlushMountedInterface extends StatelessWidget {
),
);
if (val == null) {
bloc.add(FlushSensorInitialDeviseInfo());
bloc.add(FlushSensorInitialDeviceInfo());
bloc.add(FlushSensorInitialEvent());
}
},

View File

@ -579,7 +579,7 @@ class DevicesAPI {
.replaceAll('{code}', code),
showServerMessage: false,
expectedResponseModel: (json) {
return DeviceReport.fromJson(json);
return DeviceReport.fromJson(json['data'] as Map<String, dynamic>);
},
);
return response;