mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-23 10:47:55 +00:00
sos
This commit is contained in:
@@ -305,20 +305,10 @@ class SosBloc extends Bloc<SosEvent, SosState> {
|
||||
allDevices.forEach((element) {
|
||||
allDevicesIds.add(element.uuid!);
|
||||
});
|
||||
emit(SaveSelectionSuccessState());
|
||||
await HomeCubit.getInstance().fetchUnitsByUserId();
|
||||
CustomSnackBar.displaySnackBar('Save Successfully');
|
||||
|
||||
// devicesList.forEach((e) {
|
||||
// if (allDevicesIds.contains(e.uuid!)) {
|
||||
// roomDevicesId[e.uuid!] = true;
|
||||
// } else {
|
||||
// roomDevicesId[e.uuid!] = false;
|
||||
// }
|
||||
// });
|
||||
// emit(FetchDeviceByRoomIdState(
|
||||
// roomDevices: devicesList,
|
||||
// allDevices: allDevices,
|
||||
// roomDevicesId: roomDevicesId,
|
||||
// roomId: event.roomId));
|
||||
emit(SaveSelectionSuccessState());
|
||||
} catch (e) {
|
||||
emit(const SosFailedState(errorMessage: 'Something went wrong'));
|
||||
return;
|
||||
@@ -465,4 +455,16 @@ class SosBloc extends Bloc<SosEvent, SosState> {
|
||||
emit(SosFailedState(errorMessage: e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
deleteDevice(DeleteDeviceEvent event, Emitter<SosState> emit) async {
|
||||
try {
|
||||
emit(SosLoadingState());
|
||||
var response = await DevicesAPI.resetDevise(devicesUuid: sosId);
|
||||
add(SosInitialDeviseInfo());
|
||||
add(const SosInitial());
|
||||
CustomSnackBar.displaySnackBar('Reset Successfully');
|
||||
} catch (e) {
|
||||
emit(SosFailedState(errorMessage: e.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ abstract class SosEvent extends Equatable {
|
||||
}
|
||||
|
||||
class SosLoading extends SosEvent {}
|
||||
class DeleteDeviceEvent extends SosLoading {}
|
||||
|
||||
class SosSwitch extends SosEvent {
|
||||
final String switchD;
|
||||
|
||||
@@ -82,6 +82,8 @@ class DeviceModel {
|
||||
tempIcon = Assets.fourSceneHomeIcon;
|
||||
} else if (type == DeviceType.SixScene) {
|
||||
tempIcon = Assets.sixSceneHomeIcon;
|
||||
} else if (type == DeviceType.SOS) {
|
||||
tempIcon = Assets.sosHomeIcon;
|
||||
} else {
|
||||
tempIcon = Assets.assetsIconsLogo;
|
||||
}
|
||||
|
||||
+3
@@ -61,6 +61,9 @@ class ShareSixScenePage extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.05,
|
||||
),
|
||||
const BodyLarge(
|
||||
text: 'Sharing Method Not Supported',
|
||||
fontSize: 15,
|
||||
|
||||
+95
-100
@@ -43,113 +43,108 @@ class FaqFourScenePage extends StatelessWidget {
|
||||
height: 50,
|
||||
child: CircularProgressIndicator()),
|
||||
)
|
||||
: RefreshIndicator(
|
||||
onRefresh: () async {
|
||||
// sensor.add(const SosInitial());
|
||||
},
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
DefaultContainer(
|
||||
padding: const EdgeInsets.all(5),
|
||||
child: TextFormField(
|
||||
controller: _searchController,
|
||||
onChanged: (value) {
|
||||
sensor.add(SearchFaqEvent(value));
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Enter your questions',
|
||||
hintStyle: const TextStyle(
|
||||
color: ColorsManager.textGray,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w400),
|
||||
suffixIcon: Container(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
margin: const EdgeInsets.all(10.0),
|
||||
child: SvgPicture.asset(
|
||||
Assets.searchIcon,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
DefaultContainer(
|
||||
padding: const EdgeInsets.all(5),
|
||||
child: TextFormField(
|
||||
controller: _searchController,
|
||||
onChanged: (value) {
|
||||
sensor.add(SearchFaqEvent(value));
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Enter your questions',
|
||||
hintStyle: const TextStyle(
|
||||
color: ColorsManager.textGray,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w400),
|
||||
suffixIcon: Container(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
margin: const EdgeInsets.all(10.0),
|
||||
child: SvgPicture.asset(
|
||||
Assets.searchIcon,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.04,
|
||||
),
|
||||
BodyMedium(
|
||||
text: _searchController.text.isEmpty
|
||||
? 'Device Related FAQs'
|
||||
: '${displayedQuestions.length} Help Topics',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 12,
|
||||
fontColor: ColorsManager.grayColor,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
displayedQuestions.isEmpty
|
||||
? const SizedBox()
|
||||
: DefaultContainer(
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: displayedQuestions.length,
|
||||
itemBuilder: (context, index) {
|
||||
final faq = displayedQuestions[index];
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
QuestionPageFourScene(
|
||||
questionModel: faq,
|
||||
)),
|
||||
);
|
||||
},
|
||||
child: SizedBox(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: BodyMedium(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
text: faq.question,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.04,
|
||||
),
|
||||
BodyMedium(
|
||||
text: _searchController.text.isEmpty
|
||||
? 'Device Related FAQs'
|
||||
: '${displayedQuestions.length} Help Topics',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 12,
|
||||
fontColor: ColorsManager.grayColor,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
displayedQuestions.isEmpty
|
||||
? const SizedBox()
|
||||
: DefaultContainer(
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: displayedQuestions.length,
|
||||
itemBuilder: (context, index) {
|
||||
final faq = displayedQuestions[index];
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
QuestionPageFourScene(
|
||||
questionModel: faq,
|
||||
)),
|
||||
);
|
||||
},
|
||||
child: SizedBox(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: BodyMedium(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
text: faq.question,
|
||||
),
|
||||
const Icon(
|
||||
Icons.keyboard_arrow_right,
|
||||
color: ColorsManager.textGray,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const Icon(
|
||||
Icons.keyboard_arrow_right,
|
||||
color: ColorsManager.textGray,
|
||||
),
|
||||
],
|
||||
),
|
||||
if (index !=
|
||||
displayedQuestions.length -
|
||||
1) // Exclude divider for the last item
|
||||
const Divider(
|
||||
color: ColorsManager.dividerColor,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (index !=
|
||||
displayedQuestions.length -
|
||||
1) // Exclude divider for the last item
|
||||
const Divider(
|
||||
color: ColorsManager.dividerColor,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
)),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
+3
@@ -56,6 +56,9 @@ class ShareFourScenePage extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.05,
|
||||
),
|
||||
const BodyLarge(
|
||||
text: 'Sharing Method Not Supported',
|
||||
fontSize: 15,
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
|
||||
import 'package:syncrow_app/features/devices/bloc/sos_bloc/sos_bloc.dart';
|
||||
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/model/device_model.dart';
|
||||
import 'package:syncrow_app/features/devices/model/sos_model.dart';
|
||||
import 'package:syncrow_app/features/menu/view/widgets/manage_home/home_settings.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/default_button.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
|
||||
import 'package:syncrow_app/utils/helpers/custom_page_route.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||
|
||||
class ShareSosPage extends StatelessWidget {
|
||||
@@ -19,6 +22,8 @@ class ShareSosPage extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var spaces = HomeCubit.getInstance().spaces;
|
||||
|
||||
return DefaultScaffold(
|
||||
title: 'Share Device',
|
||||
child: BlocProvider(
|
||||
@@ -48,6 +53,9 @@ class ShareSosPage extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.05,
|
||||
),
|
||||
const BodyLarge(
|
||||
text: 'Sharing Method Not Supported',
|
||||
fontSize: 15,
|
||||
@@ -87,7 +95,10 @@ class ShareSosPage extends StatelessWidget {
|
||||
backgroundColor: ColorsManager.blueColor1,
|
||||
borderRadius: 50,
|
||||
onPressed: () {
|
||||
|
||||
Navigator.of(context).push(CustomPageRoute(
|
||||
builder: (context) => HomeSettingsView(
|
||||
space: spaces!.first,
|
||||
)));
|
||||
},
|
||||
child: Text('Add Home Member')),
|
||||
),
|
||||
|
||||
@@ -59,15 +59,16 @@ class SosProfilePage extends StatelessWidget {
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 60,
|
||||
backgroundColor: Colors.white,
|
||||
backgroundColor: Colors.white.withOpacity(0),
|
||||
child: CircleAvatar(
|
||||
radius: 55,
|
||||
backgroundColor: ColorsManager.graysColor,
|
||||
child: ClipOval(
|
||||
child: Center(
|
||||
child: SvgPicture.asset(
|
||||
Assets.sosProfileIcon,
|
||||
fit: BoxFit.contain,
|
||||
Assets.sosHomeIcon,
|
||||
fit: BoxFit.fitHeight,
|
||||
height: 100,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -125,15 +125,16 @@ class SosSettings extends StatelessWidget {
|
||||
radius: 40,
|
||||
backgroundColor: Colors.white,
|
||||
child: CircleAvatar(
|
||||
radius: 40,
|
||||
backgroundColor: Colors.grey,
|
||||
child: ClipOval(
|
||||
child: SvgPicture.asset(
|
||||
Assets.sosProfileIcon,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
),
|
||||
),
|
||||
radius: 40,
|
||||
backgroundColor:
|
||||
Colors.white.withOpacity(0),
|
||||
child: ClipOval(
|
||||
child: SvgPicture.asset(
|
||||
Assets.sosHomeIcon,
|
||||
fit: BoxFit.contain,
|
||||
height: 80,
|
||||
),
|
||||
)),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -176,7 +177,6 @@ class SosSettings extends StatelessWidget {
|
||||
context
|
||||
.read<SosBloc>()
|
||||
.add(ToggleEnableAlarmEvent(p0));
|
||||
|
||||
},
|
||||
isNotification: true,
|
||||
onTap: () {},
|
||||
@@ -350,17 +350,8 @@ class SosSettings extends StatelessWidget {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
confirmTab: () {
|
||||
// context
|
||||
// .read<
|
||||
// CreateSceneBloc>()
|
||||
// .add(DeleteSceneEvent(
|
||||
// sceneId: sceneId,
|
||||
// unitUuid: HomeCubit
|
||||
// .getInstance()
|
||||
// .selectedSpace!
|
||||
// .id!,
|
||||
// ));
|
||||
Navigator.of(context).pop();
|
||||
_bloc.add(
|
||||
DeleteDeviceEvent());
|
||||
},
|
||||
);
|
||||
},
|
||||
|
||||
@@ -1123,4 +1123,6 @@ class Assets {
|
||||
static const String sixSceneHomeIcon = "assets/icons/six_scene_home_icon.svg";
|
||||
static const String editDeviceNameIcon =
|
||||
"assets/icons/edit_device_name_icon.svg";
|
||||
static const String sosHomeIcon =
|
||||
"assets/icons/sos_home_icon.svg";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user