mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-08-26 07:29:40 +00:00
issue fixes
This commit is contained in:
@ -47,6 +47,7 @@ class SixSceneBloc extends Bloc<SixSceneEvent, SixSceneState> {
|
|||||||
on<FetchRoomsEvent>(_fetchRoomsAndDevices);
|
on<FetchRoomsEvent>(_fetchRoomsAndDevices);
|
||||||
on<SixSceneInitialQuestion>(_onSixSceneInitial);
|
on<SixSceneInitialQuestion>(_onSixSceneInitial);
|
||||||
on<DeleteDeviceEvent>(deleteDevice);
|
on<DeleteDeviceEvent>(deleteDevice);
|
||||||
|
on<ToggleEnableAlarmEvent>(_toggleLowBattery);
|
||||||
}
|
}
|
||||||
|
|
||||||
final TextEditingController nameController =
|
final TextEditingController nameController =
|
||||||
@ -101,6 +102,19 @@ class SixSceneBloc extends Bloc<SixSceneEvent, SixSceneState> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
bool enableAlarm = false;
|
||||||
|
|
||||||
|
void _toggleLowBattery(
|
||||||
|
ToggleEnableAlarmEvent event, Emitter<SixSceneState> emit) async {
|
||||||
|
emit(LoadingNewSate(device: deviceStatus));
|
||||||
|
try {
|
||||||
|
enableAlarm = event.isLowBatteryEnabled;
|
||||||
|
emit(UpdateState(device: deviceStatus));
|
||||||
|
} catch (e) {
|
||||||
|
emit(SixSceneFailedState(errorMessage: e.toString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
List<SubSpaceModel> roomsList = [];
|
List<SubSpaceModel> roomsList = [];
|
||||||
|
|
||||||
void _fetchRoomsAndDevices(
|
void _fetchRoomsAndDevices(
|
||||||
|
@ -48,6 +48,7 @@ class FourSceneBloc extends Bloc<FourSceneEvent, FourSceneState> {
|
|||||||
on<GetSceneBySwitchName>(getSceneByName);
|
on<GetSceneBySwitchName>(getSceneByName);
|
||||||
on<SelectSceneEvent>(_selectScene);
|
on<SelectSceneEvent>(_selectScene);
|
||||||
on<DeleteDeviceEvent>(deleteDevice);
|
on<DeleteDeviceEvent>(deleteDevice);
|
||||||
|
on<ToggleEnableAlarmEvent>(_toggleLowBattery);
|
||||||
}
|
}
|
||||||
|
|
||||||
final TextEditingController nameController =
|
final TextEditingController nameController =
|
||||||
@ -144,6 +145,7 @@ class FourSceneBloc extends Bloc<FourSceneEvent, FourSceneState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool selecedScene = false;
|
bool selecedScene = false;
|
||||||
|
bool enableAlarm = false;
|
||||||
|
|
||||||
String _selectedOption = '';
|
String _selectedOption = '';
|
||||||
bool _hasSelectionChanged = false;
|
bool _hasSelectionChanged = false;
|
||||||
@ -259,6 +261,18 @@ class FourSceneBloc extends Bloc<FourSceneEvent, FourSceneState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void _toggleLowBattery(
|
||||||
|
ToggleEnableAlarmEvent event, Emitter<FourSceneState> emit) async {
|
||||||
|
emit(LoadingNewSate(device: deviceStatus));
|
||||||
|
try {
|
||||||
|
enableAlarm = event.isLowBatteryEnabled;
|
||||||
|
emit(UpdateState(device: deviceStatus));
|
||||||
|
} catch (e) {
|
||||||
|
emit(FourSceneFailedState(errorMessage: e.toString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// void _controlDevice(
|
// void _controlDevice(
|
||||||
// ControlDeviceScene event, Emitter<FourSceneState> emit) async {
|
// ControlDeviceScene event, Emitter<FourSceneState> emit) async {
|
||||||
// emit(FourSceneLoadingState());
|
// emit(FourSceneLoadingState());
|
||||||
@ -320,7 +334,7 @@ class FourSceneBloc extends Bloc<FourSceneEvent, FourSceneState> {
|
|||||||
ToggleNotificationEvent event, Emitter<FourSceneState> emit) async {
|
ToggleNotificationEvent event, Emitter<FourSceneState> emit) async {
|
||||||
emit(LoadingNewSate(device: deviceStatus));
|
emit(LoadingNewSate(device: deviceStatus));
|
||||||
try {
|
try {
|
||||||
closingReminder = event.isClosingEnabled;
|
enableAlarm = event.isClosingEnabled;
|
||||||
emit(UpdateState(device: deviceStatus));
|
emit(UpdateState(device: deviceStatus));
|
||||||
// API call to update the state, if necessary
|
// API call to update the state, if necessary
|
||||||
// await DevicesAPI.controlDevice(
|
// await DevicesAPI.controlDevice(
|
||||||
@ -483,6 +497,7 @@ class FourSceneBloc extends Bloc<FourSceneEvent, FourSceneState> {
|
|||||||
}
|
}
|
||||||
emit(UpdateStateList(groupDevices: groupDevices, devices: devices));
|
emit(UpdateStateList(groupDevices: groupDevices, devices: devices));
|
||||||
}
|
}
|
||||||
|
|
||||||
void _assignDevice(
|
void _assignDevice(
|
||||||
AssignRoomEvent event, Emitter<FourSceneState> emit) async {
|
AssignRoomEvent event, Emitter<FourSceneState> emit) async {
|
||||||
try {
|
try {
|
||||||
|
@ -38,12 +38,13 @@ class SosBloc extends Bloc<SosEvent, SosState> {
|
|||||||
on<SaveSelectionEvent>(_onSaveSelection);
|
on<SaveSelectionEvent>(_onSaveSelection);
|
||||||
on<AssignRoomEvent>(_assignDevice);
|
on<AssignRoomEvent>(_assignDevice);
|
||||||
on<SosInitialDeviseInfo>(fetchDeviceInfo);
|
on<SosInitialDeviseInfo>(fetchDeviceInfo);
|
||||||
|
on<SaveNameEvent>(saveName);
|
||||||
// on<UnassignRoomEvent>(_unassignDevice);
|
// on<UnassignRoomEvent>(_unassignDevice);
|
||||||
// on<ToggleWaterLeakAlarmEvent>(_toggleWaterLeakAlarm);
|
// on<ToggleWaterLeakAlarmEvent>(_toggleWaterLeakAlarm);
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
@ -52,7 +53,7 @@ class SosBloc extends Bloc<SosEvent, SosState> {
|
|||||||
bool closingReminder = false;
|
bool closingReminder = false;
|
||||||
bool waterAlarm = false;
|
bool waterAlarm = false;
|
||||||
SosModel deviceStatus =
|
SosModel deviceStatus =
|
||||||
SosModel(sosContactState: 'normal', batteryPercentage: 0);
|
SosModel(sosContactState: 'sos', batteryPercentage: 0);
|
||||||
|
|
||||||
void _fetchStatus(SosInitial event, Emitter<SosState> emit) async {
|
void _fetchStatus(SosInitial event, Emitter<SosState> emit) async {
|
||||||
emit(SosLoadingState());
|
emit(SosLoadingState());
|
||||||
@ -156,16 +157,6 @@ class SosBloc extends Bloc<SosEvent, SosState> {
|
|||||||
try {
|
try {
|
||||||
closingReminder = event.isClosingReminderEnabled;
|
closingReminder = event.isClosingReminderEnabled;
|
||||||
emit(UpdateState(sensor: deviceStatus));
|
emit(UpdateState(sensor: deviceStatus));
|
||||||
|
|
||||||
// API call to update the state, if necessary
|
|
||||||
// await DevicesAPI.controlDevice(
|
|
||||||
// DeviceControlModel(
|
|
||||||
// deviceId: sosId,
|
|
||||||
// code: 'closing_reminder',
|
|
||||||
// value: closingReminder,
|
|
||||||
// ),
|
|
||||||
// sosId,
|
|
||||||
// );
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit(SosFailedState(errorMessage: e.toString()));
|
emit(SosFailedState(errorMessage: e.toString()));
|
||||||
}
|
}
|
||||||
|
@ -71,9 +71,13 @@ class SixSceneInfoPage extends StatelessWidget {
|
|||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
BodySmall(
|
SizedBox(
|
||||||
text: _bloc.deviceInfo.productUuid,
|
width:
|
||||||
fontColor: ColorsManager.primaryTextColor,
|
MediaQuery.of(context).size.width * 0.61,
|
||||||
|
child: BodySmall(
|
||||||
|
text: _bloc.deviceInfo.productUuid,
|
||||||
|
fontColor: ColorsManager.primaryTextColor,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
@ -194,7 +194,12 @@ class SixSceneSettings extends StatelessWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
SettingWidget(
|
SettingWidget(
|
||||||
onChanged: (p0) {},
|
value: _bloc.enableAlarm,
|
||||||
|
onChanged: (p0) {
|
||||||
|
context
|
||||||
|
.read<SixSceneBloc>()
|
||||||
|
.add(ToggleEnableAlarmEvent(p0));
|
||||||
|
},
|
||||||
isNotification: true,
|
isNotification: true,
|
||||||
onTap: () {},
|
onTap: () {},
|
||||||
text: 'Offline Notification',
|
text: 'Offline Notification',
|
||||||
@ -430,6 +435,7 @@ class SixSceneSettings extends StatelessWidget {
|
|||||||
class SettingWidget extends StatelessWidget {
|
class SettingWidget extends StatelessWidget {
|
||||||
final String? text;
|
final String? text;
|
||||||
final bool? isUpdate;
|
final bool? isUpdate;
|
||||||
|
final bool? value;
|
||||||
final bool? isNotification;
|
final bool? isNotification;
|
||||||
final String? icon;
|
final String? icon;
|
||||||
final Function()? onTap;
|
final Function()? onTap;
|
||||||
@ -440,6 +446,7 @@ class SettingWidget extends StatelessWidget {
|
|||||||
this.text,
|
this.text,
|
||||||
this.icon,
|
this.icon,
|
||||||
this.onTap,
|
this.onTap,
|
||||||
|
this.value,
|
||||||
this.isUpdate,
|
this.isUpdate,
|
||||||
this.onChanged,
|
this.onChanged,
|
||||||
this.isNotification = false,
|
this.isNotification = false,
|
||||||
@ -502,7 +509,7 @@ class SettingWidget extends StatelessWidget {
|
|||||||
: Transform.scale(
|
: Transform.scale(
|
||||||
scale: .8,
|
scale: .8,
|
||||||
child: CupertinoSwitch(
|
child: CupertinoSwitch(
|
||||||
value: true,
|
value: value!,
|
||||||
onChanged: onChanged,
|
onChanged: onChanged,
|
||||||
applyTheme: true,
|
applyTheme: true,
|
||||||
),
|
),
|
||||||
|
@ -24,50 +24,54 @@ class SixSceneScreen extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return DefaultScaffold(
|
return BlocProvider(
|
||||||
title: '6 Scene Switch',
|
create: (context) => SixSceneBloc(sixSceneId: device?.uuid ?? '')
|
||||||
actions: [
|
..add(const SixSceneInitial())
|
||||||
InkWell(
|
..add(const SixSceneInitialInfo())
|
||||||
onTap: () {
|
..add(const SexSceneSwitchInitial()),
|
||||||
Navigator.of(context).push(
|
child: BlocBuilder<SixSceneBloc, SixSceneState>(
|
||||||
MaterialPageRoute(
|
builder: (context, state) {
|
||||||
builder: (context) => SixSceneSettings(device: device!)),
|
final _bloc = BlocProvider.of<SixSceneBloc>(context);
|
||||||
);
|
|
||||||
},
|
|
||||||
child: SvgPicture.asset(Assets.assetsIconsSettings)),
|
|
||||||
const SizedBox(
|
|
||||||
width: 10,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
child: BlocProvider(
|
|
||||||
create: (context) => SixSceneBloc(sixSceneId: device?.uuid ?? '')
|
|
||||||
..add(const SixSceneInitial())
|
|
||||||
..add(const SixSceneInitialInfo())
|
|
||||||
..add(const SexSceneSwitchInitial()),
|
|
||||||
child: BlocBuilder<SixSceneBloc, SixSceneState>(
|
|
||||||
builder: (context, state) {
|
|
||||||
final _bloc = BlocProvider.of<SixSceneBloc>(context);
|
|
||||||
SixSceneModel model = SixSceneModel(
|
|
||||||
scene_1: '',
|
|
||||||
scene_2: '',
|
|
||||||
scene_3: '',
|
|
||||||
scene_4: '',
|
|
||||||
scene_5: '',
|
|
||||||
scene_6: '',
|
|
||||||
scene_id_group_id: '',
|
|
||||||
switch_backlight: '');
|
|
||||||
|
|
||||||
if (state is LoadingNewSate) {
|
SixSceneModel model = SixSceneModel(
|
||||||
model = state.device;
|
scene_1: '',
|
||||||
} else if (state is UpdateState) {
|
scene_2: '',
|
||||||
model = state.device;
|
scene_3: '',
|
||||||
}
|
scene_4: '',
|
||||||
return state is SixSceneLoadingState
|
scene_5: '',
|
||||||
|
scene_6: '',
|
||||||
|
scene_id_group_id: '',
|
||||||
|
switch_backlight: '',
|
||||||
|
);
|
||||||
|
|
||||||
|
if (state is LoadingNewSate) {
|
||||||
|
model = state.device;
|
||||||
|
} else if (state is UpdateState) {
|
||||||
|
model = state.device;
|
||||||
|
}
|
||||||
|
|
||||||
|
return DefaultScaffold(
|
||||||
|
title: _bloc.deviceInfo.subspace.subspaceName,
|
||||||
|
actions: [
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context).push(
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => SixSceneSettings(device: device!),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: SvgPicture.asset(Assets.assetsIconsSettings),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
],
|
||||||
|
child: state is SixSceneLoadingState
|
||||||
? const Center(
|
? const Center(
|
||||||
child: DefaultContainer(
|
child: DefaultContainer(
|
||||||
width: 50,
|
width: 50,
|
||||||
height: 50,
|
height: 50,
|
||||||
child: CircularProgressIndicator()),
|
child: CircularProgressIndicator(),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
: RefreshIndicator(
|
: RefreshIndicator(
|
||||||
onRefresh: () async {
|
onRefresh: () async {
|
||||||
@ -86,30 +90,24 @@ class SixSceneScreen extends StatelessWidget {
|
|||||||
switch4Title: model.scene_4,
|
switch4Title: model.scene_4,
|
||||||
switch5Title: model.scene_5,
|
switch5Title: model.scene_5,
|
||||||
switch6Title: model.scene_6,
|
switch6Title: model.scene_6,
|
||||||
switch1Down:
|
switch1Down: _bloc.deviceStatus.switch_backlight
|
||||||
_bloc.deviceStatus.switch_backlight == true
|
? Assets.switchOn
|
||||||
? Assets.switchOn
|
: Assets.switchOff,
|
||||||
: Assets.switchOff,
|
switch1Up: _bloc.deviceStatus.switch_backlight
|
||||||
switch1Up:
|
? Assets.switchOn
|
||||||
_bloc.deviceStatus.switch_backlight == true
|
: Assets.switchOff,
|
||||||
? Assets.switchOn
|
switch2Down: _bloc.deviceStatus.switch_backlight
|
||||||
: Assets.switchOff,
|
? Assets.switchOn
|
||||||
switch2Down:
|
: Assets.switchOff,
|
||||||
_bloc.deviceStatus.switch_backlight == true
|
switch2Up: _bloc.deviceStatus.switch_backlight
|
||||||
? Assets.switchOn
|
? Assets.switchOn
|
||||||
: Assets.switchOff,
|
: Assets.switchOff,
|
||||||
switch2Up:
|
switch3Up: _bloc.deviceStatus.switch_backlight
|
||||||
_bloc.deviceStatus.switch_backlight == true
|
? Assets.switchOn
|
||||||
? Assets.switchOn
|
: Assets.switchOff,
|
||||||
: Assets.switchOff,
|
switch3Down: _bloc.deviceStatus.switch_backlight
|
||||||
switch3Up:
|
? Assets.switchOn
|
||||||
_bloc.deviceStatus.switch_backlight == true
|
: Assets.switchOff,
|
||||||
? Assets.switchOn
|
|
||||||
: Assets.switchOff,
|
|
||||||
switch3Down:
|
|
||||||
_bloc.deviceStatus.switch_backlight == true
|
|
||||||
? Assets.switchOn
|
|
||||||
: Assets.switchOff,
|
|
||||||
onSwitch3DownTap: () {
|
onSwitch3DownTap: () {
|
||||||
debugPrint("onSwitch3DownTap");
|
debugPrint("onSwitch3DownTap");
|
||||||
},
|
},
|
||||||
@ -136,7 +134,6 @@ class SixSceneScreen extends StatelessWidget {
|
|||||||
child: DefaultContainer(
|
child: DefaultContainer(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
_bloc.add(ChangeSwitchStatusEvent());
|
_bloc.add(ChangeSwitchStatusEvent());
|
||||||
|
|
||||||
},
|
},
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
@ -146,13 +143,13 @@ class SixSceneScreen extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
ConstrainedBox(
|
ConstrainedBox(
|
||||||
constraints: const BoxConstraints(
|
constraints: const BoxConstraints(
|
||||||
maxHeight: 46, maxWidth: 50),
|
maxHeight: 46,
|
||||||
|
maxWidth: 50,
|
||||||
|
),
|
||||||
child: SvgPicture.asset(
|
child: SvgPicture.asset(
|
||||||
Assets.backlightIcon),
|
Assets.backlightIcon),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(height: 15),
|
||||||
height: 15,
|
|
||||||
),
|
|
||||||
const Flexible(
|
const Flexible(
|
||||||
child: FittedBox(
|
child: FittedBox(
|
||||||
child: BodySmall(
|
child: BodySmall(
|
||||||
@ -165,9 +162,7 @@ class SixSceneScreen extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(width: 10),
|
||||||
width: 10,
|
|
||||||
),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: DefaultContainer(
|
child: DefaultContainer(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
@ -187,12 +182,12 @@ class SixSceneScreen extends StatelessWidget {
|
|||||||
confirmTab: (v) {
|
confirmTab: (v) {
|
||||||
Navigator.of(context).push(
|
Navigator.of(context).push(
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
SixSelectSceneFourPage(
|
SixSelectSceneFourPage(
|
||||||
deviceId:
|
deviceId: device!.uuid,
|
||||||
device!.uuid,
|
switchSelected: v,
|
||||||
switchSelected: v,
|
),
|
||||||
)),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -214,13 +209,13 @@ class SixSceneScreen extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
ConstrainedBox(
|
ConstrainedBox(
|
||||||
constraints: const BoxConstraints(
|
constraints: const BoxConstraints(
|
||||||
maxHeight: 46, maxWidth: 50),
|
maxHeight: 46,
|
||||||
|
maxWidth: 50,
|
||||||
|
),
|
||||||
child: SvgPicture.asset(
|
child: SvgPicture.asset(
|
||||||
Assets.addSceneIcon),
|
Assets.addSceneIcon),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(height: 15),
|
||||||
height: 15,
|
|
||||||
),
|
|
||||||
const Flexible(
|
const Flexible(
|
||||||
child: FittedBox(
|
child: FittedBox(
|
||||||
child: BodySmall(
|
child: BodySmall(
|
||||||
@ -235,15 +230,15 @@ class SixSceneScreen extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
},
|
);
|
||||||
),
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -24,47 +24,52 @@ class FourSceneScreen extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return DefaultScaffold(
|
return BlocProvider(
|
||||||
title: '4 Scene Switch',
|
create: (context) => FourSceneBloc(fourSceneId: device?.uuid ?? '')
|
||||||
actions: [
|
..add(const FourSceneInitial())
|
||||||
InkWell(
|
..add(const FourSceneInitialInfo())
|
||||||
onTap: () {
|
..add(const FourSceneSwitchInitial()),
|
||||||
Navigator.of(context).push(
|
child: BlocBuilder<FourSceneBloc, FourSceneState>(
|
||||||
MaterialPageRoute(
|
builder: (context, state) {
|
||||||
builder: (context) => FourSceneSettings(device: device!)),
|
final _bloc = BlocProvider.of<FourSceneBloc>(context);
|
||||||
);
|
|
||||||
},
|
FourSceneModelState model = FourSceneModelState(
|
||||||
child: SvgPicture.asset(Assets.assetsIconsSettings)),
|
scene_1: '',
|
||||||
const SizedBox(
|
scene_2: '',
|
||||||
width: 10,
|
scene_3: '',
|
||||||
)
|
scene_4: '',
|
||||||
],
|
scene_id_group_id: '',
|
||||||
child: BlocProvider(
|
switch_backlight: '',
|
||||||
create: (context) => FourSceneBloc(fourSceneId: device?.uuid ?? '')
|
);
|
||||||
..add(const FourSceneInitial())
|
|
||||||
..add(const FourSceneInitialInfo())
|
if (state is LoadingNewSate) {
|
||||||
..add(const FourSceneSwitchInitial()),
|
model = state.device;
|
||||||
child: BlocBuilder<FourSceneBloc, FourSceneState>(
|
} else if (state is UpdateState) {
|
||||||
builder: (context, state) {
|
model = state.device;
|
||||||
final _bloc = BlocProvider.of<FourSceneBloc>(context);
|
}
|
||||||
FourSceneModelState model = FourSceneModelState(
|
|
||||||
scene_1: '',
|
return DefaultScaffold(
|
||||||
scene_2: '',
|
title: _bloc.deviceInfo.name,
|
||||||
scene_3: '',
|
actions: [
|
||||||
scene_4: '',
|
InkWell(
|
||||||
scene_id_group_id: '',
|
onTap: () {
|
||||||
switch_backlight: '');
|
Navigator.of(context).push(
|
||||||
if (state is LoadingNewSate) {
|
MaterialPageRoute(
|
||||||
model = state.device;
|
builder: (context) => FourSceneSettings(device: device!),
|
||||||
} else if (state is UpdateState) {
|
),
|
||||||
model = state.device;
|
);
|
||||||
}
|
},
|
||||||
return state is FourSceneLoadingState
|
child: SvgPicture.asset(Assets.assetsIconsSettings),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
],
|
||||||
|
child: state is FourSceneLoadingState
|
||||||
? const Center(
|
? const Center(
|
||||||
child: DefaultContainer(
|
child: DefaultContainer(
|
||||||
width: 50,
|
width: 50,
|
||||||
height: 50,
|
height: 50,
|
||||||
child: CircularProgressIndicator()),
|
child: CircularProgressIndicator(),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
: RefreshIndicator(
|
: RefreshIndicator(
|
||||||
onRefresh: () async {
|
onRefresh: () async {
|
||||||
@ -81,22 +86,18 @@ class FourSceneScreen extends StatelessWidget {
|
|||||||
title2: model.scene_2,
|
title2: model.scene_2,
|
||||||
title3: model.scene_3,
|
title3: model.scene_3,
|
||||||
title4: model.scene_4,
|
title4: model.scene_4,
|
||||||
switch1:
|
switch1: _bloc.deviceStatus.switch_backlight
|
||||||
_bloc.deviceStatus.switch_backlight == true
|
? Assets.switchOn
|
||||||
? Assets.switchOn
|
: Assets.switchOff,
|
||||||
: Assets.switchOff,
|
switch2: _bloc.deviceStatus.switch_backlight
|
||||||
switch2:
|
? Assets.switchOn
|
||||||
_bloc.deviceStatus.switch_backlight == true
|
: Assets.switchOff,
|
||||||
? Assets.switchOn
|
switch3: _bloc.deviceStatus.switch_backlight
|
||||||
: Assets.switchOff,
|
? Assets.switchOn
|
||||||
switch3:
|
: Assets.switchOff,
|
||||||
_bloc.deviceStatus.switch_backlight == true
|
switch4: _bloc.deviceStatus.switch_backlight
|
||||||
? Assets.switchOn
|
? Assets.switchOn
|
||||||
: Assets.switchOff,
|
: Assets.switchOff,
|
||||||
switch4:
|
|
||||||
_bloc.deviceStatus.switch_backlight == true
|
|
||||||
? Assets.switchOn
|
|
||||||
: Assets.switchOff,
|
|
||||||
onSwitch1UpTap: () {
|
onSwitch1UpTap: () {
|
||||||
debugPrint("Switch 1 Up tapped");
|
debugPrint("Switch 1 Up tapped");
|
||||||
},
|
},
|
||||||
@ -126,13 +127,13 @@ class FourSceneScreen extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
ConstrainedBox(
|
ConstrainedBox(
|
||||||
constraints: const BoxConstraints(
|
constraints: const BoxConstraints(
|
||||||
maxHeight: 46, maxWidth: 50),
|
maxHeight: 46,
|
||||||
|
maxWidth: 50,
|
||||||
|
),
|
||||||
child: SvgPicture.asset(
|
child: SvgPicture.asset(
|
||||||
Assets.backlightIcon),
|
Assets.backlightIcon),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(height: 15),
|
||||||
height: 15,
|
|
||||||
),
|
|
||||||
const Flexible(
|
const Flexible(
|
||||||
child: FittedBox(
|
child: FittedBox(
|
||||||
child: BodySmall(
|
child: BodySmall(
|
||||||
@ -145,9 +146,7 @@ class FourSceneScreen extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(width: 10),
|
||||||
width: 10,
|
|
||||||
),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: DefaultContainer(
|
child: DefaultContainer(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
@ -162,13 +161,17 @@ class FourSceneScreen extends StatelessWidget {
|
|||||||
cancelTab: () {
|
cancelTab: () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
confirmTab: (switchSelected) async {
|
confirmTab:
|
||||||
|
(switchSelected) async {
|
||||||
Navigator.of(context).push(
|
Navigator.of(context).push(
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
FourSelectSceneFourPage(
|
FourSelectSceneFourPage(
|
||||||
switchSelected:switchSelected,
|
switchSelected:
|
||||||
deviceId: device!.uuid)),
|
switchSelected,
|
||||||
|
deviceId: device!.uuid,
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -190,13 +193,13 @@ class FourSceneScreen extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
ConstrainedBox(
|
ConstrainedBox(
|
||||||
constraints: const BoxConstraints(
|
constraints: const BoxConstraints(
|
||||||
maxHeight: 46, maxWidth: 50),
|
maxHeight: 46,
|
||||||
|
maxWidth: 50,
|
||||||
|
),
|
||||||
child: SvgPicture.asset(
|
child: SvgPicture.asset(
|
||||||
Assets.addSceneIcon),
|
Assets.addSceneIcon),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(height: 15),
|
||||||
height: 15,
|
|
||||||
),
|
|
||||||
const Flexible(
|
const Flexible(
|
||||||
child: FittedBox(
|
child: FittedBox(
|
||||||
child: BodySmall(
|
child: BodySmall(
|
||||||
@ -211,19 +214,16 @@ class FourSceneScreen extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
},
|
);
|
||||||
),
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//MohaM&&&uba1
|
|
@ -69,9 +69,13 @@ class FourSceneInfoPage extends StatelessWidget {
|
|||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
BodySmall(
|
Container(
|
||||||
text: _bloc.deviceInfo.productUuid,
|
width:
|
||||||
fontColor: ColorsManager.primaryTextColor,
|
MediaQuery.of(context).size.width * 0.61,
|
||||||
|
child: BodySmall(
|
||||||
|
text: _bloc.deviceInfo.productUuid,
|
||||||
|
fontColor: ColorsManager.primaryTextColor,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
@ -144,6 +144,7 @@ class FourSceneProfilePage extends StatelessWidget {
|
|||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontColor: ColorsManager.grayColor,
|
fontColor: ColorsManager.grayColor,
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 7),
|
||||||
DefaultContainer(
|
DefaultContainer(
|
||||||
padding: const EdgeInsets.all(20),
|
padding: const EdgeInsets.all(20),
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
|
@ -207,7 +207,12 @@ class FourSceneSettings extends StatelessWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
SettingWidget(
|
SettingWidget(
|
||||||
onChanged: (p0) {},
|
value: _bloc.enableAlarm,
|
||||||
|
onChanged: (p0) {
|
||||||
|
context
|
||||||
|
.read<FourSceneBloc>()
|
||||||
|
.add(ToggleEnableAlarmEvent(p0));
|
||||||
|
},
|
||||||
isNotification: true,
|
isNotification: true,
|
||||||
onTap: () {},
|
onTap: () {},
|
||||||
text: 'Offline Notification',
|
text: 'Offline Notification',
|
||||||
@ -444,6 +449,7 @@ class FourSceneSettings extends StatelessWidget {
|
|||||||
class SettingWidget extends StatelessWidget {
|
class SettingWidget extends StatelessWidget {
|
||||||
final String? text;
|
final String? text;
|
||||||
final bool? isUpdate;
|
final bool? isUpdate;
|
||||||
|
final bool? value;
|
||||||
final bool? isNotification;
|
final bool? isNotification;
|
||||||
final String? icon;
|
final String? icon;
|
||||||
final Function()? onTap;
|
final Function()? onTap;
|
||||||
@ -453,6 +459,7 @@ class SettingWidget extends StatelessWidget {
|
|||||||
{super.key,
|
{super.key,
|
||||||
this.text,
|
this.text,
|
||||||
this.icon,
|
this.icon,
|
||||||
|
this.value,
|
||||||
this.onTap,
|
this.onTap,
|
||||||
this.isUpdate,
|
this.isUpdate,
|
||||||
this.onChanged,
|
this.onChanged,
|
||||||
@ -516,7 +523,7 @@ class SettingWidget extends StatelessWidget {
|
|||||||
: Transform.scale(
|
: Transform.scale(
|
||||||
scale: .8,
|
scale: .8,
|
||||||
child: CupertinoSwitch(
|
child: CupertinoSwitch(
|
||||||
value: true,
|
value: value!,
|
||||||
onChanged: onChanged,
|
onChanged: onChanged,
|
||||||
applyTheme: true,
|
applyTheme: true,
|
||||||
),
|
),
|
||||||
|
@ -18,45 +18,51 @@ import 'package:syncrow_app/generated/assets.dart';
|
|||||||
class SosScreen extends StatelessWidget {
|
class SosScreen extends StatelessWidget {
|
||||||
final DeviceModel? device;
|
final DeviceModel? device;
|
||||||
|
|
||||||
|
|
||||||
const SosScreen({super.key, this.device});
|
const SosScreen({super.key, this.device});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return DefaultScaffold(
|
return BlocProvider(
|
||||||
title: 'SOS',
|
create: (context) => SosBloc(sosId: device?.uuid ?? '')
|
||||||
actions: [
|
..add(const SosInitial())
|
||||||
InkWell(
|
..add(SosInitialDeviseInfo()),
|
||||||
onTap: () {
|
child: BlocBuilder<SosBloc, SosState>(
|
||||||
Navigator.of(context).push(
|
builder: (context, state) {
|
||||||
MaterialPageRoute(
|
final sensor = BlocProvider.of<SosBloc>(context);
|
||||||
builder: (context) => SosSettings(device: device!)),
|
// Default SOS model in case no state is loaded
|
||||||
);
|
SosModel model = SosModel(
|
||||||
},
|
batteryPercentage: 0,
|
||||||
child: SvgPicture.asset(Assets.assetsIconsSettings)),
|
sosContactState: '',
|
||||||
const SizedBox(
|
);
|
||||||
width: 10,
|
// Update the model based on the state
|
||||||
)
|
if (state is LoadingNewSate) {
|
||||||
],
|
model = state.sosSensor;
|
||||||
child: BlocProvider(
|
} else if (state is UpdateState) {
|
||||||
create: (context) =>
|
model = state.sensor;
|
||||||
SosBloc(sosId: device?.uuid ?? '')..add(const SosInitial()),
|
}
|
||||||
child: BlocBuilder<SosBloc, SosState>(
|
|
||||||
builder: (context, state) {
|
return DefaultScaffold(
|
||||||
final sensor = BlocProvider.of<SosBloc>(context);
|
title: sensor.deviceInfo.name,
|
||||||
SosModel model =
|
actions: [
|
||||||
SosModel(batteryPercentage: 0, sosContactState: 'normal');
|
InkWell(
|
||||||
if (state is LoadingNewSate) {
|
onTap: () {
|
||||||
model = state.sosSensor;
|
Navigator.of(context).push(
|
||||||
} else if (state is UpdateState) {
|
MaterialPageRoute(
|
||||||
model = state.sensor;
|
builder: (context) => SosSettings(device: device!),
|
||||||
}
|
),
|
||||||
return state is SosLoadingState
|
);
|
||||||
|
},
|
||||||
|
child: SvgPicture.asset(Assets.assetsIconsSettings),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
],
|
||||||
|
child: state is SosLoadingState
|
||||||
? const Center(
|
? const Center(
|
||||||
child: DefaultContainer(
|
child: DefaultContainer(
|
||||||
width: 50,
|
width: 50,
|
||||||
height: 50,
|
height: 50,
|
||||||
child: CircularProgressIndicator()),
|
child: CircularProgressIndicator(),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
: RefreshIndicator(
|
: RefreshIndicator(
|
||||||
onRefresh: () async {
|
onRefresh: () async {
|
||||||
@ -69,14 +75,17 @@ class SosScreen extends StatelessWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
BatteryBar(
|
BatteryBar(
|
||||||
batteryPercentage: model.batteryPercentage,
|
batteryPercentage:
|
||||||
|
sensor.deviceStatus.batteryPercentage,
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 4,
|
flex: 4,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
overlayColor: WidgetStateProperty.all(
|
overlayColor: MaterialStateProperty.all(
|
||||||
Colors.transparent),
|
Colors.transparent),
|
||||||
onTap: () {},
|
onTap: () {
|
||||||
|
// Add functionality for the main SOS button here
|
||||||
|
},
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
@ -111,7 +120,8 @@ class SosScreen extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
child: SvgPicture.asset(
|
child: SvgPicture.asset(
|
||||||
model.sosContactState == 'normal'
|
sensor.deviceStatus.sosContactState !=
|
||||||
|
'sos'
|
||||||
? Assets.redSos
|
? Assets.redSos
|
||||||
: Assets.greenSos,
|
: Assets.greenSos,
|
||||||
fit: BoxFit.fill,
|
fit: BoxFit.fill,
|
||||||
@ -129,9 +139,10 @@ class SosScreen extends StatelessWidget {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.of(context).push(
|
Navigator.of(context).push(
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
SosRecordsScreen(
|
SosRecordsScreen(
|
||||||
sosId: device!.uuid!)),
|
sosId: device!.uuid!),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -142,13 +153,13 @@ class SosScreen extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
ConstrainedBox(
|
ConstrainedBox(
|
||||||
constraints: const BoxConstraints(
|
constraints: const BoxConstraints(
|
||||||
maxHeight: 46, maxWidth: 50),
|
maxHeight: 46,
|
||||||
|
maxWidth: 50,
|
||||||
|
),
|
||||||
child: SvgPicture.asset(
|
child: SvgPicture.asset(
|
||||||
Assets.doorRecordsIcon),
|
Assets.doorRecordsIcon),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(height: 15),
|
||||||
height: 15,
|
|
||||||
),
|
|
||||||
const Flexible(
|
const Flexible(
|
||||||
child: FittedBox(
|
child: FittedBox(
|
||||||
child: BodySmall(
|
child: BodySmall(
|
||||||
@ -161,16 +172,15 @@ class SosScreen extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(width: 10),
|
||||||
width: 10,
|
|
||||||
),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: DefaultContainer(
|
child: DefaultContainer(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.of(context).push(
|
Navigator.of(context).push(
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
const AlarmManagementPage()),
|
const AlarmManagementPage(),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -181,13 +191,13 @@ class SosScreen extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
ConstrainedBox(
|
ConstrainedBox(
|
||||||
constraints: const BoxConstraints(
|
constraints: const BoxConstraints(
|
||||||
maxHeight: 46, maxWidth: 50),
|
maxHeight: 46,
|
||||||
|
maxWidth: 50,
|
||||||
|
),
|
||||||
child: SvgPicture.asset(Assets
|
child: SvgPicture.asset(Assets
|
||||||
.doorNotificationSetting),
|
.doorNotificationSetting),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(height: 15),
|
||||||
height: 15,
|
|
||||||
),
|
|
||||||
const Flexible(
|
const Flexible(
|
||||||
child: FittedBox(
|
child: FittedBox(
|
||||||
child: BodySmall(
|
child: BodySmall(
|
||||||
@ -202,15 +212,15 @@ class SosScreen extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
},
|
);
|
||||||
),
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -64,9 +64,13 @@ class SosInfoPage extends StatelessWidget {
|
|||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
BodySmall(
|
SizedBox(
|
||||||
text: _bloc.deviceInfo.productUuid,
|
width:
|
||||||
fontColor: ColorsManager.primaryTextColor,
|
MediaQuery.of(context).size.width * 0.61,
|
||||||
|
child: BodySmall(
|
||||||
|
text: _bloc.deviceInfo.productUuid,
|
||||||
|
fontColor: ColorsManager.primaryTextColor,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
@ -64,20 +64,11 @@ class SosProfilePage extends StatelessWidget {
|
|||||||
radius: 55,
|
radius: 55,
|
||||||
backgroundColor: ColorsManager.graysColor,
|
backgroundColor: ColorsManager.graysColor,
|
||||||
child: ClipOval(
|
child: ClipOval(
|
||||||
child: Column(
|
child: Center(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
child: SvgPicture.asset(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
Assets.sosProfileIcon,
|
||||||
children: [
|
fit: BoxFit.contain,
|
||||||
const SizedBox(
|
),
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
Center(
|
|
||||||
child: SvgPicture.asset(
|
|
||||||
Assets.fourSceneIcon,
|
|
||||||
fit: BoxFit.contain,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -139,6 +130,7 @@ class SosProfilePage extends StatelessWidget {
|
|||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontColor: ColorsManager.grayColor,
|
fontColor: ColorsManager.grayColor,
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 7),
|
||||||
DefaultContainer(
|
DefaultContainer(
|
||||||
padding: const EdgeInsets.all(20),
|
padding: const EdgeInsets.all(20),
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
|
@ -7,7 +7,6 @@ import 'package:syncrow_app/features/devices/bloc/sos_bloc/sos_event.dart';
|
|||||||
import 'package:syncrow_app/features/devices/bloc/sos_bloc/sos_state.dart';
|
import 'package:syncrow_app/features/devices/bloc/sos_bloc/sos_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/sos_model.dart';
|
import 'package:syncrow_app/features/devices/model/sos_model.dart';
|
||||||
import 'package:syncrow_app/features/devices/model/subspace_model.dart';
|
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/sos/sos_setting/delete_dialog.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/sos/sos_setting/delete_dialog.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/sos/sos_setting/sos_profile_page.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/sos/sos_setting/sos_profile_page.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/sos/sos_setting/faq_sos_page.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/sos/sos_setting/faq_sos_page.dart';
|
||||||
@ -62,14 +61,18 @@ class SosSettings extends StatelessWidget {
|
|||||||
vertical: 10,
|
vertical: 10,
|
||||||
),
|
),
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {
|
onTap: () async {
|
||||||
Navigator.of(context).push(
|
bool val = await Navigator.of(context).push(
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => SosProfilePage(
|
builder: (context) => SosProfilePage(
|
||||||
device: device,
|
device: device,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
if (val == true) {
|
||||||
|
_bloc.add(SosInitialDeviseInfo());
|
||||||
|
_bloc.add(const SosInitial());
|
||||||
|
}
|
||||||
},
|
},
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
@ -93,8 +96,8 @@ class SosSettings extends StatelessWidget {
|
|||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
const BodyMedium(
|
BodyMedium(
|
||||||
text: 'SOS',
|
text: _bloc.deviceInfo.name,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
@ -169,7 +172,21 @@ class SosSettings extends StatelessWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
SettingWidget(
|
SettingWidget(
|
||||||
onChanged: (p0) {},
|
value: _bloc.enableAlarm,
|
||||||
|
onChanged: (p0) {
|
||||||
|
context
|
||||||
|
.read<SosBloc>()
|
||||||
|
.add(ToggleEnableAlarmEvent(p0));
|
||||||
|
// Transform.scale(
|
||||||
|
// scale: .8,
|
||||||
|
// child: CupertinoSwitch(
|
||||||
|
// value: _bloc.enableAlarm,
|
||||||
|
// onChanged: (value) {
|
||||||
|
|
||||||
|
// },
|
||||||
|
// applyTheme: true,
|
||||||
|
// )),
|
||||||
|
},
|
||||||
isNotification: true,
|
isNotification: true,
|
||||||
onTap: () {},
|
onTap: () {},
|
||||||
text: 'Offline Notification',
|
text: 'Offline Notification',
|
||||||
@ -400,6 +417,7 @@ class SosSettings extends StatelessWidget {
|
|||||||
class SettingWidget extends StatelessWidget {
|
class SettingWidget extends StatelessWidget {
|
||||||
final String? text;
|
final String? text;
|
||||||
final bool? isUpdate;
|
final bool? isUpdate;
|
||||||
|
final bool? value;
|
||||||
final bool? isNotification;
|
final bool? isNotification;
|
||||||
final String? icon;
|
final String? icon;
|
||||||
final Function()? onTap;
|
final Function()? onTap;
|
||||||
@ -409,6 +427,7 @@ class SettingWidget extends StatelessWidget {
|
|||||||
{super.key,
|
{super.key,
|
||||||
this.text,
|
this.text,
|
||||||
this.icon,
|
this.icon,
|
||||||
|
this.value,
|
||||||
this.onTap,
|
this.onTap,
|
||||||
this.isUpdate,
|
this.isUpdate,
|
||||||
this.onChanged,
|
this.onChanged,
|
||||||
@ -472,7 +491,7 @@ class SettingWidget extends StatelessWidget {
|
|||||||
: Transform.scale(
|
: Transform.scale(
|
||||||
scale: .8,
|
scale: .8,
|
||||||
child: CupertinoSwitch(
|
child: CupertinoSwitch(
|
||||||
value: true,
|
value: value!,
|
||||||
onChanged: onChanged,
|
onChanged: onChanged,
|
||||||
applyTheme: true,
|
applyTheme: true,
|
||||||
),
|
),
|
||||||
|
Reference in New Issue
Block a user