mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 09:45:22 +00:00
four_scene
This commit is contained in:
@ -1,5 +1,4 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
@ -12,9 +11,11 @@ import 'package:syncrow_app/features/devices/model/four_scene_question_model.dar
|
|||||||
import 'package:syncrow_app/features/devices/model/group_devices_model.dart';
|
import 'package:syncrow_app/features/devices/model/group_devices_model.dart';
|
||||||
import 'package:syncrow_app/features/devices/model/scene_switch_model.dart';
|
import 'package:syncrow_app/features/devices/model/scene_switch_model.dart';
|
||||||
import 'package:syncrow_app/features/devices/model/status_model.dart';
|
import 'package:syncrow_app/features/devices/model/status_model.dart';
|
||||||
|
import 'package:syncrow_app/features/devices/model/subspace_model.dart';
|
||||||
import 'package:syncrow_app/features/scene/model/scenes_model.dart';
|
import 'package:syncrow_app/features/scene/model/scenes_model.dart';
|
||||||
import 'package:syncrow_app/generated/assets.dart';
|
import 'package:syncrow_app/generated/assets.dart';
|
||||||
import 'package:syncrow_app/services/api/devices_api.dart';
|
import 'package:syncrow_app/services/api/devices_api.dart';
|
||||||
|
import 'package:syncrow_app/services/api/home_management_api.dart';
|
||||||
import 'package:syncrow_app/services/api/scene_api.dart';
|
import 'package:syncrow_app/services/api/scene_api.dart';
|
||||||
import 'package:syncrow_app/services/api/spaces_api.dart';
|
import 'package:syncrow_app/services/api/spaces_api.dart';
|
||||||
|
|
||||||
@ -34,19 +35,22 @@ class FourSceneBloc extends Bloc<FourSceneEvent, FourSceneState> {
|
|||||||
on<LoadScenes>(_onLoadScenes);
|
on<LoadScenes>(_onLoadScenes);
|
||||||
on<SelectSceneEvent>(_selectScene);
|
on<SelectSceneEvent>(_selectScene);
|
||||||
on<SearchScenesEvent>(searchScene);
|
on<SearchScenesEvent>(searchScene);
|
||||||
on<SaveSelectionEvent>(_onSaveSelection);
|
on<AssignRoomEvent>(_assignDevice);
|
||||||
on<SelectOptionEvent>(_onOptionSelected);
|
on<SelectOptionEvent>(_onOptionSelected);
|
||||||
on<AddDeviceToGroup>(_addDeviceToGroup); // Register handler here
|
on<AddDeviceToGroup>(_addDeviceToGroup);
|
||||||
on<RemoveDeviceFromGroup>(_removeDeviceFromGroup);
|
on<RemoveDeviceFromGroup>(_removeDeviceFromGroup);
|
||||||
|
on<FourSceneInitialQuestion>(_onFourSceneInitial);
|
||||||
}
|
}
|
||||||
|
|
||||||
final TextEditingController nameController =
|
final TextEditingController nameController =
|
||||||
TextEditingController(text: '${'firstName'}');
|
TextEditingController(text: deviceName);
|
||||||
bool isSaving = false;
|
bool isSaving = false;
|
||||||
bool editName = false;
|
bool editName = false;
|
||||||
final FocusNode focusNode = FocusNode();
|
final FocusNode focusNode = FocusNode();
|
||||||
bool closingReminder = false;
|
bool closingReminder = false;
|
||||||
bool waterAlarm = false;
|
bool waterAlarm = false;
|
||||||
|
static String deviceName = '';
|
||||||
|
static String selectedRoomId = '';
|
||||||
|
|
||||||
FourSceneModel deviceStatus = FourSceneModel(
|
FourSceneModel deviceStatus = FourSceneModel(
|
||||||
scene_1: '',
|
scene_1: '',
|
||||||
@ -56,11 +60,11 @@ class FourSceneBloc extends Bloc<FourSceneEvent, FourSceneState> {
|
|||||||
scene_id_group_id: '',
|
scene_id_group_id: '',
|
||||||
switch_backlight: false);
|
switch_backlight: false);
|
||||||
|
|
||||||
SceneSwitch sceneInfo = SceneSwitch(
|
SceneSwitch deviceInfo = SceneSwitch(
|
||||||
activeTime: 1728118263,
|
activeTime: 0,
|
||||||
category: "",
|
category: "",
|
||||||
categoryName: "",
|
categoryName: "",
|
||||||
createTime: 1728118263,
|
createTime: 0,
|
||||||
gatewayId: "",
|
gatewayId: "",
|
||||||
icon: "",
|
icon: "",
|
||||||
ip: "",
|
ip: "",
|
||||||
@ -70,10 +74,10 @@ class FourSceneBloc extends Bloc<FourSceneEvent, FourSceneState> {
|
|||||||
model: "",
|
model: "",
|
||||||
name: "",
|
name: "",
|
||||||
nodeId: "",
|
nodeId: "",
|
||||||
online: true,
|
online: false,
|
||||||
ownerId: "",
|
ownerId: "",
|
||||||
productName: "",
|
productName: "",
|
||||||
sub: true,
|
sub: false,
|
||||||
timeZone: "",
|
timeZone: "",
|
||||||
updateTime: 0,
|
updateTime: 0,
|
||||||
uuid: "",
|
uuid: "",
|
||||||
@ -102,7 +106,6 @@ class FourSceneBloc extends Bloc<FourSceneEvent, FourSceneState> {
|
|||||||
statusModelList,
|
statusModelList,
|
||||||
);
|
);
|
||||||
emit(UpdateState(sensor: deviceStatus));
|
emit(UpdateState(sensor: deviceStatus));
|
||||||
|
|
||||||
Future.delayed(const Duration(milliseconds: 500));
|
Future.delayed(const Duration(milliseconds: 500));
|
||||||
// _listenToChanges();
|
// _listenToChanges();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -115,13 +118,9 @@ class FourSceneBloc extends Bloc<FourSceneEvent, FourSceneState> {
|
|||||||
FourSceneInitialInfo event, Emitter<FourSceneState> emit) async {
|
FourSceneInitialInfo event, Emitter<FourSceneState> emit) async {
|
||||||
emit(FourSceneLoadingState());
|
emit(FourSceneLoadingState());
|
||||||
var response = await DevicesAPI.getDeviceInfo(fourSceneId);
|
var response = await DevicesAPI.getDeviceInfo(fourSceneId);
|
||||||
if (response.statusCode == 200) {
|
deviceInfo = SceneSwitch.fromJson(response);
|
||||||
Map<String, dynamic> jsonData = jsonDecode(response.body);
|
deviceName = deviceInfo.name;
|
||||||
sceneInfo = SceneSwitch.fromJson(jsonData);
|
emit(LoadingDeviceInfo(deviceInfo: deviceInfo));
|
||||||
emit(LoadingDeviceInfo(sosSensor: sceneInfo));
|
|
||||||
} else {
|
|
||||||
throw Exception('Failed to load device data: ${response.reasonPhrase}');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onSearchFaq(SearchFaqEvent event, Emitter<FourSceneState> emit) {
|
void _onSearchFaq(SearchFaqEvent event, Emitter<FourSceneState> emit) {
|
||||||
@ -131,8 +130,6 @@ class FourSceneBloc extends Bloc<FourSceneEvent, FourSceneState> {
|
|||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.contains(event.query.toLowerCase());
|
.contains(event.query.toLowerCase());
|
||||||
}).toList();
|
}).toList();
|
||||||
|
|
||||||
print(_faqQuestions);
|
|
||||||
emit(FaqSearchState(filteredFaqQuestions: _faqQuestions));
|
emit(FaqSearchState(filteredFaqQuestions: _faqQuestions));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,7 +152,6 @@ class FourSceneBloc extends Bloc<FourSceneEvent, FourSceneState> {
|
|||||||
try {
|
try {
|
||||||
closingReminder = event.isClosingEnabled;
|
closingReminder = event.isClosingEnabled;
|
||||||
emit(UpdateState(sensor: deviceStatus));
|
emit(UpdateState(sensor: deviceStatus));
|
||||||
|
|
||||||
// API call to update the state, if necessary
|
// API call to update the state, if necessary
|
||||||
// await DevicesAPI.controlDevice(
|
// await DevicesAPI.controlDevice(
|
||||||
// DeviceControlModel(
|
// DeviceControlModel(
|
||||||
@ -235,13 +231,15 @@ class FourSceneBloc extends Bloc<FourSceneEvent, FourSceneState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<DeviceModel> allDevices = [];
|
List<DeviceModel> allDevices = [];
|
||||||
|
List<SubSpaceModel> roomsList = [];
|
||||||
|
|
||||||
void _fetchRoomsAndDevices(
|
void _fetchRoomsAndDevices(
|
||||||
FetchRoomsEvent event, Emitter<FourSceneState> emit) async {
|
FetchRoomsEvent event, Emitter<FourSceneState> emit) async {
|
||||||
try {
|
try {
|
||||||
emit(FourSceneLoadingState());
|
emit(FourSceneLoadingState());
|
||||||
final roomsList = await SpacesAPI.getSubSpaceBySpaceId(
|
roomsList = await SpacesAPI.getSubSpaceBySpaceId(
|
||||||
event.unit.community.uuid, event.unit.id);
|
event.unit.community.uuid, event.unit.id);
|
||||||
|
print(roomsList);
|
||||||
emit(FetchRoomsState(devicesList: allDevices, roomsList: roomsList));
|
emit(FetchRoomsState(devicesList: allDevices, roomsList: roomsList));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit(const FourSceneFailedState(errorMessage: 'Something went wrong'));
|
emit(const FourSceneFailedState(errorMessage: 'Something went wrong'));
|
||||||
@ -257,8 +255,6 @@ class FourSceneBloc extends Bloc<FourSceneEvent, FourSceneState> {
|
|||||||
emit(ChangeSwitchState(isEnable: switchStatus));
|
emit(ChangeSwitchState(isEnable: switchStatus));
|
||||||
}
|
}
|
||||||
|
|
||||||
// List<ScenesModel> allScenes = [];
|
|
||||||
|
|
||||||
Future<void> _onLoadScenes(
|
Future<void> _onLoadScenes(
|
||||||
LoadScenes event, Emitter<FourSceneState> emit) async {
|
LoadScenes event, Emitter<FourSceneState> emit) async {
|
||||||
emit(FourSceneLoadingState());
|
emit(FourSceneLoadingState());
|
||||||
@ -314,16 +310,6 @@ class FourSceneBloc extends Bloc<FourSceneEvent, FourSceneState> {
|
|||||||
hasSelectionChanged: _hasSelectionChanged));
|
hasSelectionChanged: _hasSelectionChanged));
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onSaveSelection(
|
|
||||||
SaveSelectionEvent event, Emitter<FourSceneState> emit) {
|
|
||||||
if (_hasSelectionChanged) {
|
|
||||||
print('Save button clicked with selected option: $_selectedOption');
|
|
||||||
_hasSelectionChanged = false;
|
|
||||||
emit(SaveSelectionSuccessState());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//addDevicesIcon
|
|
||||||
List<GroupDevicesModel> groupDevices = [
|
List<GroupDevicesModel> groupDevices = [
|
||||||
GroupDevicesModel(
|
GroupDevicesModel(
|
||||||
dec: 'Syncroom', icon: Assets.minusIcon, name: '6 Scene Switch')
|
dec: 'Syncroom', icon: Assets.minusIcon, name: '6 Scene Switch')
|
||||||
@ -367,4 +353,28 @@ class FourSceneBloc extends Bloc<FourSceneEvent, FourSceneState> {
|
|||||||
}
|
}
|
||||||
emit(UpdateStateList(groupDevices: groupDevices, devices: devices));
|
emit(UpdateStateList(groupDevices: groupDevices, devices: devices));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _assignDevice(
|
||||||
|
AssignRoomEvent event, Emitter<FourSceneState> emit) async {
|
||||||
|
try {
|
||||||
|
emit(FourSceneLoadingState());
|
||||||
|
if (_hasSelectionChanged) {
|
||||||
|
await HomeManagementAPI.assignDeviceToRoom(event.unit.community.uuid,
|
||||||
|
event.unit.id, event.roomId, fourSceneId);
|
||||||
|
final devicesList = await DevicesAPI.getDevicesByRoomId(
|
||||||
|
communityUuid: event.unit.community.uuid,
|
||||||
|
spaceUuid: event.unit.id,
|
||||||
|
roomId: event.roomId);
|
||||||
|
List<String> allDevicesIds = [];
|
||||||
|
allDevices.forEach((element) {
|
||||||
|
allDevicesIds.add(element.uuid!);
|
||||||
|
});
|
||||||
|
emit(SaveSelectionSuccessState());
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
emit(const FourSceneFailedState(errorMessage: 'Something went wrong'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ class SearchScenesEvent extends FourSceneEvent {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
class SaveSelectionEvent extends FourSceneEvent {}
|
class SaveLocationSelectionEvent extends FourSceneEvent {}
|
||||||
|
|
||||||
class SelectOptionEvent extends FourSceneEvent {
|
class SelectOptionEvent extends FourSceneEvent {
|
||||||
dynamic selectedOption;
|
dynamic selectedOption;
|
||||||
@ -172,3 +172,20 @@ class RemoveDeviceFromGroup extends FourSceneEvent {
|
|||||||
|
|
||||||
RemoveDeviceFromGroup(this.device, this.icon);
|
RemoveDeviceFromGroup(this.device, this.icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class AssignRoomEvent extends FourSceneEvent {
|
||||||
|
final String roomId;
|
||||||
|
final SpaceModel unit;
|
||||||
|
|
||||||
|
const AssignRoomEvent({
|
||||||
|
required this.roomId,
|
||||||
|
required this.unit,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [
|
||||||
|
roomId,
|
||||||
|
unit,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
@ -115,9 +115,9 @@ class OptionSelectedState extends FourSceneState {
|
|||||||
|
|
||||||
|
|
||||||
class LoadingDeviceInfo extends FourSceneState {
|
class LoadingDeviceInfo extends FourSceneState {
|
||||||
final SceneSwitch sosSensor;
|
final SceneSwitch deviceInfo;
|
||||||
const LoadingDeviceInfo({required this.sosSensor});
|
const LoadingDeviceInfo({required this.deviceInfo});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [sosSensor];
|
List<Object> get props => [deviceInfo];
|
||||||
}
|
}
|
@ -1,11 +1,11 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:syncrow_app/features/devices/bloc/6_scene_switch_bloc/6_scene_bloc.dart';
|
import 'package:syncrow_app/features/devices/bloc/four_scene_bloc/four_scene_bloc.dart';
|
||||||
import 'package:syncrow_app/features/devices/bloc/6_scene_switch_bloc/6_scene_event.dart';
|
import 'package:syncrow_app/features/devices/bloc/four_scene_bloc/four_scene_event.dart';
|
||||||
import 'package:syncrow_app/features/devices/bloc/6_scene_switch_bloc/6_scene_state.dart';
|
import 'package:syncrow_app/features/devices/bloc/four_scene_bloc/four_scene_state.dart';
|
||||||
|
|
||||||
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
||||||
import 'package:syncrow_app/features/devices/model/six_scene_model.dart';
|
import 'package:syncrow_app/features/devices/model/four_scene_model.dart';
|
||||||
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
||||||
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
|
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
|
||||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
|
||||||
@ -13,29 +13,35 @@ import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dar
|
|||||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart';
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart';
|
||||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||||
|
|
||||||
class SixSceneInfoPage extends StatelessWidget {
|
class FourSceneInfoPage extends StatelessWidget {
|
||||||
final DeviceModel? device;
|
final DeviceModel? device;
|
||||||
|
|
||||||
const SixSceneInfoPage({super.key, this.device});
|
const FourSceneInfoPage({super.key, this.device});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return DefaultScaffold(
|
return DefaultScaffold(
|
||||||
title: 'Device Information',
|
title: 'Device Information',
|
||||||
child: BlocProvider(
|
child: BlocProvider(
|
||||||
create: (context) => SixSceneBloc(sixSceneId: device?.uuid ?? '')
|
create: (context) => FourSceneBloc(fourSceneId: device?.uuid ?? '')
|
||||||
..add(const SixSceneInitial()),
|
..add(const FourSceneInitial())
|
||||||
child: BlocBuilder<SixSceneBloc, SixSceneState>(
|
..add(FourSceneInitialInfo()),
|
||||||
|
child: BlocBuilder<FourSceneBloc, FourSceneState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
final sensor = BlocProvider.of<SixSceneBloc>(context);
|
final _bloc = BlocProvider.of<FourSceneBloc>(context);
|
||||||
SixSceneModel model = SixSceneModel(
|
FourSceneModel model = FourSceneModel(
|
||||||
batteryPercentage: 0, waterContactState: 'normal');
|
scene_1: '',
|
||||||
|
scene_2: '',
|
||||||
|
scene_3: '',
|
||||||
|
scene_4: '',
|
||||||
|
scene_id_group_id: '',
|
||||||
|
switch_backlight: '');
|
||||||
if (state is LoadingNewSate) {
|
if (state is LoadingNewSate) {
|
||||||
model = state.sosSensor;
|
model = state.sosSensor;
|
||||||
} else if (state is UpdateState) {
|
} else if (state is UpdateState) {
|
||||||
model = state.sensor;
|
model = state.sensor;
|
||||||
}
|
}
|
||||||
return state is SixSceneLoadingState
|
return state is FourSceneLoadingState
|
||||||
? const Center(
|
? const Center(
|
||||||
child: DefaultContainer(
|
child: DefaultContainer(
|
||||||
width: 50,
|
width: 50,
|
||||||
@ -44,11 +50,11 @@ class SixSceneInfoPage extends StatelessWidget {
|
|||||||
)
|
)
|
||||||
: RefreshIndicator(
|
: RefreshIndicator(
|
||||||
onRefresh: () async {
|
onRefresh: () async {
|
||||||
sensor.add(const SixSceneInitial());
|
_bloc.add(const FourSceneInitial());
|
||||||
},
|
},
|
||||||
child: DefaultContainer(
|
child: DefaultContainer(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(left: 10, right: 10),
|
padding: const EdgeInsets.only(left: 5, right: 5),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@ -63,12 +69,24 @@ class SixSceneInfoPage extends StatelessWidget {
|
|||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
const BodySmall(
|
BodySmall(
|
||||||
text: 'bf3575d0e0c8b6e0a6hybl',
|
text: _bloc.deviceInfo.productUuid,
|
||||||
fontColor: ColorsManager.primaryTextColor,
|
fontColor: ColorsManager.primaryTextColor,
|
||||||
),
|
),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () {},
|
onTap: () {
|
||||||
|
Clipboard.setData(
|
||||||
|
ClipboardData(
|
||||||
|
text: _bloc.deviceInfo.productUuid,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(
|
||||||
|
content: Text("Copied to Clipboard"),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
child: const Row(
|
child: const Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(
|
Icon(
|
||||||
@ -87,18 +105,18 @@ class SixSceneInfoPage extends StatelessWidget {
|
|||||||
const Divider(
|
const Divider(
|
||||||
color: ColorsManager.dividerColor,
|
color: ColorsManager.dividerColor,
|
||||||
),
|
),
|
||||||
const Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
BodyLarge(
|
const BodyLarge(
|
||||||
text: 'MAC',
|
text: 'MAC',
|
||||||
fontSize: 15,
|
fontSize: 15,
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
fontColor: ColorsManager.blackColor,
|
fontColor: ColorsManager.blackColor,
|
||||||
),
|
),
|
||||||
BodySmall(
|
BodySmall(
|
||||||
text: 'bf3575d0e0c8b6e0a6hybl',
|
text: _bloc.deviceInfo.macAddress,
|
||||||
fontColor: ColorsManager.primaryTextColor,
|
fontColor: ColorsManager.primaryTextColor,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -106,18 +124,18 @@ class SixSceneInfoPage extends StatelessWidget {
|
|||||||
const Divider(
|
const Divider(
|
||||||
color: ColorsManager.dividerColor,
|
color: ColorsManager.dividerColor,
|
||||||
),
|
),
|
||||||
const Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
BodyLarge(
|
const BodyLarge(
|
||||||
text: 'Time Zone',
|
text: 'Time Zone',
|
||||||
fontSize: 15,
|
fontSize: 15,
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
fontColor: ColorsManager.blackColor,
|
fontColor: ColorsManager.blackColor,
|
||||||
),
|
),
|
||||||
BodySmall(
|
BodySmall(
|
||||||
text: 'Asia/Dubai',
|
text: _bloc.deviceInfo.timeZone,
|
||||||
fontColor: ColorsManager.primaryTextColor,
|
fontColor: ColorsManager.primaryTextColor,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -27,10 +27,11 @@ class FourSceneProfilePage extends StatelessWidget {
|
|||||||
title: 'Device Settings',
|
title: 'Device Settings',
|
||||||
child: BlocProvider(
|
child: BlocProvider(
|
||||||
create: (context) => FourSceneBloc(fourSceneId: device?.uuid ?? '')
|
create: (context) => FourSceneBloc(fourSceneId: device?.uuid ?? '')
|
||||||
..add(const FourSceneInitial()),
|
..add(const FourSceneInitial())
|
||||||
|
..add(FourSceneInitialInfo()),
|
||||||
child: BlocBuilder<FourSceneBloc, FourSceneState>(
|
child: BlocBuilder<FourSceneBloc, FourSceneState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
final sensor = BlocProvider.of<FourSceneBloc>(context);
|
final _bloc = BlocProvider.of<FourSceneBloc>(context);
|
||||||
FourSceneModel model = FourSceneModel(
|
FourSceneModel model = FourSceneModel(
|
||||||
scene_1: '',
|
scene_1: '',
|
||||||
scene_2: '',
|
scene_2: '',
|
||||||
@ -52,7 +53,7 @@ class FourSceneProfilePage extends StatelessWidget {
|
|||||||
)
|
)
|
||||||
: RefreshIndicator(
|
: RefreshIndicator(
|
||||||
onRefresh: () async {
|
onRefresh: () async {
|
||||||
sensor.add(const FourSceneInitial());
|
_bloc.add(const FourSceneInitial());
|
||||||
},
|
},
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: [
|
children: [
|
||||||
@ -88,9 +89,9 @@ class FourSceneProfilePage extends StatelessWidget {
|
|||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
focusNode: sensor.focusNode,
|
focusNode: _bloc.focusNode,
|
||||||
controller: sensor.nameController,
|
controller: _bloc.nameController,
|
||||||
enabled: sensor.editName,
|
enabled: _bloc.editName,
|
||||||
onEditingComplete: () {
|
onEditingComplete: () {
|
||||||
// sensor.add(SaveNameEvent(context: context));
|
// sensor.add(SaveNameEvent(context: context));
|
||||||
},
|
},
|
||||||
@ -106,8 +107,7 @@ class FourSceneProfilePage extends StatelessWidget {
|
|||||||
const SizedBox(width: 5),
|
const SizedBox(width: 5),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
sensor
|
_bloc.add(const ChangeNameEvent(value: true));
|
||||||
.add(const ChangeNameEvent(value: true));
|
|
||||||
},
|
},
|
||||||
child: const Padding(
|
child: const Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 10),
|
padding: EdgeInsets.symmetric(horizontal: 10),
|
||||||
@ -136,10 +136,11 @@ class FourSceneProfilePage extends StatelessWidget {
|
|||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => LocationFourScenePage(
|
builder: (context) => LocationFourScenePage(
|
||||||
space: spaces!.first,
|
space: spaces!.first,
|
||||||
|
deviceId: device?.uuid ?? '',
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: const Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@ -149,7 +150,8 @@ class FourSceneProfilePage extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
child: BodyMedium(
|
child: BodyMedium(
|
||||||
text: 'Syncroom',
|
text: _bloc
|
||||||
|
.deviceInfo.subspace.subspaceName,
|
||||||
fontColor: ColorsManager.textGray,
|
fontColor: ColorsManager.textGray,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -10,6 +10,7 @@ import 'package:syncrow_app/features/devices/model/four_scene_model.dart';
|
|||||||
import 'package:syncrow_app/features/devices/view/widgets/four_scene_switch/four_scene_setting/faq_four_scene_page.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/four_scene_switch/four_scene_setting/faq_four_scene_page.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/four_scene_switch/four_scene_setting/four_scene_create_group.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/four_scene_switch/four_scene_setting/four_scene_create_group.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/four_scene_switch/four_scene_setting/four_scene_delete_dialog.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/four_scene_switch/four_scene_setting/four_scene_delete_dialog.dart';
|
||||||
|
import 'package:syncrow_app/features/devices/view/widgets/four_scene_switch/four_scene_setting/four_scene_info_page.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/four_scene_switch/four_scene_setting/four_scene_profile_page.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/four_scene_switch/four_scene_setting/four_scene_profile_page.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/four_scene_switch/four_scene_setting/four_scene_update_dialog.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/four_scene_switch/four_scene_setting/four_scene_update_dialog.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/four_scene_switch/four_scene_setting/four_scene_update_page.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/four_scene_switch/four_scene_setting/four_scene_update_page.dart';
|
||||||
@ -33,10 +34,11 @@ class FourSceneSettings extends StatelessWidget {
|
|||||||
title: 'Device Settings',
|
title: 'Device Settings',
|
||||||
child: BlocProvider(
|
child: BlocProvider(
|
||||||
create: (context) => FourSceneBloc(fourSceneId: device?.uuid ?? '')
|
create: (context) => FourSceneBloc(fourSceneId: device?.uuid ?? '')
|
||||||
..add(const FourSceneInitial()),
|
..add(const FourSceneInitial())
|
||||||
|
..add(FourSceneInitialInfo()),
|
||||||
child: BlocBuilder<FourSceneBloc, FourSceneState>(
|
child: BlocBuilder<FourSceneBloc, FourSceneState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
final sensor = BlocProvider.of<FourSceneBloc>(context);
|
final _bloc = BlocProvider.of<FourSceneBloc>(context);
|
||||||
FourSceneModel model = FourSceneModel(
|
FourSceneModel model = FourSceneModel(
|
||||||
scene_1: '',
|
scene_1: '',
|
||||||
scene_2: '',
|
scene_2: '',
|
||||||
@ -58,7 +60,7 @@ class FourSceneSettings extends StatelessWidget {
|
|||||||
)
|
)
|
||||||
: RefreshIndicator(
|
: RefreshIndicator(
|
||||||
onRefresh: () async {
|
onRefresh: () async {
|
||||||
sensor.add(const FourSceneInitial());
|
_bloc.add(const FourSceneInitial());
|
||||||
},
|
},
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: [
|
children: [
|
||||||
@ -70,25 +72,27 @@ class FourSceneSettings extends StatelessWidget {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.of(context).push(
|
Navigator.of(context).push(
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) =>
|
builder: (context) => FourSceneProfilePage(
|
||||||
const FourSceneProfilePage(),
|
device: device,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
const Column(
|
Column(
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment.stretch,
|
CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
DefaultContainer(
|
DefaultContainer(
|
||||||
borderRadius:
|
borderRadius: const BorderRadius.all(
|
||||||
BorderRadius.all(Radius.circular(30)),
|
Radius.circular(30)),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.all(10.0),
|
padding: const EdgeInsets.all(10.0),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.only(left: 90),
|
padding:
|
||||||
|
const EdgeInsets.only(left: 90),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
MainAxisAlignment.spaceBetween,
|
MainAxisAlignment.spaceBetween,
|
||||||
@ -98,17 +102,20 @@ class FourSceneSettings extends StatelessWidget {
|
|||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
BodyMedium(
|
BodyMedium(
|
||||||
text: '4 Scene Switch',
|
text: _bloc.deviceInfo.name,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
SizedBox(
|
const SizedBox(
|
||||||
height: 5,
|
height: 5,
|
||||||
),
|
),
|
||||||
BodySmall(
|
BodySmall(
|
||||||
text: "Room: Syncrow"),
|
text: _bloc
|
||||||
|
.deviceInfo
|
||||||
|
.subspace
|
||||||
|
.subspaceName),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Icon(Icons.edit_sharp)
|
const Icon(Icons.edit_sharp)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -152,11 +159,10 @@ class FourSceneSettings extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
SettingWidget(
|
SettingWidget(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
// Navigator.of(context).push(
|
Navigator.of(context).push(
|
||||||
// MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
// builder: (context) =>
|
builder: (context) => FourSceneInfoPage( device: device!,)),
|
||||||
// const FourSceneInfoPage()),
|
);
|
||||||
// );
|
|
||||||
},
|
},
|
||||||
text: 'Device Information',
|
text: 'Device Information',
|
||||||
icon: Assets.infoIcon,
|
icon: Assets.infoIcon,
|
||||||
|
@ -3,56 +3,37 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:syncrow_app/features/app_layout/model/space_model.dart';
|
import 'package:syncrow_app/features/app_layout/model/space_model.dart';
|
||||||
import 'package:syncrow_app/features/devices/bloc/four_scene_bloc/four_scene_bloc.dart';
|
import 'package:syncrow_app/features/devices/bloc/four_scene_bloc/four_scene_bloc.dart';
|
||||||
|
import 'package:syncrow_app/features/devices/bloc/four_scene_bloc/four_scene_event.dart';
|
||||||
import 'package:syncrow_app/features/devices/bloc/four_scene_bloc/four_scene_state.dart';
|
import 'package:syncrow_app/features/devices/bloc/four_scene_bloc/four_scene_state.dart';
|
||||||
import 'package:syncrow_app/features/devices/model/four_scene_model.dart';
|
import 'package:syncrow_app/features/devices/model/four_scene_model.dart';
|
||||||
import 'package:syncrow_app/features/devices/model/subspace_model.dart';
|
|
||||||
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
||||||
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
|
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
|
||||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
|
||||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||||
|
|
||||||
import '../../../../bloc/four_scene_bloc/four_scene_event.dart';
|
class LocationFourScenePage extends StatelessWidget {
|
||||||
|
|
||||||
class LocationFourScenePage extends StatefulWidget {
|
|
||||||
final SpaceModel? space;
|
final SpaceModel? space;
|
||||||
LocationFourScenePage({super.key, this.space});
|
final String? deviceId;
|
||||||
|
|
||||||
@override
|
const LocationFourScenePage({
|
||||||
_LocationFourScenePageState createState() => _LocationFourScenePageState();
|
super.key,
|
||||||
}
|
this.space,
|
||||||
|
this.deviceId,
|
||||||
class _LocationFourScenePageState extends State<LocationFourScenePage> {
|
});
|
||||||
String _selectedOption = 'Conference Room';
|
|
||||||
bool _hasSelectionChanged = false;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return DefaultScaffold(
|
String roomIdSelected = '';
|
||||||
title: 'Device Location',
|
|
||||||
actions: [
|
return Scaffold(
|
||||||
InkWell(
|
body: BlocProvider(
|
||||||
onTap: _hasSelectionChanged
|
create: (context) => FourSceneBloc(fourSceneId: deviceId ?? '')
|
||||||
? () {
|
..add(const FourSceneInitial())
|
||||||
print('Save button clicked');
|
..add(FourSceneInitialInfo())
|
||||||
}
|
..add(FetchRoomsEvent(unit: space!)),
|
||||||
: null,
|
|
||||||
child: BodyMedium(
|
|
||||||
text: 'Save',
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
fontSize: 16,
|
|
||||||
fontColor: _hasSelectionChanged
|
|
||||||
? ColorsManager.slidingBlueColor
|
|
||||||
: ColorsManager.primaryTextColor,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 20),
|
|
||||||
],
|
|
||||||
child: BlocProvider(
|
|
||||||
create: (context) => FourSceneBloc(fourSceneId: '')
|
|
||||||
..add(FetchRoomsEvent(unit: widget.space!)),
|
|
||||||
child: BlocBuilder<FourSceneBloc, FourSceneState>(
|
child: BlocBuilder<FourSceneBloc, FourSceneState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
final sensor = BlocProvider.of<FourSceneBloc>(context);
|
final _bloc = BlocProvider.of<FourSceneBloc>(context);
|
||||||
FourSceneModel model = FourSceneModel(
|
FourSceneModel model = FourSceneModel(
|
||||||
scene_1: '',
|
scene_1: '',
|
||||||
scene_2: '',
|
scene_2: '',
|
||||||
@ -60,12 +41,6 @@ class _LocationFourScenePageState extends State<LocationFourScenePage> {
|
|||||||
scene_4: '',
|
scene_4: '',
|
||||||
scene_id_group_id: '',
|
scene_id_group_id: '',
|
||||||
switch_backlight: '');
|
switch_backlight: '');
|
||||||
List<SubSpaceModel>? rooms = [];
|
|
||||||
if (state is LoadingNewSate) {
|
|
||||||
model = state.sosSensor;
|
|
||||||
} else if (state is FetchRoomsState) {
|
|
||||||
rooms = state.roomsList;
|
|
||||||
}
|
|
||||||
return state is FourSceneLoadingState
|
return state is FourSceneLoadingState
|
||||||
? const Center(
|
? const Center(
|
||||||
child: DefaultContainer(
|
child: DefaultContainer(
|
||||||
@ -74,52 +49,92 @@ class _LocationFourScenePageState extends State<LocationFourScenePage> {
|
|||||||
child: CircularProgressIndicator(),
|
child: CircularProgressIndicator(),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: RefreshIndicator(
|
: DefaultScaffold(
|
||||||
onRefresh: () async {
|
actions: [
|
||||||
sensor.add(const FourSceneInitial());
|
BlocBuilder<FourSceneBloc, FourSceneState>(
|
||||||
},
|
builder: (context, state) {
|
||||||
child: ListView(
|
final bool canSave = state is OptionSelectedState &&
|
||||||
padding: const EdgeInsets.symmetric(vertical: 20),
|
state.hasSelectionChanged;
|
||||||
children: [
|
return InkWell(
|
||||||
const BodyMedium(
|
onTap: canSave
|
||||||
text: 'Smart Device Location',
|
? () {
|
||||||
fontWeight: FontWeight.w700,
|
context.read<FourSceneBloc>().add(
|
||||||
fontSize: 12,
|
AssignRoomEvent(
|
||||||
fontColor: ColorsManager.grayColor,
|
roomId: roomIdSelected,
|
||||||
),
|
unit: space!));
|
||||||
const SizedBox(height: 5),
|
}
|
||||||
DefaultContainer(
|
: null,
|
||||||
padding: const EdgeInsets.all(20),
|
child: BodyMedium(
|
||||||
child: ListView.builder(
|
text: 'Save',
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
fontWeight: FontWeight.w700,
|
||||||
shrinkWrap: true,
|
fontSize: 16,
|
||||||
itemCount: rooms!.length,
|
fontColor: canSave
|
||||||
itemBuilder: (context, index) {
|
? ColorsManager.slidingBlueColor
|
||||||
final room = rooms![index];
|
: ColorsManager.primaryTextColor,
|
||||||
return Column(
|
),
|
||||||
children: [
|
);
|
||||||
_buildCheckboxOption(
|
},
|
||||||
label: room.name!,
|
),
|
||||||
onTap: (v) {
|
const SizedBox(width: 20),
|
||||||
setState(() {
|
],
|
||||||
_selectedOption = v;
|
child: RefreshIndicator(
|
||||||
_hasSelectionChanged = true;
|
onRefresh: () async {
|
||||||
});
|
// sensor.add(const SosInitial());
|
||||||
},
|
},
|
||||||
),
|
child: ListView(
|
||||||
if (index < rooms.length - 1) ...[
|
shrinkWrap: true,
|
||||||
const SizedBox(height: 10),
|
padding: const EdgeInsets.symmetric(vertical: 20),
|
||||||
const Divider(
|
children: [
|
||||||
color: ColorsManager.dividerColor,
|
const BodyMedium(
|
||||||
),
|
text: 'Smart Device Location',
|
||||||
const SizedBox(height: 10),
|
fontWeight: FontWeight.w700,
|
||||||
],
|
fontSize: 12,
|
||||||
],
|
fontColor: ColorsManager.grayColor,
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(height: 5),
|
||||||
],
|
DefaultContainer(
|
||||||
|
padding: const EdgeInsets.all(20),
|
||||||
|
child: ListView.builder(
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemCount: _bloc.roomsList.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
final fromRoom = _bloc.roomsList[index];
|
||||||
|
final isSelected = (state
|
||||||
|
is OptionSelectedState &&
|
||||||
|
state.selectedOption == fromRoom.id) ||
|
||||||
|
(state is! OptionSelectedState &&
|
||||||
|
fromRoom.id ==
|
||||||
|
_bloc.deviceInfo.subspace.uuid);
|
||||||
|
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
_buildCheckboxOption(
|
||||||
|
label: fromRoom.name!,
|
||||||
|
isSelected: isSelected,
|
||||||
|
onTap: (label) {
|
||||||
|
context.read<FourSceneBloc>().add(
|
||||||
|
SelectOptionEvent(
|
||||||
|
selectedOption: fromRoom.id!,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
roomIdSelected = fromRoom.id!;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
if (index < _bloc.roomsList.length - 1) ...[
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
const Divider(
|
||||||
|
color: ColorsManager.dividerColor,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -127,34 +142,6 @@ class _LocationFourScenePageState extends State<LocationFourScenePage> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildCheckboxOption(
|
|
||||||
{required String label, required Function(String) onTap}) {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.only(bottom: 10, top: 10),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
BodyMedium(
|
|
||||||
text: label,
|
|
||||||
style: const TextStyle(fontSize: 15, fontWeight: FontWeight.w400),
|
|
||||||
),
|
|
||||||
CircularCheckbox(
|
|
||||||
value: _selectedOption == label,
|
|
||||||
onChanged: (bool? value) {
|
|
||||||
if (value == true) {
|
|
||||||
setState(() {
|
|
||||||
_selectedOption = label;
|
|
||||||
_hasSelectionChanged = true;
|
|
||||||
});
|
|
||||||
onTap(label);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class CircularCheckbox extends StatefulWidget {
|
class CircularCheckbox extends StatefulWidget {
|
||||||
@ -200,3 +187,30 @@ class _CircularCheckboxState extends State<CircularCheckbox> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildCheckboxOption({
|
||||||
|
required String label,
|
||||||
|
required bool isSelected,
|
||||||
|
required Function(String) onTap,
|
||||||
|
}) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 10, top: 10),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
BodyMedium(
|
||||||
|
text: label,
|
||||||
|
style: const TextStyle(fontSize: 15, fontWeight: FontWeight.w400),
|
||||||
|
),
|
||||||
|
CircularCheckbox(
|
||||||
|
value: isSelected,
|
||||||
|
onChanged: (bool? value) {
|
||||||
|
if (value == true) {
|
||||||
|
onTap(label);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
@ -58,7 +58,7 @@ class FourSelectSceneFourPage extends StatelessWidget {
|
|||||||
onTap: canSave
|
onTap: canSave
|
||||||
? () {
|
? () {
|
||||||
print('object');
|
print('object');
|
||||||
context.read<FourSceneBloc>().add(SaveSelectionEvent());
|
// context.read<FourSceneBloc>().add(SaveSelectionEvent());
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
child: BodyMedium(
|
child: BodyMedium(
|
||||||
|
@ -127,6 +127,7 @@ class DevicesAPI {
|
|||||||
path: ApiEndpoints.deviceByUuid.replaceAll('{deviceUuid}', deviceId),
|
path: ApiEndpoints.deviceByUuid.replaceAll('{deviceUuid}', deviceId),
|
||||||
showServerMessage: false,
|
showServerMessage: false,
|
||||||
expectedResponseModel: (json) {
|
expectedResponseModel: (json) {
|
||||||
|
print('object-=-=-$json');
|
||||||
return json;
|
return json;
|
||||||
});
|
});
|
||||||
return response;
|
return response;
|
||||||
|
Reference in New Issue
Block a user