mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-03-11 06:31:43 +00:00
Compare commits
15 Commits
SP-1459-FE
...
Fix-Flush-
| Author | SHA1 | Date | |
|---|---|---|---|
| c2bf32af1c | |||
| b7a42af223 | |||
| e8e5ddd102 | |||
| fca69cef73 | |||
| 7a19291088 | |||
| c76995fbb8 | |||
| 5d1b8e39b0 | |||
| a04beb32f2 | |||
| 23c307338a | |||
| 4db16fd567 | |||
| 2c5ca67b10 | |||
| 79c1205932 | |||
| 3589e349b3 | |||
| 86bd3fdd5b | |||
| 2e2db90c19 |
@ -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());
|
||||
@ -171,6 +171,7 @@ class FlushSensorBloc extends Bloc<FlushSensorEvent, FlushSensorState> {
|
||||
deviceInfo = DeviceInfoModel.fromJson(response);
|
||||
deviceName = deviceInfo.name;
|
||||
emit(FlushSensorLoadingDeviceInfo(deviceInfo: deviceInfo));
|
||||
emit(FlushSensorUpdateState(flushSensorModel: deviceStatus));
|
||||
} catch (e) {
|
||||
emit(FlushSensorFailedState(error: e.toString()));
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@ class FlushSensorLoadingEvent extends FlushSensorEvent {}
|
||||
|
||||
class FlushSensorInitialEvent extends FlushSensorEvent {}
|
||||
|
||||
class FlushSensorInitialDeviseInfo extends FlushSensorEvent {}
|
||||
class FlushSensorInitialDeviceInfo extends FlushSensorEvent {}
|
||||
|
||||
class FlushSensorUpdatedEvent extends FlushSensorEvent {}
|
||||
|
||||
|
||||
@ -55,31 +55,33 @@ class DeviceInfoModel {
|
||||
|
||||
factory DeviceInfoModel.fromJson(Map<String, dynamic> json) {
|
||||
return DeviceInfoModel(
|
||||
activeTime: json['activeTime'],
|
||||
category: json['category'],
|
||||
categoryName: json['categoryName'],
|
||||
createTime: json['createTime'],
|
||||
gatewayId: json['gatewayId'],
|
||||
icon: json['icon'],
|
||||
activeTime: json['activeTime'] ?? '',
|
||||
category: json['category'] ?? '',
|
||||
categoryName: json['categoryName'] ?? '',
|
||||
createTime: json['createTime'] ?? '',
|
||||
gatewayId: json['gatewayId'] ?? '',
|
||||
icon: json['icon'] ?? '',
|
||||
ip: json['ip'] ?? "",
|
||||
lat: json['lat'],
|
||||
localKey: json['localKey'],
|
||||
lon: json['lon'],
|
||||
model: json['model'],
|
||||
name: json['name'],
|
||||
nodeId: json['nodeId'],
|
||||
online: json['online'],
|
||||
ownerId: json['ownerId'],
|
||||
productName: json['productName'],
|
||||
sub: json['sub'],
|
||||
timeZone: json['timeZone'],
|
||||
updateTime: json['updateTime'],
|
||||
uuid: json['uuid'],
|
||||
productUuid: json['productUuid'],
|
||||
productType: json['productType'],
|
||||
lat: json['lat'] ?? '',
|
||||
localKey: json['localKey'] ?? '',
|
||||
lon: json['lon'] ?? '',
|
||||
model: json['model'] ?? '',
|
||||
name: json['name'] ?? '',
|
||||
nodeId: json['nodeId'] ?? '',
|
||||
online: json['online'] ?? '',
|
||||
ownerId: json['ownerId'] ?? '',
|
||||
productName: json['productName'] ?? '',
|
||||
sub: json['sub'] ?? '',
|
||||
timeZone: json['timeZone'] ?? '',
|
||||
updateTime: json['updateTime'] ?? '',
|
||||
uuid: json['uuid'] ?? '',
|
||||
productUuid: json['productUuid'] ?? '',
|
||||
productType: json['productType'] ?? '',
|
||||
permissionType: json['permissionType'] ?? '',
|
||||
macAddress: json['macAddress'],
|
||||
subspace: Subspace.fromJson(json['subspace']),
|
||||
macAddress: json['macAddress'] ?? '',
|
||||
subspace: json['subspace'] != null
|
||||
? Subspace.fromJson(json['subspace'])
|
||||
: throw ArgumentError('subspace cannot be null'),
|
||||
);
|
||||
}
|
||||
|
||||
@ -129,10 +131,10 @@ class Subspace {
|
||||
|
||||
factory Subspace.fromJson(Map<String, dynamic> json) {
|
||||
return Subspace(
|
||||
uuid: json['uuid'],
|
||||
createdAt: json['createdAt'],
|
||||
updatedAt: json['updatedAt'],
|
||||
subspaceName: json['subspaceName'],
|
||||
uuid: json['uuid'] ?? '',
|
||||
createdAt: json['createdAt'] ?? '',
|
||||
updatedAt: json['updatedAt'] ?? '',
|
||||
subspaceName: json['subspaceName'] ?? '',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -22,141 +22,155 @@ class SettingProfilePage extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
var spaces = HomeCubit.getInstance().spaces;
|
||||
|
||||
return DefaultScaffold(
|
||||
title: 'Device Settings',
|
||||
leading: IconButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop(true);
|
||||
},
|
||||
icon: const Icon(Icons.arrow_back_ios)),
|
||||
child: BlocProvider(
|
||||
create: (context) => DeviceSettingBloc(deviceId: device?.uuid ?? '')
|
||||
..add(const DeviceSettingInitial())
|
||||
..add(const DeviceSettingInitialInfo()),
|
||||
child: BlocBuilder<DeviceSettingBloc, DeviceSettingState>(
|
||||
builder: (context, state) {
|
||||
final _bloc = BlocProvider.of<DeviceSettingBloc>(context);
|
||||
return state is DeviceSettingLoadingState
|
||||
? const Center(
|
||||
child: DefaultContainer(
|
||||
width: 50,
|
||||
height: 50,
|
||||
child: CircularProgressIndicator()),
|
||||
)
|
||||
: RefreshIndicator(
|
||||
onRefresh: () async {
|
||||
_bloc.add(const DeviceSettingInitial());
|
||||
},
|
||||
child: ListView(
|
||||
children: [
|
||||
buildDeviceAvatar(context, device!),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
SizedBox(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
IntrinsicWidth(
|
||||
child: ConstrainedBox(
|
||||
constraints:
|
||||
const BoxConstraints(maxWidth: 200),
|
||||
child: TextFormField(
|
||||
maxLength: 30,
|
||||
style: const TextStyle(
|
||||
color: Colors.black,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
focusNode: _bloc.focusNode,
|
||||
controller: _bloc.nameController,
|
||||
enabled: _bloc.editName,
|
||||
onEditingComplete: () {
|
||||
_bloc.add(const SaveNameEvent());
|
||||
},
|
||||
decoration: const InputDecoration(
|
||||
hintText: "Your Name",
|
||||
border: InputBorder.none,
|
||||
fillColor: Colors.white10,
|
||||
counterText: '',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
_bloc.add(const ChangeNameEvent(value: true));
|
||||
},
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 10),
|
||||
child: SvgPicture.asset(
|
||||
Assets.sosEditProfile,
|
||||
color: Colors.grey,
|
||||
fit: BoxFit.contain,
|
||||
height: MediaQuery.of(context).size.height *
|
||||
0.02,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
onPopInvoked: (didPop) {
|
||||
if (didPop) {
|
||||
return;
|
||||
}
|
||||
Navigator.of(context).pop(true);
|
||||
},
|
||||
child: DefaultScaffold(
|
||||
title: 'Device Settings',
|
||||
leading: IconButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop(true);
|
||||
},
|
||||
icon: const Icon(Icons.arrow_back_ios)),
|
||||
child: BlocProvider(
|
||||
create: (context) => DeviceSettingBloc(deviceId: device?.uuid ?? '')
|
||||
..add(const DeviceSettingInitial())
|
||||
..add(const DeviceSettingInitialInfo()),
|
||||
child: BlocBuilder<DeviceSettingBloc, DeviceSettingState>(
|
||||
builder: (context, state) {
|
||||
final _bloc = BlocProvider.of<DeviceSettingBloc>(context);
|
||||
return state is DeviceSettingLoadingState
|
||||
? const Center(
|
||||
child: DefaultContainer(
|
||||
width: 50,
|
||||
height: 50,
|
||||
child: CircularProgressIndicator()),
|
||||
)
|
||||
: RefreshIndicator(
|
||||
onRefresh: () async {
|
||||
_bloc.add(const DeviceSettingInitial());
|
||||
},
|
||||
child: ListView(
|
||||
children: [
|
||||
buildDeviceAvatar(context, device!),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
const BodyMedium(
|
||||
text: 'Smart Device Information',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 12,
|
||||
fontColor: ColorsManager.grayColor,
|
||||
),
|
||||
const SizedBox(height: 7),
|
||||
DefaultContainer(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
if (HomeCubit.visitorPasswordManagement) {
|
||||
bool? val = await Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => LocationSettingPage(
|
||||
space: spaces!.first,
|
||||
deviceId: device?.uuid ?? '',
|
||||
)),
|
||||
);
|
||||
if (val != null && val == true) {
|
||||
_bloc.add(const DeviceSettingInitialInfo());
|
||||
}
|
||||
}
|
||||
},
|
||||
SizedBox(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(
|
||||
child: Text('Location'),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
child: BodyMedium(
|
||||
text: _bloc
|
||||
.deviceInfo.subspace.subspaceName,
|
||||
fontColor: ColorsManager.textGray,
|
||||
IntrinsicWidth(
|
||||
child: ConstrainedBox(
|
||||
constraints:
|
||||
const BoxConstraints(maxWidth: 200),
|
||||
child: TextFormField(
|
||||
maxLength: 30,
|
||||
style: const TextStyle(
|
||||
color: Colors.black,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
focusNode: _bloc.focusNode,
|
||||
controller: _bloc.nameController,
|
||||
enabled: _bloc.editName,
|
||||
onEditingComplete: () {
|
||||
_bloc.add(const SaveNameEvent());
|
||||
},
|
||||
decoration: const InputDecoration(
|
||||
hintText: "Your Name",
|
||||
border: InputBorder.none,
|
||||
fillColor: Colors.white10,
|
||||
counterText: '',
|
||||
),
|
||||
),
|
||||
const Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 15,
|
||||
color: ColorsManager.textGray,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
_bloc.add(
|
||||
const ChangeNameEvent(value: true));
|
||||
},
|
||||
child: Padding(
|
||||
padding:
|
||||
EdgeInsets.symmetric(horizontal: 10),
|
||||
child: SvgPicture.asset(
|
||||
Assets.sosEditProfile,
|
||||
color: Colors.grey,
|
||||
fit: BoxFit.contain,
|
||||
height:
|
||||
MediaQuery.of(context).size.height *
|
||||
0.02,
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
const SizedBox(height: 20),
|
||||
const BodyMedium(
|
||||
text: 'Smart Device Information',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 12,
|
||||
fontColor: ColorsManager.grayColor,
|
||||
),
|
||||
const SizedBox(height: 7),
|
||||
DefaultContainer(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
if (HomeCubit.visitorPasswordManagement) {
|
||||
bool? val = await Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
LocationSettingPage(
|
||||
space: spaces!.first,
|
||||
deviceId: device?.uuid ?? '',
|
||||
)),
|
||||
);
|
||||
if (val != null && val == true) {
|
||||
_bloc.add(const DeviceSettingInitialInfo());
|
||||
}
|
||||
}
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const SizedBox(
|
||||
child: Text('Location'),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
child: BodyMedium(
|
||||
text: _bloc
|
||||
.deviceInfo.subspace.subspaceName,
|
||||
fontColor: ColorsManager.textGray,
|
||||
),
|
||||
),
|
||||
const Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 15,
|
||||
color: ColorsManager.textGray,
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@ -28,406 +28,449 @@ class SettingsPage extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return DefaultScaffold(
|
||||
title: 'Device Settings',
|
||||
child: BlocProvider(
|
||||
create: (context) => DeviceSettingBloc(deviceId: device?.uuid ?? '')
|
||||
..add(const DeviceSettingInitial())
|
||||
..add(const DeviceSettingInitialInfo()),
|
||||
child: BlocBuilder<DeviceSettingBloc, DeviceSettingState>(
|
||||
builder: (context, state) {
|
||||
final _bloc = BlocProvider.of<DeviceSettingBloc>(context);
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
onPopInvoked: (didPop) {
|
||||
if (didPop) {
|
||||
return;
|
||||
}
|
||||
Navigator.of(context).pop(true);
|
||||
},
|
||||
child: DefaultScaffold(
|
||||
title: 'Device Settings',
|
||||
child: BlocProvider(
|
||||
create: (context) => DeviceSettingBloc(deviceId: device?.uuid ?? '')
|
||||
..add(const DeviceSettingInitial())
|
||||
..add(const DeviceSettingInitialInfo()),
|
||||
child: BlocBuilder<DeviceSettingBloc, DeviceSettingState>(
|
||||
builder: (context, state) {
|
||||
final _bloc = BlocProvider.of<DeviceSettingBloc>(context);
|
||||
|
||||
return state is DeviceSettingLoadingState
|
||||
? const Center(
|
||||
child:
|
||||
DefaultContainer(width: 50, height: 50, child: CircularProgressIndicator()),
|
||||
)
|
||||
: ListView(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 10,
|
||||
),
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
bool val = await Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => SettingProfilePage(
|
||||
device: device,
|
||||
),
|
||||
),
|
||||
);
|
||||
if (val == true) {
|
||||
_bloc.add(const DeviceSettingInitialInfo());
|
||||
}
|
||||
},
|
||||
child: Stack(
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
const SizedBox(height: 20),
|
||||
DefaultContainer(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(30)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 90),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
child: Text(
|
||||
_bloc.deviceInfo.name,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: ColorsManager.grayColor,
|
||||
),
|
||||
overflow: TextOverflow
|
||||
.ellipsis, // Adds ellipsis (...) when the text overflows.
|
||||
maxLines:
|
||||
1, // Restricts the text to a single line.
|
||||
)),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
BodySmall(
|
||||
text: _bloc.deviceInfo.subspace.subspaceName),
|
||||
],
|
||||
),
|
||||
),
|
||||
SvgPicture.asset(
|
||||
Assets.editNameSetting,
|
||||
fit: BoxFit.contain,
|
||||
height: 30,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
top: 0,
|
||||
left: 20,
|
||||
child: CircleAvatar(
|
||||
radius: 43,
|
||||
backgroundColor: Colors.white,
|
||||
child: CircleAvatar(
|
||||
radius: 40,
|
||||
backgroundColor: Colors.white,
|
||||
child: CircleAvatar(
|
||||
radius: 40,
|
||||
backgroundColor: ColorsManager.backgroundColor,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
device!.type == 'NCPS'
|
||||
? SizedBox(
|
||||
height: 80,
|
||||
width: 50,
|
||||
child: SvgPicture.asset(
|
||||
Assets.flushIcon,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
):
|
||||
device!.type == "SOS"
|
||||
? ClipOval(
|
||||
child: SvgPicture.asset(
|
||||
Assets.sosHomeIcon,
|
||||
fit: BoxFit.contain,
|
||||
height: 70,
|
||||
),
|
||||
)
|
||||
: Padding(
|
||||
padding: device!.type == "4S"
|
||||
? const EdgeInsets.only(top: 5)
|
||||
: const EdgeInsets.only(top: 0),
|
||||
child: SizedBox(
|
||||
height: 70,
|
||||
child: SvgPicture.asset(
|
||||
device!.type == "4S"
|
||||
? Assets.fourSceneIcon
|
||||
: Assets.sixSceneIcon,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)),
|
||||
),
|
||||
],
|
||||
return state is DeviceSettingLoadingState
|
||||
? const Center(
|
||||
child: DefaultContainer(
|
||||
width: 50,
|
||||
height: 50,
|
||||
child: CircularProgressIndicator()),
|
||||
)
|
||||
: ListView(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 10,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
const BodyMedium(
|
||||
text: 'Device Management',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 12,
|
||||
fontColor: ColorsManager.grayColor,
|
||||
),
|
||||
DefaultContainer(
|
||||
child: Column(
|
||||
children: [
|
||||
SettingWidget(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => SettingInfoPage(
|
||||
device: device!,
|
||||
)),
|
||||
);
|
||||
},
|
||||
text: 'Device Information',
|
||||
icon: Assets.infoIcon,
|
||||
),
|
||||
// const Divider(
|
||||
// color: ColorsManager.dividerColor,
|
||||
// ),
|
||||
// SettingWidget(
|
||||
// onTap: () {
|
||||
// Navigator.of(context).push(
|
||||
// MaterialPageRoute(
|
||||
// builder: (context) =>
|
||||
// ShareFourScenePage(
|
||||
// device: device!)),
|
||||
// );
|
||||
// },
|
||||
// text: 'Tap-to Run and Automation',
|
||||
// icon: Assets.tapRunIcon,
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
// const BodyMedium(
|
||||
// text: 'Device Offline Notification',
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 12,
|
||||
// fontColor: ColorsManager.grayColor,
|
||||
// ),
|
||||
// DefaultContainer(
|
||||
// child: Column(
|
||||
// children: [
|
||||
// SettingWidget(
|
||||
// value: _bloc.enableAlarm,
|
||||
// onChanged: (p0) {
|
||||
// context
|
||||
// .read<DeviceSettingBloc>()
|
||||
// .add(ToggleEnableAlarmEvent(p0));
|
||||
// },
|
||||
// isNotification: true,
|
||||
// onTap: () {},
|
||||
// text: 'Offline Notification',
|
||||
// icon: Assets.notificationIcon,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// const SizedBox(height: 20),
|
||||
// const BodyMedium(
|
||||
// text: 'Others',
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 12,
|
||||
// fontColor: ColorsManager.grayColor,
|
||||
// ),
|
||||
// const SizedBox(height: 5),
|
||||
// DefaultContainer(
|
||||
// child: Column(
|
||||
// children: [
|
||||
// SettingWidget(
|
||||
// onTap: () {
|
||||
// Navigator.of(context).push(
|
||||
// MaterialPageRoute(
|
||||
// builder: (context) =>
|
||||
// ShareDevicePage(device: device!)),
|
||||
// );
|
||||
// },
|
||||
// text: 'Share Device',
|
||||
// icon: Assets.shareIcon,
|
||||
// ),
|
||||
// // const Divider(
|
||||
// // color: ColorsManager.dividerColor,
|
||||
// // ),
|
||||
// // SettingWidget(
|
||||
// // onTap: () {
|
||||
// // Navigator.of(context).push(
|
||||
// // MaterialPageRoute(
|
||||
// // builder: (context) =>
|
||||
// // FourSceneCreateGroup(
|
||||
// // device: device!)),
|
||||
// // );
|
||||
// // },
|
||||
// // text: 'Create Group',
|
||||
// // icon: Assets.createGroupIcon,
|
||||
// // ),
|
||||
// const Divider(
|
||||
// color: ColorsManager.dividerColor,
|
||||
// ),
|
||||
// SettingWidget(
|
||||
// onTap: () {
|
||||
// Navigator.of(context).push(
|
||||
// MaterialPageRoute(
|
||||
// builder: (context) =>
|
||||
// FaqSettingPage(device: device!)),
|
||||
// );
|
||||
// },
|
||||
// text: 'Device FAQ',
|
||||
// icon: Assets.faqIcon,
|
||||
// ),
|
||||
// const Divider(
|
||||
// color: ColorsManager.dividerColor,
|
||||
// ),
|
||||
// SettingWidget(
|
||||
// onTapUpdate: () {
|
||||
// showDialog(
|
||||
// context: context,
|
||||
// builder: (context) {
|
||||
// return UpdateInfoDialog(
|
||||
// cancelTab: () {
|
||||
// Navigator.of(context).pop();
|
||||
// },
|
||||
// confirmTab: () {
|
||||
// Navigator.of(context).pop();
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// isUpdate: true,
|
||||
// onTap: () {
|
||||
// Navigator.of(context).push(
|
||||
// MaterialPageRoute(
|
||||
// builder: (context) =>
|
||||
// const UpdatePageSetting()),
|
||||
// );
|
||||
// },
|
||||
// text: 'Device Update',
|
||||
// icon: Assets.updateIcon,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
const SizedBox(height: 20),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return Container(
|
||||
height: 200,
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
bool val = await Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => SettingProfilePage(
|
||||
device: device,
|
||||
),
|
||||
),
|
||||
);
|
||||
if (val == true) {
|
||||
_bloc.add(const DeviceSettingInitialInfo());
|
||||
}
|
||||
},
|
||||
child: Stack(
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
const BodyMedium(
|
||||
text: 'Remove Device',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 16,
|
||||
fontColor: ColorsManager.red,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
const SizedBox(
|
||||
width: 250,
|
||||
child: Divider(
|
||||
color: ColorsManager.dividerColor,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return DisconnectDeviceDialog(
|
||||
cancelTab: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
confirmTab: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: const BodyMedium(
|
||||
text: 'Disconnect Device',
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 15,
|
||||
fontColor: ColorsManager.textPrimaryColor,
|
||||
),
|
||||
),
|
||||
const Icon(
|
||||
Icons.keyboard_arrow_right,
|
||||
color: ColorsManager.textGray,
|
||||
)
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return DisconnectWipeData(
|
||||
cancelTab: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
confirmTab: () {
|
||||
_bloc.add(DeleteDeviceEvent());
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: const BodyMedium(
|
||||
text: 'Disconnect Device and Wipe Data',
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 15,
|
||||
fontColor: ColorsManager.textPrimaryColor,
|
||||
DefaultContainer(
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(30)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(left: 90),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
child: Text(
|
||||
_bloc.deviceInfo.name,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight:
|
||||
FontWeight.w700,
|
||||
color: ColorsManager
|
||||
.grayColor,
|
||||
),
|
||||
overflow: TextOverflow
|
||||
.ellipsis, // Adds ellipsis (...) when the text overflows.
|
||||
maxLines:
|
||||
1, // Restricts the text to a single line.
|
||||
)),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
BodySmall(
|
||||
text: _bloc
|
||||
.deviceInfo
|
||||
.subspace
|
||||
.subspaceName),
|
||||
],
|
||||
),
|
||||
),
|
||||
SvgPicture.asset(
|
||||
Assets.editNameSetting,
|
||||
fit: BoxFit.contain,
|
||||
height: 30,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const Icon(
|
||||
Icons.keyboard_arrow_right,
|
||||
color: ColorsManager.textGray,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: const Center(
|
||||
child: BodyMedium(
|
||||
text: 'Remove Device',
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 15,
|
||||
fontColor: ColorsManager.red,
|
||||
Positioned(
|
||||
top: 0,
|
||||
left: 20,
|
||||
child: CircleAvatar(
|
||||
radius: 43,
|
||||
backgroundColor: Colors.white,
|
||||
child: CircleAvatar(
|
||||
radius: 40,
|
||||
backgroundColor: Colors.white,
|
||||
child: CircleAvatar(
|
||||
radius: 40,
|
||||
backgroundColor:
|
||||
ColorsManager.backgroundColor,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: [
|
||||
device!.type == 'NCPS'
|
||||
? SizedBox(
|
||||
height: 80,
|
||||
width: 50,
|
||||
child: SvgPicture.asset(
|
||||
Assets.flushIcon,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
)
|
||||
: device!.type == "SOS"
|
||||
? ClipOval(
|
||||
child:
|
||||
SvgPicture.asset(
|
||||
Assets.sosHomeIcon,
|
||||
fit: BoxFit.contain,
|
||||
height: 70,
|
||||
),
|
||||
)
|
||||
: Padding(
|
||||
padding: device!
|
||||
.type ==
|
||||
"4S"
|
||||
? const EdgeInsets
|
||||
.only(top: 5)
|
||||
: const EdgeInsets
|
||||
.only(top: 0),
|
||||
child: SizedBox(
|
||||
height: 70,
|
||||
child: SvgPicture
|
||||
.asset(
|
||||
device!.type ==
|
||||
"4S"
|
||||
? Assets
|
||||
.fourSceneIcon
|
||||
: Assets
|
||||
.sixSceneIcon,
|
||||
fit: BoxFit
|
||||
.contain,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
const SizedBox(height: 20),
|
||||
const BodyMedium(
|
||||
text: 'Device Management',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 12,
|
||||
fontColor: ColorsManager.grayColor,
|
||||
),
|
||||
DefaultContainer(
|
||||
child: Column(
|
||||
children: [
|
||||
SettingWidget(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => SettingInfoPage(
|
||||
device: device!,
|
||||
)),
|
||||
);
|
||||
},
|
||||
text: 'Device Information',
|
||||
icon: Assets.infoIcon,
|
||||
),
|
||||
// const Divider(
|
||||
// color: ColorsManager.dividerColor,
|
||||
// ),
|
||||
// SettingWidget(
|
||||
// onTap: () {
|
||||
// Navigator.of(context).push(
|
||||
// MaterialPageRoute(
|
||||
// builder: (context) =>
|
||||
// ShareFourScenePage(
|
||||
// device: device!)),
|
||||
// );
|
||||
// },
|
||||
// text: 'Tap-to Run and Automation',
|
||||
// icon: Assets.tapRunIcon,
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
// const BodyMedium(
|
||||
// text: 'Device Offline Notification',
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 12,
|
||||
// fontColor: ColorsManager.grayColor,
|
||||
// ),
|
||||
// DefaultContainer(
|
||||
// child: Column(
|
||||
// children: [
|
||||
// SettingWidget(
|
||||
// value: _bloc.enableAlarm,
|
||||
// onChanged: (p0) {
|
||||
// context
|
||||
// .read<DeviceSettingBloc>()
|
||||
// .add(ToggleEnableAlarmEvent(p0));
|
||||
// },
|
||||
// isNotification: true,
|
||||
// onTap: () {},
|
||||
// text: 'Offline Notification',
|
||||
// icon: Assets.notificationIcon,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// const SizedBox(height: 20),
|
||||
// const BodyMedium(
|
||||
// text: 'Others',
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 12,
|
||||
// fontColor: ColorsManager.grayColor,
|
||||
// ),
|
||||
// const SizedBox(height: 5),
|
||||
// DefaultContainer(
|
||||
// child: Column(
|
||||
// children: [
|
||||
// SettingWidget(
|
||||
// onTap: () {
|
||||
// Navigator.of(context).push(
|
||||
// MaterialPageRoute(
|
||||
// builder: (context) =>
|
||||
// ShareDevicePage(device: device!)),
|
||||
// );
|
||||
// },
|
||||
// text: 'Share Device',
|
||||
// icon: Assets.shareIcon,
|
||||
// ),
|
||||
// // const Divider(
|
||||
// // color: ColorsManager.dividerColor,
|
||||
// // ),
|
||||
// // SettingWidget(
|
||||
// // onTap: () {
|
||||
// // Navigator.of(context).push(
|
||||
// // MaterialPageRoute(
|
||||
// // builder: (context) =>
|
||||
// // FourSceneCreateGroup(
|
||||
// // device: device!)),
|
||||
// // );
|
||||
// // },
|
||||
// // text: 'Create Group',
|
||||
// // icon: Assets.createGroupIcon,
|
||||
// // ),
|
||||
// const Divider(
|
||||
// color: ColorsManager.dividerColor,
|
||||
// ),
|
||||
// SettingWidget(
|
||||
// onTap: () {
|
||||
// Navigator.of(context).push(
|
||||
// MaterialPageRoute(
|
||||
// builder: (context) =>
|
||||
// FaqSettingPage(device: device!)),
|
||||
// );
|
||||
// },
|
||||
// text: 'Device FAQ',
|
||||
// icon: Assets.faqIcon,
|
||||
// ),
|
||||
// const Divider(
|
||||
// color: ColorsManager.dividerColor,
|
||||
// ),
|
||||
// SettingWidget(
|
||||
// onTapUpdate: () {
|
||||
// showDialog(
|
||||
// context: context,
|
||||
// builder: (context) {
|
||||
// return UpdateInfoDialog(
|
||||
// cancelTab: () {
|
||||
// Navigator.of(context).pop();
|
||||
// },
|
||||
// confirmTab: () {
|
||||
// Navigator.of(context).pop();
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// isUpdate: true,
|
||||
// onTap: () {
|
||||
// Navigator.of(context).push(
|
||||
// MaterialPageRoute(
|
||||
// builder: (context) =>
|
||||
// const UpdatePageSetting()),
|
||||
// );
|
||||
// },
|
||||
// text: 'Device Update',
|
||||
// icon: Assets.updateIcon,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
const SizedBox(height: 20),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return Container(
|
||||
height: 200,
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const BodyMedium(
|
||||
text: 'Remove Device',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 16,
|
||||
fontColor: ColorsManager.red,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
const SizedBox(
|
||||
width: 250,
|
||||
child: Divider(
|
||||
color: ColorsManager.dividerColor,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return DisconnectDeviceDialog(
|
||||
cancelTab: () {
|
||||
Navigator.of(context)
|
||||
.pop();
|
||||
},
|
||||
confirmTab: () {
|
||||
Navigator.of(context)
|
||||
.pop();
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: const BodyMedium(
|
||||
text: 'Disconnect Device',
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 15,
|
||||
fontColor: ColorsManager
|
||||
.textPrimaryColor,
|
||||
),
|
||||
),
|
||||
const Icon(
|
||||
Icons.keyboard_arrow_right,
|
||||
color: ColorsManager.textGray,
|
||||
)
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return DisconnectWipeData(
|
||||
cancelTab: () {
|
||||
Navigator.of(context)
|
||||
.pop();
|
||||
},
|
||||
confirmTab: () {
|
||||
_bloc.add(
|
||||
DeleteDeviceEvent());
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: const BodyMedium(
|
||||
text:
|
||||
'Disconnect Device and Wipe Data',
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 15,
|
||||
fontColor: ColorsManager
|
||||
.textPrimaryColor,
|
||||
),
|
||||
),
|
||||
const Icon(
|
||||
Icons.keyboard_arrow_right,
|
||||
color: ColorsManager.textGray,
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: const Center(
|
||||
child: BodyMedium(
|
||||
text: 'Remove Device',
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 15,
|
||||
fontColor: ColorsManager.red,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@ -46,7 +46,7 @@ class SixSceneScreen extends StatelessWidget {
|
||||
model = state.device;
|
||||
}
|
||||
return DefaultScaffold(
|
||||
title: device?.name ?? '6 Scene Switch',
|
||||
title: bloc.deviceInfo.name ,
|
||||
actions: [
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
@ -55,7 +55,7 @@ class SixSceneScreen extends StatelessWidget {
|
||||
builder: (context) => SettingsPage(device: device!),
|
||||
),
|
||||
);
|
||||
if (val == null) {
|
||||
if (val == null || val == true) {
|
||||
bloc.add(const SixSceneInitialInfo());
|
||||
bloc.add(const SixSceneInitial());
|
||||
bloc.add(const SexSceneSwitchInitial());
|
||||
@ -195,8 +195,8 @@ class SixSceneScreen extends StatelessWidget {
|
||||
);
|
||||
if (value == true) {
|
||||
Future.delayed(
|
||||
const Duration(milliseconds: 200),
|
||||
() {
|
||||
const Duration(
|
||||
milliseconds: 200), () {
|
||||
bloc.add(
|
||||
const SexSceneSwitchInitial());
|
||||
});
|
||||
|
||||
@ -95,17 +95,15 @@ class FlushPresenceRecords extends StatelessWidget {
|
||||
SizedBox(
|
||||
child: ListTile(
|
||||
leading: Icon(
|
||||
record.value == 'true'
|
||||
record.value == "presence"
|
||||
? Icons.radio_button_checked
|
||||
: Icons.radio_button_unchecked,
|
||||
color: record.value == 'true'
|
||||
color: record.value == "presence"
|
||||
? Colors.blue
|
||||
: Colors.grey,
|
||||
),
|
||||
title: Text(
|
||||
record.value == 'true'
|
||||
? "Opened"
|
||||
: "Closed",
|
||||
record.value.toString(),
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 18,
|
||||
|
||||
@ -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());
|
||||
}
|
||||
},
|
||||
|
||||
@ -47,7 +47,7 @@ class FourSceneScreen extends StatelessWidget {
|
||||
}
|
||||
|
||||
return DefaultScaffold(
|
||||
title: device?.name ?? '4 Scene',
|
||||
title: _bloc.deviceInfo.name,
|
||||
actions: [
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
@ -56,7 +56,7 @@ class FourSceneScreen extends StatelessWidget {
|
||||
builder: (context) => SettingsPage(device: device!),
|
||||
),
|
||||
);
|
||||
if (val == null) {
|
||||
if (val == null || val == true) {
|
||||
_bloc.add(const FourSceneInitial());
|
||||
_bloc.add(const FourSceneInitialInfo());
|
||||
_bloc.add(const FourSceneSwitchInitial());
|
||||
@ -164,8 +164,7 @@ class FourSceneScreen extends StatelessWidget {
|
||||
cancelTab: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
confirmTab:
|
||||
(switchSelected) {
|
||||
confirmTab: (switchSelected) {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
|
||||
@ -29,7 +29,7 @@ class SosScreen extends StatelessWidget {
|
||||
builder: (context, state) {
|
||||
final sensor = BlocProvider.of<SosBloc>(context);
|
||||
return DefaultScaffold(
|
||||
title: device?.name,
|
||||
title: sensor.deviceInfo.name,
|
||||
actions: [
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
@ -38,7 +38,7 @@ class SosScreen extends StatelessWidget {
|
||||
builder: (context) => SettingsPage(device: device!),
|
||||
),
|
||||
);
|
||||
if (val == null) {
|
||||
if (val == null || val == true) {
|
||||
sensor.add(SosInitialDeviseInfo());
|
||||
sensor.add(const SosInitial());
|
||||
}
|
||||
@ -72,33 +72,38 @@ class SosScreen extends StatelessWidget {
|
||||
Expanded(
|
||||
flex: 4,
|
||||
child: InkWell(
|
||||
overlayColor:
|
||||
WidgetStateProperty.all(Colors.transparent),
|
||||
overlayColor: WidgetStateProperty.all(
|
||||
Colors.transparent),
|
||||
onTap: () {
|
||||
// Add functionality for the main SOS button here
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(890),
|
||||
borderRadius:
|
||||
BorderRadius.circular(890),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.white.withOpacity(0.1),
|
||||
color:
|
||||
Colors.white.withOpacity(0.1),
|
||||
blurRadius: 24,
|
||||
offset: const Offset(-5, -5),
|
||||
blurStyle: BlurStyle.outer,
|
||||
),
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.11),
|
||||
color: Colors.black
|
||||
.withOpacity(0.11),
|
||||
blurRadius: 25,
|
||||
offset: const Offset(5, 5),
|
||||
blurStyle: BlurStyle.outer,
|
||||
),
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.13),
|
||||
color: Colors.black
|
||||
.withOpacity(0.13),
|
||||
blurRadius: 30,
|
||||
offset: const Offset(5, 5),
|
||||
blurStyle: BlurStyle.inner,
|
||||
@ -125,8 +130,9 @@ class SosScreen extends StatelessWidget {
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => SosRecordsScreen(
|
||||
sosId: device!.uuid!),
|
||||
builder: (context) =>
|
||||
SosRecordsScreen(
|
||||
sosId: device!.uuid!),
|
||||
),
|
||||
);
|
||||
},
|
||||
@ -181,8 +187,8 @@ class SosScreen extends StatelessWidget {
|
||||
maxHeight: 46,
|
||||
maxWidth: 50,
|
||||
),
|
||||
child: SvgPicture.asset(
|
||||
Assets.doorNotificationSetting),
|
||||
child: SvgPicture.asset(Assets
|
||||
.doorNotificationSetting),
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
const Flexible(
|
||||
|
||||
@ -4,6 +4,7 @@ enum OperationDialogType {
|
||||
temperature,
|
||||
onOff,
|
||||
integerSteps,
|
||||
counterSteps,
|
||||
listOfOptions,
|
||||
none,
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ class FlushFunctionsHelper {
|
||||
operationName: 'Min Detection Distance',
|
||||
code: 'near_detection',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.integerSteps,
|
||||
operationDialogType: OperationDialogType.counterSteps,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(
|
||||
icon: '',
|
||||
@ -136,10 +136,10 @@ class FlushFunctionsHelper {
|
||||
operationName: 'Max Detection Distance',
|
||||
code: 'far_detection',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.integerSteps,
|
||||
operationDialogType: OperationDialogType.counterSteps,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(
|
||||
icon: '',
|
||||
icon: Assets.assetsCelsiusDegrees,
|
||||
value: 0.0,
|
||||
description: "m",
|
||||
minValue: 0.0,
|
||||
@ -156,23 +156,17 @@ class FlushFunctionsHelper {
|
||||
operationName: 'Trigger Level',
|
||||
code: 'sensi_reduce',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.listOfOptions,
|
||||
operationDialogType: OperationDialogType.counterSteps,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsSensitivityOperationIcon,
|
||||
icon: Assets.assetsCelsiusDegrees,
|
||||
value: 1,
|
||||
description: 1.toString(),
|
||||
),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsSensitivityOperationIcon,
|
||||
value: 2,
|
||||
description: 2.toString(),
|
||||
),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsSensitivityOperationIcon,
|
||||
value: 3,
|
||||
description: 3.toString(),
|
||||
description: "",
|
||||
minValue: 1,
|
||||
maxValue: 3,
|
||||
stepValue: 1,
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
@ -183,23 +177,17 @@ class FlushFunctionsHelper {
|
||||
operationName: 'Indent Level',
|
||||
code: 'occur_dist_reduce',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.listOfOptions,
|
||||
operationDialogType: OperationDialogType.counterSteps,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsSensitivityOperationIcon,
|
||||
icon: Assets.assetsCelsiusDegrees,
|
||||
value: 1,
|
||||
description: 1.toString(),
|
||||
),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsSensitivityOperationIcon,
|
||||
value: 2,
|
||||
description: 2.toString(),
|
||||
),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsSensitivityOperationIcon,
|
||||
value: 3,
|
||||
description: 3.toString(),
|
||||
description: "",
|
||||
minValue: 1,
|
||||
maxValue: 3,
|
||||
stepValue: 1,
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
@ -210,7 +198,7 @@ class FlushFunctionsHelper {
|
||||
operationName: 'Target Confirm Time',
|
||||
code: 'presence_delay',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.integerSteps,
|
||||
operationDialogType: OperationDialogType.counterSteps,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(
|
||||
icon: '',
|
||||
@ -235,7 +223,7 @@ class FlushFunctionsHelper {
|
||||
SceneOperationalValue(
|
||||
icon: '',
|
||||
value: 20.0,
|
||||
description: "",
|
||||
description: "sec",
|
||||
minValue: 20.0,
|
||||
maxValue: 300.0,
|
||||
stepValue: 1.0,
|
||||
|
||||
@ -8,6 +8,7 @@ import 'package:syncrow_app/features/scene/model/create_automation_model.dart';
|
||||
import 'package:syncrow_app/features/scene/model/create_scene_model.dart';
|
||||
import 'package:syncrow_app/features/scene/model/scene_static_function.dart';
|
||||
import 'package:syncrow_app/features/scene/widgets/alert_dialogs/alert_dialog_countdown.dart';
|
||||
import 'package:syncrow_app/features/scene/widgets/alert_dialogs/alert_dialog_counter.dart';
|
||||
import 'package:syncrow_app/features/scene/widgets/alert_dialogs/alert_dialog_functions_body.dart';
|
||||
import 'package:syncrow_app/features/scene/widgets/alert_dialogs/alert_dialog_slider_steps.dart';
|
||||
import 'package:syncrow_app/features/scene/widgets/alert_dialogs/alert_dialog_temperature_body.dart';
|
||||
@ -132,7 +133,7 @@ mixin SceneLogicHelper {
|
||||
'presence_delay' ||
|
||||
action.executorProperty!.functionCode == 'none_delay') {
|
||||
action.executorProperty!.functionValue =
|
||||
action.executorProperty!.functionValue * 10;
|
||||
(action.executorProperty!.functionValue * 10).round();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -193,12 +194,12 @@ mixin SceneLogicHelper {
|
||||
if (action.executorProperty!.functionCode == 'near_detection' ||
|
||||
action.executorProperty!.functionCode == 'far_detection') {
|
||||
action.executorProperty!.functionValue =
|
||||
action.executorProperty!.functionValue * 100;
|
||||
(action.executorProperty!.functionValue * 100).round();
|
||||
} else if (action.executorProperty!.functionCode ==
|
||||
'presence_delay' ||
|
||||
action.executorProperty!.functionCode == 'none_delay') {
|
||||
action.executorProperty!.functionValue =
|
||||
action.executorProperty!.functionValue * 10;
|
||||
(action.executorProperty!.functionValue * 10).round();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -234,6 +235,13 @@ mixin SceneLogicHelper {
|
||||
functionValue: functionValue ?? taskItem.functionValue,
|
||||
isAutomation: isAutomation,
|
||||
);
|
||||
} else if (taskItem.operationDialogType ==
|
||||
OperationDialogType.counterSteps) {
|
||||
return AlertDialogCounterSteps(
|
||||
taskItem: taskItem,
|
||||
functionValue: functionValue ?? taskItem.functionValue,
|
||||
isAutomation: isAutomation,
|
||||
);
|
||||
}
|
||||
|
||||
return AlertDialogFunctionsOperationsBody(
|
||||
|
||||
@ -1748,7 +1748,7 @@ mixin SceneOperationsDataHelper {
|
||||
action.deviceName,
|
||||
Assets.flushIcon,
|
||||
'Min Detection distance',
|
||||
OperationDialogType.integerSteps,
|
||||
OperationDialogType.counterSteps,
|
||||
_createMinDetection(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
@ -1763,7 +1763,7 @@ mixin SceneOperationsDataHelper {
|
||||
action.deviceName,
|
||||
Assets.flushIcon,
|
||||
'Max Detection distance',
|
||||
OperationDialogType.integerSteps,
|
||||
OperationDialogType.counterSteps,
|
||||
_createFarDetection(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
@ -1778,7 +1778,7 @@ mixin SceneOperationsDataHelper {
|
||||
action.deviceName,
|
||||
Assets.flushIcon,
|
||||
"Trigger Level",
|
||||
OperationDialogType.listOfOptions,
|
||||
OperationDialogType.counterSteps,
|
||||
_createTriggerLevelFunction(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
@ -1789,19 +1789,12 @@ mixin SceneOperationsDataHelper {
|
||||
List<SceneOperationalValue> _createTriggerLevelFunction() {
|
||||
return [
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsSensitivityOperationIcon,
|
||||
description: "1",
|
||||
value: 1,
|
||||
),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsSensitivityOperationIcon,
|
||||
description: "2",
|
||||
value: 2,
|
||||
),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsSensitivityOperationIcon,
|
||||
description: "3",
|
||||
value: 3,
|
||||
icon: Assets.assetsCelsiusDegrees,
|
||||
value: 0,
|
||||
description: '',
|
||||
minValue: 0,
|
||||
maxValue: 3,
|
||||
stepValue: 1,
|
||||
),
|
||||
];
|
||||
}
|
||||
@ -1813,7 +1806,7 @@ mixin SceneOperationsDataHelper {
|
||||
action.deviceName,
|
||||
Assets.flushIcon,
|
||||
'Indent Level',
|
||||
OperationDialogType.listOfOptions,
|
||||
OperationDialogType.counterSteps,
|
||||
_createIndentLevelFunction(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
@ -1824,19 +1817,12 @@ mixin SceneOperationsDataHelper {
|
||||
List<SceneOperationalValue> _createIndentLevelFunction() {
|
||||
return [
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsSensitivityOperationIcon,
|
||||
description: "1",
|
||||
value: 1,
|
||||
),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsSensitivityOperationIcon,
|
||||
description: "2",
|
||||
value: 2,
|
||||
),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsSensitivityOperationIcon,
|
||||
description: "3",
|
||||
value: 3,
|
||||
icon: Assets.assetsCelsiusDegrees,
|
||||
value: 0,
|
||||
description: '',
|
||||
minValue: 0,
|
||||
maxValue: 3,
|
||||
stepValue: 1,
|
||||
),
|
||||
];
|
||||
}
|
||||
@ -1848,7 +1834,7 @@ mixin SceneOperationsDataHelper {
|
||||
action.deviceName,
|
||||
Assets.flushIcon,
|
||||
'Target Confirm Time',
|
||||
OperationDialogType.integerSteps,
|
||||
OperationDialogType.counterSteps,
|
||||
_targetConfirmTimeFun(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
@ -1876,7 +1862,7 @@ mixin SceneOperationsDataHelper {
|
||||
SceneOperationalValue(
|
||||
icon: Assets.flushIcon,
|
||||
value: 0.0,
|
||||
description: '',
|
||||
description: 'sec',
|
||||
minValue: 20,
|
||||
maxValue: 300,
|
||||
stepValue: 1,
|
||||
@ -1892,7 +1878,7 @@ mixin SceneOperationsDataHelper {
|
||||
value: 0.0,
|
||||
minValue: 0.0,
|
||||
maxValue: 9.5,
|
||||
stepValue: 1,
|
||||
stepValue: 0.10,
|
||||
),
|
||||
];
|
||||
}
|
||||
@ -1905,7 +1891,7 @@ mixin SceneOperationsDataHelper {
|
||||
value: 0.0,
|
||||
minValue: 0.0,
|
||||
maxValue: 9.5,
|
||||
stepValue: 1,
|
||||
stepValue: 0.10,
|
||||
),
|
||||
];
|
||||
}
|
||||
@ -1915,7 +1901,7 @@ mixin SceneOperationsDataHelper {
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsCelsiusDegrees,
|
||||
value: 0.0,
|
||||
description: '',
|
||||
description: 'sec',
|
||||
minValue: 0.0,
|
||||
maxValue: 0.5,
|
||||
stepValue: 0.1,
|
||||
|
||||
@ -90,44 +90,25 @@ class Action {
|
||||
String toRawJson() => json.encode(toJson());
|
||||
|
||||
static Action? fromJson(Map<String, dynamic> json) {
|
||||
// Safely extract required fields with null checks
|
||||
final String? actionExecutor = json["actionExecutor"] as String?;
|
||||
final String? entityId = json["entityId"] as String?;
|
||||
final String? productType = json['productType'] as String?;
|
||||
final String? deviceName = json['deviceName'] as String?;
|
||||
|
||||
// Skip invalid actions with missing required fields
|
||||
if (actionExecutor == null ||
|
||||
entityId == null ||
|
||||
productType == null ||
|
||||
deviceName == null) {
|
||||
|
||||
if (actionExecutor == null || entityId == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Handle actions with 'name' and 'type'
|
||||
if (json['name'] != null && json['type'] != null) {
|
||||
return Action(
|
||||
actionExecutor: actionExecutor,
|
||||
entityId: entityId,
|
||||
name: json['name'] as String?,
|
||||
type: json['type'] as String?,
|
||||
productType: productType,
|
||||
deviceName: deviceName,
|
||||
);
|
||||
}
|
||||
|
||||
// Handle actions with 'executorProperty'
|
||||
if (json["executorProperty"] != null) {
|
||||
return Action(
|
||||
actionExecutor: actionExecutor,
|
||||
entityId: entityId,
|
||||
executorProperty: ExecutorProperty.fromJson(json["executorProperty"]),
|
||||
productType: productType,
|
||||
deviceName: deviceName,
|
||||
);
|
||||
}
|
||||
|
||||
return null; // Skip invalid actions
|
||||
return Action(
|
||||
actionExecutor: actionExecutor,
|
||||
entityId: entityId,
|
||||
executorProperty: json["executorProperty"] != null
|
||||
? ExecutorProperty.fromJson(json["executorProperty"])
|
||||
: null,
|
||||
name: json['name'] as String?,
|
||||
type: json['type'] as String?,
|
||||
productType: json['productType'] as String? ?? 'unknown',
|
||||
deviceName: json['deviceName'] as String? ?? 'Delay Action',
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
|
||||
@ -0,0 +1,243 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_app/features/scene/bloc/create_scene/create_scene_bloc.dart';
|
||||
import 'package:syncrow_app/features/scene/model/scene_static_function.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/title_medium.dart';
|
||||
import 'package:syncrow_app/utils/context_extension.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||
|
||||
class AlertDialogCounterSteps extends StatefulWidget {
|
||||
const AlertDialogCounterSteps({
|
||||
super.key,
|
||||
this.functionValue,
|
||||
required this.taskItem,
|
||||
required this.isAutomation,
|
||||
});
|
||||
|
||||
final dynamic functionValue;
|
||||
final SceneStaticFunction taskItem;
|
||||
final bool isAutomation;
|
||||
|
||||
@override
|
||||
State<AlertDialogCounterSteps> createState() =>
|
||||
_AlertDialogCounterStepsState();
|
||||
}
|
||||
|
||||
class _AlertDialogCounterStepsState extends State<AlertDialogCounterSteps> {
|
||||
double? groupValue;
|
||||
int selectedToggleIndex = 1;
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
final createSceneBloc = context.read<CreateSceneBloc>();
|
||||
|
||||
if (widget.taskItem.comparator != null) {
|
||||
selectedToggleIndex = _comparatorToIndex(widget.taskItem.comparator);
|
||||
}
|
||||
|
||||
if (widget.isAutomation) {
|
||||
final automationTempTaskList = createSceneBloc.automationTempTasksList;
|
||||
final automationComparatorValues =
|
||||
createSceneBloc.automationComparatorValues;
|
||||
|
||||
for (var element in automationTempTaskList) {
|
||||
if (element.code == widget.taskItem.code) {
|
||||
groupValue = element.functionValue;
|
||||
selectedToggleIndex =
|
||||
_comparatorToIndex(automationComparatorValues[element.code]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (widget.taskItem.code == 'temp_current') {
|
||||
groupValue = widget.functionValue != null
|
||||
? _normalizeValue(
|
||||
double.tryParse(widget.functionValue.toString()) ??
|
||||
widget.taskItem.operationalValues[0].minValue,
|
||||
)
|
||||
: widget.taskItem.operationalValues[0].minValue;
|
||||
} else {
|
||||
groupValue = widget.functionValue != null
|
||||
? _normalizeValue(widget.functionValue)
|
||||
: _normalizeValue(widget.taskItem.operationalValues[0].minValue);
|
||||
}
|
||||
|
||||
setState(() {});
|
||||
|
||||
context.read<CreateSceneBloc>().add(
|
||||
SelectedValueEvent(
|
||||
value: _deNormalizeValue(groupValue),
|
||||
code: widget.taskItem.code,
|
||||
isAutomation: widget.isAutomation,
|
||||
comparator: _indexToComparator(selectedToggleIndex),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
int _comparatorToIndex(String? comparator) {
|
||||
switch (comparator) {
|
||||
case "<":
|
||||
return 0;
|
||||
case "==":
|
||||
return 1;
|
||||
case ">":
|
||||
return 2;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
String _indexToComparator(int index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
return "<";
|
||||
case 1:
|
||||
return "==";
|
||||
case 2:
|
||||
return ">";
|
||||
default:
|
||||
return "==";
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (widget.isAutomation)
|
||||
ToggleButtons(
|
||||
isSelected: [
|
||||
selectedToggleIndex == 0,
|
||||
selectedToggleIndex == 1,
|
||||
selectedToggleIndex == 2,
|
||||
],
|
||||
onPressed: (index) {
|
||||
setState(() {
|
||||
selectedToggleIndex = index;
|
||||
});
|
||||
context.read<CreateSceneBloc>().add(
|
||||
SelectedValueEvent(
|
||||
value: _deNormalizeValue(groupValue),
|
||||
code: widget.taskItem.code,
|
||||
isAutomation: widget.isAutomation,
|
||||
comparator: _indexToComparator(selectedToggleIndex),
|
||||
),
|
||||
);
|
||||
},
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
selectedColor: Colors.white,
|
||||
color: ColorsManager.blackColor,
|
||||
fillColor: ColorsManager.primaryColorWithOpacity,
|
||||
borderColor: ColorsManager.greyColor,
|
||||
constraints: BoxConstraints.tight(Size(70, 30)),
|
||||
children: const [
|
||||
SizedBox(width: 70, height: 30, child: Center(child: Text("<"))),
|
||||
SizedBox(width: 70, height: 30, child: Center(child: Text("="))),
|
||||
SizedBox(width: 70, height: 30, child: Center(child: Text(">"))),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
...widget.taskItem.operationalValues.map(
|
||||
(operation) => BlocBuilder<CreateSceneBloc, CreateSceneState>(
|
||||
builder: (context, state) {
|
||||
final step = operation.stepValue?.toDouble() ?? 1.0;
|
||||
final min = operation.minValue?.toDouble() ?? 0.0;
|
||||
final max = operation.maxValue?.toDouble() ?? 100.0;
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
const SizedBox(height: 12),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.remove),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
groupValue =
|
||||
((groupValue ?? min) - step).clamp(min, max);
|
||||
});
|
||||
context.read<CreateSceneBloc>().add(
|
||||
SelectedValueEvent(
|
||||
value: _deNormalizeValue(groupValue),
|
||||
code: widget.taskItem.code,
|
||||
isAutomation: widget.isAutomation,
|
||||
comparator:
|
||||
_indexToComparator(selectedToggleIndex),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
TitleMedium(
|
||||
text: groupValue != null
|
||||
? (groupValue! % 1 == 0
|
||||
? groupValue!.toStringAsFixed(0)
|
||||
: groupValue!.toStringAsFixed(1))
|
||||
: "0",
|
||||
style: context.titleMedium.copyWith(
|
||||
color: ColorsManager.primaryColorWithOpacity,
|
||||
fontSize: 30,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
TitleMedium(
|
||||
text: operation.description.toString(),
|
||||
style: context.titleMedium.copyWith(
|
||||
color: ColorsManager.primaryColorWithOpacity,
|
||||
fontSize: 30,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.add),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
groupValue =
|
||||
((groupValue ?? 0) + step).clamp(min, max);
|
||||
});
|
||||
context.read<CreateSceneBloc>().add(
|
||||
SelectedValueEvent(
|
||||
value: _deNormalizeValue(groupValue),
|
||||
code: widget.taskItem.code,
|
||||
isAutomation: widget.isAutomation,
|
||||
comparator:
|
||||
_indexToComparator(selectedToggleIndex),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
double _normalizeValue(dynamic value) {
|
||||
if ((widget.taskItem.code == "temp_set" && value > 199) ||
|
||||
(widget.taskItem.code == "temp_current" && value >= -99.0)) {
|
||||
return (value) / 10;
|
||||
}
|
||||
return value.toDouble();
|
||||
}
|
||||
|
||||
double _deNormalizeValue(double? value) {
|
||||
if (widget.taskItem.code == "temp_set" ||
|
||||
widget.taskItem.code == "temp_current") {
|
||||
return (value ?? 0) * 10;
|
||||
}
|
||||
return value ?? 0;
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user