Hide nonfunctional widgets

This commit is contained in:
Abdullah Alassaf
2024-12-15 02:22:11 +03:00
parent fc3f215dba
commit f81880a704
12 changed files with 735 additions and 920 deletions

View File

@ -123,9 +123,7 @@ class HomeCubit extends Cubit<HomeState> {
return; return;
} }
var userUuid = var userUuid = await const FlutterSecureStorage().read(key: UserModel.userUuidKey) ?? '';
await const FlutterSecureStorage().read(key: UserModel.userUuidKey) ??
'';
if (userUuid.isNotEmpty) { if (userUuid.isNotEmpty) {
await OneSignal.login(userUuid); await OneSignal.login(userUuid);
} }
@ -221,8 +219,7 @@ class HomeCubit extends Cubit<HomeState> {
//////////////////////////////////////// API //////////////////////////////////////// //////////////////////////////////////// API ////////////////////////////////////////
generateInvitation(SpaceModel unit) async { generateInvitation(SpaceModel unit) async {
try { try {
final invitationCode = final invitationCode = await SpacesAPI.generateInvitationCode(unit.id, unit.community.uuid);
await SpacesAPI.generateInvitationCode(unit.id, unit.community.uuid);
if (invitationCode.isNotEmpty) { if (invitationCode.isNotEmpty) {
Share.share('The invitation code is $invitationCode'); Share.share('The invitation code is $invitationCode');
CustomSnackBar.displaySnackBar( CustomSnackBar.displaySnackBar(
@ -238,9 +235,7 @@ class HomeCubit extends Cubit<HomeState> {
Future<bool> joinAUnit(String code) async { Future<bool> joinAUnit(String code) async {
try { try {
var userUuid = var userUuid = await const FlutterSecureStorage().read(key: UserModel.userUuidKey) ?? '';
await const FlutterSecureStorage().read(key: UserModel.userUuidKey) ??
'';
Map<String, String> body = {'inviteCode': code}; Map<String, String> body = {'inviteCode': code};
final success = await SpacesAPI.joinUnit(userUuid, body); final success = await SpacesAPI.joinUnit(userUuid, body);
@ -276,8 +271,7 @@ class HomeCubit extends Cubit<HomeState> {
fetchRoomsByUnitId(SpaceModel space) async { fetchRoomsByUnitId(SpaceModel space) async {
emitSafe(GetSpaceRoomsLoading()); emitSafe(GetSpaceRoomsLoading());
try { try {
space.subspaces = space.subspaces = await SpacesAPI.getSubSpaceBySpaceId(space.community.uuid, space.id);
await SpacesAPI.getSubSpaceBySpaceId(space.community.uuid, space.id);
} catch (failure) { } catch (failure) {
emitSafe(GetSpaceRoomsError(failure.toString())); emitSafe(GetSpaceRoomsError(failure.toString()));
return; return;
@ -359,8 +353,7 @@ class HomeCubit extends Cubit<HomeState> {
size: 32, size: 32,
), ),
style: ButtonStyle( style: ButtonStyle(
foregroundColor: foregroundColor: WidgetStateProperty.all(ColorsManager.textPrimaryColor),
WidgetStateProperty.all(ColorsManager.textPrimaryColor),
), ),
onPressed: () { onPressed: () {
Navigator.pushNamed( Navigator.pushNamed(
@ -381,35 +374,34 @@ class HomeCubit extends Cubit<HomeState> {
NavigationService.navigatorKey.currentContext! NavigationService.navigatorKey.currentContext!
.read<SmartSceneSelectBloc>() .read<SmartSceneSelectBloc>()
.add(const SmartSceneClearEvent()); .add(const SmartSceneClearEvent());
BlocProvider.of<EffectPeriodBloc>( BlocProvider.of<EffectPeriodBloc>(NavigationService.navigatorKey.currentState!.context)
NavigationService.navigatorKey.currentState!.context)
.add(ResetEffectivePeriod()); .add(ResetEffectivePeriod());
NavigationService.navigatorKey.currentContext! NavigationService.navigatorKey.currentContext!
.read<CreateSceneBloc>() .read<CreateSceneBloc>()
.add(const ClearTabToRunSetting()); .add(const ClearTabToRunSetting());
}, },
), ),
IconButton( // IconButton(
icon: const Icon( // icon: const Icon(
Icons.more_vert, // Icons.more_vert,
size: 28, // size: 28,
), // ),
style: ButtonStyle( // style: ButtonStyle(
foregroundColor: // foregroundColor:
WidgetStateProperty.all(ColorsManager.textPrimaryColor), // WidgetStateProperty.all(ColorsManager.textPrimaryColor),
), // ),
onPressed: () {}, // onPressed: () {},
), // ),
], ],
'Menu': [ 'Menu': [
IconButton( // IconButton(
icon: SvgPicture.asset( // icon: SvgPicture.asset(
Assets.assetsIconsScan, // Assets.assetsIconsScan,
height: 20, // height: 20,
width: 20, // width: 20,
), // ),
onPressed: () {}, // onPressed: () {},
), // ),
], ],
}; };
@ -429,8 +421,7 @@ class HomeCubit extends Cubit<HomeState> {
}; };
static var bottomNavItems = [ static var bottomNavItems = [
defaultBottomNavBarItem( defaultBottomNavBarItem(icon: Assets.assetsIconsDashboard, label: 'Dashboard'),
icon: Assets.assetsIconsDashboard, label: 'Dashboard'),
// defaultBottomNavBarItem(icon: Assets.assetsIconslayout, label: 'Layout'), // defaultBottomNavBarItem(icon: Assets.assetsIconslayout, label: 'Layout'),
defaultBottomNavBarItem(icon: Assets.assetsIconsDevices, label: 'Devices'), defaultBottomNavBarItem(icon: Assets.assetsIconsDevices, label: 'Devices'),
defaultBottomNavBarItem(icon: Assets.assetsIconsRoutines, label: 'Routine'), defaultBottomNavBarItem(icon: Assets.assetsIconsRoutines, label: 'Routine'),
@ -456,8 +447,7 @@ class HomeCubit extends Cubit<HomeState> {
void updateDevice(String deviceId) async { void updateDevice(String deviceId) async {
try { try {
final response = await DevicesAPI.firmwareDevice( final response = await DevicesAPI.firmwareDevice(deviceId: deviceId, firmwareVersion: '0');
deviceId: deviceId, firmwareVersion: '0');
if (response['success'] ?? false) { if (response['success'] ?? false) {
CustomSnackBar.displaySnackBar('No updates available'); CustomSnackBar.displaySnackBar('No updates available');
} }
@ -465,8 +455,7 @@ class HomeCubit extends Cubit<HomeState> {
} }
} }
BottomNavigationBarItem defaultBottomNavBarItem( BottomNavigationBarItem defaultBottomNavBarItem({required String icon, required String label}) {
{required String icon, required String label}) {
return BottomNavigationBarItem( return BottomNavigationBarItem(
icon: SvgPicture.asset(icon), icon: SvgPicture.asset(icon),
activeIcon: SvgPicture.asset( activeIcon: SvgPicture.asset(

View File

@ -31,8 +31,7 @@ class LoginView extends StatelessWidget {
// content: Text(state.message), // content: Text(state.message),
// ), // ),
// ); // );
} } else if (state is AuthLoginSuccess) {
else if (state is AuthLoginSuccess) {
Navigator.popAndPushNamed(context, Routes.homeRoute); Navigator.popAndPushNamed(context, Routes.homeRoute);
} }
}, },
@ -96,8 +95,8 @@ class LoginView extends StatelessWidget {
height: 20, height: 20,
), ),
const LoginForm(), const LoginForm(),
const LoginDivider(), // const LoginDivider(),
const LoginWithGoogleFacebook(), // const LoginWithGoogleFacebook(),
const DontHaveAnAccount(), const DontHaveAnAccount(),
], ],
), ),

View File

@ -38,10 +38,8 @@ class SettingProfilePage extends StatelessWidget {
final _bloc = BlocProvider.of<DeviceSettingBloc>(context); final _bloc = BlocProvider.of<DeviceSettingBloc>(context);
return state is DeviceSettingLoadingState return state is DeviceSettingLoadingState
? const Center( ? const Center(
child: DefaultContainer( child:
width: 50, DefaultContainer(width: 50, height: 50, child: CircularProgressIndicator()),
height: 50,
child: CircularProgressIndicator()),
) )
: RefreshIndicator( : RefreshIndicator(
onRefresh: () async { onRefresh: () async {
@ -57,18 +55,15 @@ class SettingProfilePage extends StatelessWidget {
child: SvgPicture.asset( child: SvgPicture.asset(
Assets.sosHomeIcon, Assets.sosHomeIcon,
fit: BoxFit.fitHeight, fit: BoxFit.fitHeight,
height: height: MediaQuery.of(context).size.height * 0.13,
MediaQuery.of(context).size.height * 0.13,
)) ))
: CircleAvatar( : CircleAvatar(
radius: 55, radius: 55,
backgroundColor: ColorsManager.graysColor, backgroundColor: ColorsManager.graysColor,
child: ClipOval( child: ClipOval(
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.center,
CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.center,
children: [ children: [
Center( Center(
child: SvgPicture.asset( child: SvgPicture.asset(
@ -76,10 +71,7 @@ class SettingProfilePage extends StatelessWidget {
? Assets.fourSceneIcon ? Assets.fourSceneIcon
: Assets.sixSceneIcon, : Assets.sixSceneIcon,
fit: BoxFit.contain, fit: BoxFit.contain,
height: MediaQuery.of(context) height: MediaQuery.of(context).size.height * 0.08,
.size
.height *
0.08,
), ),
), ),
], ],
@ -97,8 +89,7 @@ class SettingProfilePage extends StatelessWidget {
children: [ children: [
IntrinsicWidth( IntrinsicWidth(
child: ConstrainedBox( child: ConstrainedBox(
constraints: constraints: const BoxConstraints(maxWidth: 200),
const BoxConstraints(maxWidth: 200),
child: TextFormField( child: TextFormField(
maxLength: 30, maxLength: 30,
style: const TextStyle( style: const TextStyle(
@ -131,8 +122,7 @@ class SettingProfilePage extends StatelessWidget {
Assets.sosEditProfile, Assets.sosEditProfile,
color: Colors.grey, color: Colors.grey,
fit: BoxFit.contain, fit: BoxFit.contain,
height: MediaQuery.of(context).size.height * height: MediaQuery.of(context).size.height * 0.02,
0.02,
), ),
), ),
), ),
@ -151,14 +141,14 @@ class SettingProfilePage extends StatelessWidget {
padding: const EdgeInsets.all(20), padding: const EdgeInsets.all(20),
child: InkWell( child: InkWell(
onTap: () async { onTap: () async {
bool val = await Navigator.of(context).push( bool? val = await Navigator.of(context).push(
MaterialPageRoute( MaterialPageRoute(
builder: (context) => LocationSettingPage( builder: (context) => LocationSettingPage(
space: spaces!.first, space: spaces!.first,
deviceId: device?.uuid ?? '', deviceId: device?.uuid ?? '',
)), )),
); );
if (val == true) { if (val != null && val == true) {
_bloc.add(const DeviceSettingInitialInfo()); _bloc.add(const DeviceSettingInitialInfo());
} }
}, },
@ -172,8 +162,7 @@ class SettingProfilePage extends StatelessWidget {
children: [ children: [
SizedBox( SizedBox(
child: BodyMedium( child: BodyMedium(
text: _bloc text: _bloc.deviceInfo.subspace.subspaceName,
.deviceInfo.subspace.subspaceName,
fontColor: ColorsManager.textGray, fontColor: ColorsManager.textGray,
), ),
), ),

View File

@ -40,10 +40,8 @@ class SettingsPage extends StatelessWidget {
return state is DeviceSettingLoadingState return state is DeviceSettingLoadingState
? const Center( ? const Center(
child: DefaultContainer( child:
width: 50, DefaultContainer(width: 50, height: 50, child: CircularProgressIndicator()),
height: 50,
child: CircularProgressIndicator()),
) )
: ListView( : ListView(
children: [ children: [
@ -71,31 +69,25 @@ class SettingsPage extends StatelessWidget {
children: [ children: [
const SizedBox(height: 20), const SizedBox(height: 20),
DefaultContainer( DefaultContainer(
borderRadius: const BorderRadius.all( borderRadius: const BorderRadius.all(Radius.circular(30)),
Radius.circular(30)),
child: Padding( child: Padding(
padding: const EdgeInsets.all(10.0), padding: const EdgeInsets.all(10.0),
child: Padding( child: Padding(
padding: padding: const EdgeInsets.only(left: 90),
const EdgeInsets.only(left: 90),
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween,
children: [ children: [
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start,
children: [ children: [
SizedBox( SizedBox(
child: Text( child: Text(
_bloc.deviceInfo.name, _bloc.deviceInfo.name,
style: const TextStyle( style: const TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: fontWeight: FontWeight.w700,
FontWeight.w700, color: ColorsManager.grayColor,
color: ColorsManager
.grayColor,
), ),
overflow: TextOverflow overflow: TextOverflow
.ellipsis, // Adds ellipsis (...) when the text overflows. .ellipsis, // Adds ellipsis (...) when the text overflows.
@ -106,10 +98,7 @@ class SettingsPage extends StatelessWidget {
height: 5, height: 5,
), ),
BodySmall( BodySmall(
text: _bloc text: _bloc.deviceInfo.subspace.subspaceName),
.deviceInfo
.subspace
.subspaceName),
], ],
), ),
), ),
@ -136,13 +125,10 @@ class SettingsPage extends StatelessWidget {
backgroundColor: Colors.white, backgroundColor: Colors.white,
child: CircleAvatar( child: CircleAvatar(
radius: 40, radius: 40,
backgroundColor: backgroundColor: ColorsManager.backgroundColor,
ColorsManager.backgroundColor,
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.center,
CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.center,
children: [ children: [
device!.type == "SOS" device!.type == "SOS"
? ClipOval( ? ClipOval(
@ -153,20 +139,15 @@ class SettingsPage extends StatelessWidget {
), ),
) )
: Padding( : Padding(
padding: device!.type == padding: device!.type == "4S"
"4S" ? const EdgeInsets.only(top: 5)
? const EdgeInsets.only( : const EdgeInsets.only(top: 0),
top: 5)
: const EdgeInsets.only(
top: 0),
child: SizedBox( child: SizedBox(
height: 70, height: 70,
child: SvgPicture.asset( child: SvgPicture.asset(
device!.type == "4S" device!.type == "4S"
? Assets ? Assets.fourSceneIcon
.fourSceneIcon : Assets.sixSceneIcon,
: Assets
.sixSceneIcon,
fit: BoxFit.contain, fit: BoxFit.contain,
), ),
), ),
@ -221,52 +202,67 @@ class SettingsPage extends StatelessWidget {
), ),
), ),
const SizedBox(height: 20), const SizedBox(height: 20),
const BodyMedium( // const BodyMedium(
text: 'Device Offline Notification', // text: 'Device Offline Notification',
fontWeight: FontWeight.w700, // fontWeight: FontWeight.w700,
fontSize: 12, // fontSize: 12,
fontColor: ColorsManager.grayColor, // fontColor: ColorsManager.grayColor,
), // ),
DefaultContainer( // DefaultContainer(
child: Column( // child: Column(
children: [ // children: [
SettingWidget( // SettingWidget(
value: _bloc.enableAlarm, // value: _bloc.enableAlarm,
onChanged: (p0) { // onChanged: (p0) {
context // context
.read<DeviceSettingBloc>() // .read<DeviceSettingBloc>()
.add(ToggleEnableAlarmEvent(p0)); // .add(ToggleEnableAlarmEvent(p0));
}, // },
isNotification: true, // isNotification: true,
onTap: () {}, // onTap: () {},
text: 'Offline Notification', // text: 'Offline Notification',
icon: Assets.notificationIcon, // icon: Assets.notificationIcon,
), // ),
], // ],
), // ),
), // ),
const SizedBox(height: 20), // const SizedBox(height: 20),
const BodyMedium( // const BodyMedium(
text: 'Others', // text: 'Others',
fontWeight: FontWeight.w700, // fontWeight: FontWeight.w700,
fontSize: 12, // fontSize: 12,
fontColor: ColorsManager.grayColor, // fontColor: ColorsManager.grayColor,
), // ),
const SizedBox(height: 5), // const SizedBox(height: 5),
DefaultContainer( // DefaultContainer(
child: Column( // child: Column(
children: [ // children: [
SettingWidget( // SettingWidget(
onTap: () { // onTap: () {
Navigator.of(context).push( // Navigator.of(context).push(
MaterialPageRoute( // MaterialPageRoute(
builder: (context) => // builder: (context) =>
ShareDevicePage(device: device!)), // ShareDevicePage(device: device!)),
); // );
}, // },
text: 'Share Device', // text: 'Share Device',
icon: Assets.shareIcon, // 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( // const Divider(
// color: ColorsManager.dividerColor, // color: ColorsManager.dividerColor,
// ), // ),
@ -275,60 +271,45 @@ class SettingsPage extends StatelessWidget {
// Navigator.of(context).push( // Navigator.of(context).push(
// MaterialPageRoute( // MaterialPageRoute(
// builder: (context) => // builder: (context) =>
// FourSceneCreateGroup( // FaqSettingPage(device: device!)),
// device: device!)),
// ); // );
// }, // },
// text: 'Create Group', // text: 'Device FAQ',
// icon: Assets.createGroupIcon, // 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 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), const SizedBox(height: 20),
InkWell( InkWell(
onTap: () { onTap: () {
@ -356,8 +337,7 @@ class SettingsPage extends StatelessWidget {
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween,
children: [ children: [
InkWell( InkWell(
onTap: () { onTap: () {
@ -379,8 +359,7 @@ class SettingsPage extends StatelessWidget {
text: 'Disconnect Device', text: 'Disconnect Device',
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
fontSize: 15, fontSize: 15,
fontColor: fontColor: ColorsManager.textPrimaryColor,
ColorsManager.textPrimaryColor,
), ),
), ),
const Icon( const Icon(
@ -391,8 +370,7 @@ class SettingsPage extends StatelessWidget {
), ),
const SizedBox(height: 20), const SizedBox(height: 20),
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween,
children: [ children: [
InkWell( InkWell(
onTap: () { onTap: () {
@ -404,20 +382,17 @@ class SettingsPage extends StatelessWidget {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
confirmTab: () { confirmTab: () {
_bloc.add( _bloc.add(DeleteDeviceEvent());
DeleteDeviceEvent());
}, },
); );
}, },
); );
}, },
child: const BodyMedium( child: const BodyMedium(
text: text: 'Disconnect Device and Wipe Data',
'Disconnect Device and Wipe Data',
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
fontSize: 15, fontSize: 15,
fontColor: fontColor: ColorsManager.textPrimaryColor,
ColorsManager.textPrimaryColor,
), ),
), ),
const Icon( const Icon(

View File

@ -1,6 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import 'package:syncrow_app/features/devices/view/widgets/popup_menu_widget.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart'; import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart'; import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
import 'package:syncrow_app/utils/resource_manager/font_manager.dart'; import 'package:syncrow_app/utils/resource_manager/font_manager.dart';
@ -24,19 +22,19 @@ class DeviceAppbar extends StatelessWidget implements PreferredSizeWidget {
fontWeight: FontsManager.bold, fontWeight: FontsManager.bold,
), ),
actions: [ actions: [
IconButton( // IconButton(
onPressed: () { // onPressed: () {
showPopupMenu(context: context, items: [ // showPopupMenu(context: context, items: [
PopupMenuItem( // PopupMenuItem(
onTap: () async { // onTap: () async {
HomeCubit.getInstance().updateDevice(deviceUuid); // HomeCubit.getInstance().updateDevice(deviceUuid);
}, // },
value: 'Update', // value: 'Update',
child: const Text('Update'), // child: const Text('Update'),
) // )
]); // ]);
}, // },
icon: Icon(Icons.edit)) // icon: Icon(Icons.edit))
], ],
); );
} }

View File

@ -8,9 +8,7 @@ import 'package:syncrow_app/features/devices/bloc/sos_bloc/sos_state.dart';
import 'package:syncrow_app/features/devices/model/device_report_model.dart'; import 'package:syncrow_app/features/devices/model/device_report_model.dart';
import 'package:syncrow_app/features/shared_widgets/default_container.dart'; import 'package:syncrow_app/features/shared_widgets/default_container.dart';
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart'; import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart';
import 'package:syncrow_app/generated/assets.dart'; import 'package:syncrow_app/generated/assets.dart';
import 'package:syncrow_app/utils/context_extension.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart'; import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
class SosRecordsScreen extends StatefulWidget { class SosRecordsScreen extends StatefulWidget {
@ -22,14 +20,13 @@ class SosRecordsScreen extends StatefulWidget {
} }
class _SosRecordsScreenState extends State<SosRecordsScreen> { class _SosRecordsScreenState extends State<SosRecordsScreen> {
int _selectedIndex = 0; // int _selectedIndex = 0;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return DefaultScaffold( return DefaultScaffold(
title: 'Records', title: 'Records',
child: BlocProvider( child: BlocProvider(
create: (context) => create: (context) => SosBloc(sosId: widget.sosId)..add(const ReportLogsInitial()),
SosBloc(sosId: widget.sosId)..add(const ReportLogsInitial()),
child: BlocBuilder<SosBloc, SosState>( child: BlocBuilder<SosBloc, SosState>(
builder: (context, state) { builder: (context, state) {
final waterSensorBloc = BlocProvider.of<SosBloc>(context); final waterSensorBloc = BlocProvider.of<SosBloc>(context);
@ -37,15 +34,13 @@ class _SosRecordsScreenState extends State<SosRecordsScreen> {
if (state is LoadingNewSate) { if (state is LoadingNewSate) {
return const Center( return const Center(
child: DefaultContainer( child: DefaultContainer(width: 50, height: 50, child: CircularProgressIndicator()),
width: 50, height: 50, child: CircularProgressIndicator()),
); );
} else if (state is UpdateState) { } else if (state is UpdateState) {
for (var record in waterSensorBloc.recordGroups.data!) { for (var record in waterSensorBloc.recordGroups.data!) {
final DateTime eventDateTime = final DateTime eventDateTime =
DateTime.fromMillisecondsSinceEpoch(record.eventTime!); DateTime.fromMillisecondsSinceEpoch(record.eventTime!);
final String formattedDate = final String formattedDate = DateFormat('EEEE, dd/MM/yyyy').format(eventDateTime);
DateFormat('EEEE, dd/MM/yyyy').format(eventDateTime);
if (groupedRecords.containsKey(formattedDate)) { if (groupedRecords.containsKey(formattedDate)) {
groupedRecords[formattedDate]!.add(record); groupedRecords[formattedDate]!.add(record);
} else { } else {
@ -58,63 +53,61 @@ class _SosRecordsScreenState extends State<SosRecordsScreen> {
length: 2, length: 2,
child: Column( child: Column(
children: [ children: [
Container( // Container(
width: MediaQuery.of(context).size.width, // width: MediaQuery.of(context).size.width,
decoration: const ShapeDecoration( // decoration: const ShapeDecoration(
color: ColorsManager.onPrimaryColor, // color: ColorsManager.onPrimaryColor,
shape: RoundedRectangleBorder( // shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(30)), // borderRadius: BorderRadius.all(Radius.circular(30)),
), // ),
), // ),
child: TabBar( // child: TabBar(
onTap: (value) { // onTap: (value) {
setState(() { // setState(() {
_selectedIndex = value; // _selectedIndex = value;
}); // });
}, // },
indicatorColor: Colors.white, // indicatorColor: Colors.white,
dividerHeight: 0, // dividerHeight: 0,
indicatorSize: TabBarIndicatorSize.tab, // indicatorSize: TabBarIndicatorSize.tab,
indicator: const ShapeDecoration( // indicator: const ShapeDecoration(
color: ColorsManager.slidingBlueColor, // color: ColorsManager.slidingBlueColor,
shape: RoundedRectangleBorder( // shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(20)), // borderRadius: BorderRadius.all(Radius.circular(20)),
), // ),
), // ),
tabs: [ // tabs: [
Tab( // Tab(
child: Container( // child: Container(
padding: const EdgeInsets.symmetric(vertical: 10), // padding: const EdgeInsets.symmetric(vertical: 10),
child: BodySmall( // child: BodySmall(
text: 'Record', // text: 'Record',
style: context.bodySmall.copyWith( // style: context.bodySmall.copyWith(
color: _selectedIndex == 0 // color:
? Colors.white // _selectedIndex == 0 ? Colors.white : ColorsManager.blackColor,
: ColorsManager.blackColor, // fontSize: 12,
fontSize: 12, // fontWeight: FontWeight.w400,
fontWeight: FontWeight.w400, // ),
), // ),
), // ),
), // ),
), // Tab(
Tab( // child: Container(
child: Container( // padding: const EdgeInsets.symmetric(vertical: 10),
padding: const EdgeInsets.symmetric(vertical: 10), // child: Text(
child: Text( // 'Automation Log',
'Automation Log', // style: context.bodySmall.copyWith(
style: context.bodySmall.copyWith( // color:
color: _selectedIndex == 1 // _selectedIndex == 1 ? Colors.white : ColorsManager.blackColor,
? Colors.white // fontSize: 12,
: ColorsManager.blackColor, // fontWeight: FontWeight.w400,
fontSize: 12, // ),
fontWeight: FontWeight.w400, // ),
), // ),
), // ),
), // ],
), // ),
], // ),
),
),
Expanded( Expanded(
child: TabBarView( child: TabBarView(
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
@ -129,14 +122,11 @@ class _SosRecordsScreenState extends State<SosRecordsScreen> {
: ListView.builder( : ListView.builder(
itemCount: groupedRecords.length, itemCount: groupedRecords.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
final String date = final String date = groupedRecords.keys.elementAt(index);
groupedRecords.keys.elementAt(index); final List<DeviceEvent> recordsForDate = groupedRecords[date]!;
final List<DeviceEvent> recordsForDate =
groupedRecords[date]!;
return Column( return Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start,
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
@ -152,49 +142,37 @@ class _SosRecordsScreenState extends State<SosRecordsScreen> {
DefaultContainer( DefaultContainer(
child: Column( child: Column(
children: [ children: [
...recordsForDate ...recordsForDate.asMap().entries.map((entry) {
.asMap()
.entries
.map((entry) {
final int idx = entry.key; final int idx = entry.key;
final DeviceEvent record = final DeviceEvent record = entry.value;
entry.value;
final DateTime eventDateTime = final DateTime eventDateTime =
DateTime DateTime.fromMillisecondsSinceEpoch(
.fromMillisecondsSinceEpoch(
record.eventTime!); record.eventTime!);
final String formattedTime = final String formattedTime =
DateFormat('HH:mm:ss') DateFormat('HH:mm:ss').format(eventDateTime);
.format(eventDateTime);
return Column( return Column(
children: [ children: [
ListTile( ListTile(
leading: SvgPicture.asset( leading: SvgPicture.asset(
record.value == 'true' record.value == 'true'
? Assets ? Assets.leakDetectedIcon
.leakDetectedIcon : Assets.leakNormalIcon,
: Assets
.leakNormalIcon,
height: 25, height: 25,
width: 25, width: 25,
), ),
title: const Text( title: const Text(
"SOS Alert Triggered", "SOS Alert Triggered",
style: const TextStyle( style: const TextStyle(
fontWeight: fontWeight: FontWeight.bold,
FontWeight.bold,
fontSize: 18, fontSize: 18,
), ),
), ),
subtitle: subtitle: Text(formattedTime),
Text(formattedTime),
), ),
if (idx != if (idx != recordsForDate.length - 1)
recordsForDate.length - 1)
const Divider( const Divider(
color: ColorsManager color: ColorsManager.graysColor,
.graysColor,
), ),
], ],
); );

View File

@ -8,9 +8,7 @@ import 'package:syncrow_app/features/devices/bloc/water_leak_bloc/water_leak_sta
import 'package:syncrow_app/features/devices/model/device_report_model.dart'; import 'package:syncrow_app/features/devices/model/device_report_model.dart';
import 'package:syncrow_app/features/shared_widgets/default_container.dart'; import 'package:syncrow_app/features/shared_widgets/default_container.dart';
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart'; import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart';
import 'package:syncrow_app/generated/assets.dart'; import 'package:syncrow_app/generated/assets.dart';
import 'package:syncrow_app/utils/context_extension.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart'; import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
class WaterLeakRecordsScreen extends StatefulWidget { class WaterLeakRecordsScreen extends StatefulWidget {
@ -22,14 +20,13 @@ class WaterLeakRecordsScreen extends StatefulWidget {
} }
class _WaterLeakRecordsScreenState extends State<WaterLeakRecordsScreen> { class _WaterLeakRecordsScreenState extends State<WaterLeakRecordsScreen> {
int _selectedIndex = 0; // int _selectedIndex = 0;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return DefaultScaffold( return DefaultScaffold(
title: 'Records', title: 'Records',
child: BlocProvider( child: BlocProvider(
create: (context) => create: (context) => WaterLeakBloc(WLId: widget.WLId)..add(const ReportLogsInitial()),
WaterLeakBloc(WLId: widget.WLId)..add(const ReportLogsInitial()),
child: BlocBuilder<WaterLeakBloc, WaterLeakState>( child: BlocBuilder<WaterLeakBloc, WaterLeakState>(
builder: (context, state) { builder: (context, state) {
final waterSensorBloc = BlocProvider.of<WaterLeakBloc>(context); final waterSensorBloc = BlocProvider.of<WaterLeakBloc>(context);
@ -37,15 +34,13 @@ class _WaterLeakRecordsScreenState extends State<WaterLeakRecordsScreen> {
if (state is WaterLeakLoadingState) { if (state is WaterLeakLoadingState) {
return const Center( return const Center(
child: DefaultContainer( child: DefaultContainer(width: 50, height: 50, child: CircularProgressIndicator()),
width: 50, height: 50, child: CircularProgressIndicator()),
); );
} else if (state is UpdateState) { } else if (state is UpdateState) {
for (var record in waterSensorBloc.recordGroups.data!) { for (var record in waterSensorBloc.recordGroups.data!) {
final DateTime eventDateTime = final DateTime eventDateTime =
DateTime.fromMillisecondsSinceEpoch(record.eventTime!); DateTime.fromMillisecondsSinceEpoch(record.eventTime!);
final String formattedDate = final String formattedDate = DateFormat('EEEE, dd/MM/yyyy').format(eventDateTime);
DateFormat('EEEE, dd/MM/yyyy').format(eventDateTime);
if (groupedRecords.containsKey(formattedDate)) { if (groupedRecords.containsKey(formattedDate)) {
groupedRecords[formattedDate]!.add(record); groupedRecords[formattedDate]!.add(record);
@ -59,63 +54,63 @@ class _WaterLeakRecordsScreenState extends State<WaterLeakRecordsScreen> {
length: 2, length: 2,
child: Column( child: Column(
children: [ children: [
Container( // Container(
width: MediaQuery.of(context).size.width, // width: MediaQuery.of(context).size.width,
decoration: const ShapeDecoration( // decoration: const ShapeDecoration(
color: ColorsManager.onPrimaryColor, // color: ColorsManager.onPrimaryColor,
shape: RoundedRectangleBorder( // shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(30)), // borderRadius: BorderRadius.all(Radius.circular(30)),
), // ),
), // ),
child: TabBar( // child: TabBar(
onTap: (value) { // onTap: (value) {
setState(() { // setState(() {
_selectedIndex = value; // _selectedIndex = value;
}); // });
}, // },
indicatorColor: Colors.white, // indicatorColor: Colors.white,
dividerHeight: 0, // dividerHeight: 0,
indicatorSize: TabBarIndicatorSize.tab, // indicatorSize: TabBarIndicatorSize.tab,
indicator: const ShapeDecoration( // indicator: const ShapeDecoration(
color: ColorsManager.slidingBlueColor, // color: ColorsManager.slidingBlueColor,
shape: RoundedRectangleBorder( // shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(20)), // borderRadius: BorderRadius.all(Radius.circular(20)),
), // ),
), // ),
tabs: [ // tabs: [
Tab( // Tab(
child: Container( // child: Container(
padding: const EdgeInsets.symmetric(vertical: 10), // padding: const EdgeInsets.symmetric(vertical: 10),
child: BodySmall( // child: BodySmall(
text: 'Record', // text: 'Record',
style: context.bodySmall.copyWith( // style: context.bodySmall.copyWith(
color: _selectedIndex == 0 // color: _selectedIndex == 0
? Colors.white // ? Colors.white
: ColorsManager.blackColor, // : ColorsManager.blackColor,
fontSize: 12, // fontSize: 12,
fontWeight: FontWeight.w400, // fontWeight: FontWeight.w400,
), // ),
), // ),
), // ),
), // ),
Tab( // Tab(
child: Container( // child: Container(
padding: const EdgeInsets.symmetric(vertical: 10), // padding: const EdgeInsets.symmetric(vertical: 10),
child: Text( // child: Text(
'Automation Record', // 'Automation Record',
style: context.bodySmall.copyWith( // style: context.bodySmall.copyWith(
color: _selectedIndex == 1 // color: _selectedIndex == 1
? Colors.white // ? Colors.white
: ColorsManager.blackColor, // : ColorsManager.blackColor,
fontSize: 12, // fontSize: 12,
fontWeight: FontWeight.w400, // fontWeight: FontWeight.w400,
), // ),
), // ),
), // ),
), // ),
], // ],
), // ),
), // ),
Expanded( Expanded(
child: TabBarView( child: TabBarView(
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
@ -125,14 +120,11 @@ class _WaterLeakRecordsScreenState extends State<WaterLeakRecordsScreen> {
: ListView.builder( : ListView.builder(
itemCount: groupedRecords.length, itemCount: groupedRecords.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
final String date = final String date = groupedRecords.keys.elementAt(index);
groupedRecords.keys.elementAt(index); final List<DeviceEvent> recordsForDate = groupedRecords[date]!;
final List<DeviceEvent> recordsForDate =
groupedRecords[date]!;
return Column( return Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start,
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
@ -148,30 +140,22 @@ class _WaterLeakRecordsScreenState extends State<WaterLeakRecordsScreen> {
DefaultContainer( DefaultContainer(
child: Column( child: Column(
children: [ children: [
...recordsForDate ...recordsForDate.asMap().entries.map((entry) {
.asMap()
.entries
.map((entry) {
final int idx = entry.key; final int idx = entry.key;
final DeviceEvent record = final DeviceEvent record = entry.value;
entry.value;
final DateTime eventDateTime = final DateTime eventDateTime =
DateTime DateTime.fromMillisecondsSinceEpoch(
.fromMillisecondsSinceEpoch(
record.eventTime!); record.eventTime!);
final String formattedTime = final String formattedTime =
DateFormat('HH:mm:ss') DateFormat('HH:mm:ss').format(eventDateTime);
.format(eventDateTime);
return Column( return Column(
children: [ children: [
ListTile( ListTile(
leading: SvgPicture.asset( leading: SvgPicture.asset(
record.value == 'true' record.value == 'true'
? Assets ? Assets.leakDetectedIcon
.leakDetectedIcon : Assets.leakNormalIcon,
: Assets
.leakNormalIcon,
height: 25, height: 25,
width: 25, width: 25,
), ),
@ -180,19 +164,15 @@ class _WaterLeakRecordsScreenState extends State<WaterLeakRecordsScreen> {
? "Leak Detected" ? "Leak Detected"
: "Normal", : "Normal",
style: const TextStyle( style: const TextStyle(
fontWeight: fontWeight: FontWeight.bold,
FontWeight.bold,
fontSize: 18, fontSize: 18,
), ),
), ),
subtitle: subtitle: Text('$formattedTime'),
Text('$formattedTime'),
), ),
if (idx != if (idx != recordsForDate.length - 1)
recordsForDate.length - 1)
const Divider( const Divider(
color: ColorsManager color: ColorsManager.graysColor,
.graysColor,
), ),
], ],
); );
@ -207,8 +187,7 @@ class _WaterLeakRecordsScreenState extends State<WaterLeakRecordsScreen> {
Container( Container(
height: 10, height: 10,
width: 20, width: 20,
child: child: const Center(child: Text('No data available.')),
const Center(child: Text('No data available.')),
), ),
], ],
), ),

View File

@ -80,30 +80,30 @@ class HomeSettingsView extends StatelessWidget {
), ),
), ),
//Divider //Divider
Container( // Container(
height: 1, // height: 1,
margin: const EdgeInsets.only(top: 10), // margin: const EdgeInsets.only(top: 10),
color: ColorsManager.greyColor, // color: ColorsManager.greyColor,
), // ),
Row( // Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, // mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ // children: [
const BodyMedium(text: 'Location'), // const BodyMedium(text: 'Location'),
Flexible( // Flexible(
child: TextField( // child: TextField(
textAlign: TextAlign.end, // textAlign: TextAlign.end,
decoration: InputDecoration( // decoration: InputDecoration(
hintText: 'Set', // hintText: 'Set',
hintStyle: context.bodyMedium.copyWith(color: Colors.grey), // hintStyle: context.bodyMedium.copyWith(color: Colors.grey),
border: InputBorder.none, // border: InputBorder.none,
), // ),
), // ),
), // ),
], // ],
), // ),
//Divider //Divider
Container( Container(
margin: const EdgeInsets.only(bottom: 10), margin: const EdgeInsets.symmetric(vertical: 10),
height: 1, height: 1,
color: ColorsManager.greyColor, color: ColorsManager.greyColor,
), ),
@ -135,77 +135,77 @@ class HomeSettingsView extends StatelessWidget {
height: 10, height: 10,
), ),
//TODO connect the members to this GridView //TODO connect the members to this GridView
const BodySmall( // const BodySmall(
text: "Members", // text: "Members",
fontWeight: FontWeight.bold, // fontWeight: FontWeight.bold,
), // ),
GridView.builder( // GridView.builder(
shrinkWrap: true, // shrinkWrap: true,
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( // gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2, // crossAxisCount: 2,
crossAxisSpacing: 10, // crossAxisSpacing: 10,
), // ),
itemCount: 2, // itemCount: 2,
itemBuilder: (context, index) => Stack( // itemBuilder: (context, index) => Stack(
alignment: Alignment.topCenter, // alignment: Alignment.topCenter,
children: [ // children: [
DefaultContainer( // DefaultContainer(
margin: const EdgeInsets.only(top: 20), // margin: const EdgeInsets.only(top: 20),
padding: const EdgeInsets.symmetric(vertical: 15, horizontal: 40), // padding: const EdgeInsets.symmetric(vertical: 15, horizontal: 40),
child: Column( // child: Column(
mainAxisSize: MainAxisSize.min, // mainAxisSize: MainAxisSize.min,
children: [ // children: [
const SizedBox( // const SizedBox(
height: 50, // height: 50,
), // ),
BodyMedium( // BodyMedium(
text: 'Member ${index + 1}', // text: 'Member ${index + 1}',
fontWeight: FontWeight.bold, // fontWeight: FontWeight.bold,
), // ),
const SizedBox(height: 3), // const SizedBox(height: 3),
const BodySmall( // const BodySmall(
text: 'Syncrow Account', // text: 'Syncrow Account',
textAlign: TextAlign.center, // textAlign: TextAlign.center,
), // ),
], // ],
), // ),
), // ),
const SizedBox.square( // const SizedBox.square(
dimension: 80, // dimension: 80,
child: CircleAvatar( // child: CircleAvatar(
backgroundColor: Colors.white, // backgroundColor: Colors.white,
child: SizedBox.square( // child: SizedBox.square(
dimension: 77, // dimension: 77,
child: CircleAvatar( // child: CircleAvatar(
backgroundColor: ColorsManager.greyColor, // backgroundColor: ColorsManager.greyColor,
child: Icon(Icons.person), // child: Icon(Icons.person),
), // ),
), // ),
), // ),
) // )
], // ],
), // ),
), // ),
const Spacer(), // const Spacer(),
InkWell( // InkWell(
onTap: () {}, // onTap: () {},
child: Row( // child: Row(
children: [ // children: [
Expanded( // Expanded(
child: DefaultContainer( // child: DefaultContainer(
child: Center( // child: Center(
child: BodyLarge( // child: BodyLarge(
text: 'Leave Home', // text: 'Leave Home',
style: context.bodyLarge.copyWith( // style: context.bodyLarge.copyWith(
color: Colors.red, // color: Colors.red,
), // ),
), // ),
), // ),
), // ),
), // ),
], // ],
), // ),
) // )
], ],
), ),
); );

View File

@ -4,8 +4,8 @@ import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import 'package:syncrow_app/features/menu/bloc/profile_bloc/profile_bloc.dart'; import 'package:syncrow_app/features/menu/bloc/profile_bloc/profile_bloc.dart';
import 'package:syncrow_app/features/menu/bloc/profile_bloc/profile_event.dart'; import 'package:syncrow_app/features/menu/bloc/profile_bloc/profile_event.dart';
import 'package:syncrow_app/features/menu/bloc/profile_bloc/profile_state.dart'; import 'package:syncrow_app/features/menu/bloc/profile_bloc/profile_state.dart';
import 'package:syncrow_app/features/menu/view/widgets/profile/region_page.dart'; // import 'package:syncrow_app/features/menu/view/widgets/profile/region_page.dart';
import 'package:syncrow_app/features/menu/view/widgets/profile/time_zone_screen_page.dart'; // import 'package:syncrow_app/features/menu/view/widgets/profile/time_zone_screen_page.dart';
import 'package:syncrow_app/features/shared_widgets/default_container.dart'; import 'package:syncrow_app/features/shared_widgets/default_container.dart';
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart'; import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart'; import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
@ -134,65 +134,65 @@ class ProfileView extends StatelessWidget {
], ],
), ),
), ),
Container( // Container(
height: 1, // height: 1,
color: ColorsManager.greyColor, // color: ColorsManager.greyColor,
), // ),
InkWell( // InkWell(
onTap: () { // onTap: () {
profileBloc.add(const ChangeNameEvent(value: false)); // profileBloc.add(const ChangeNameEvent(value: false));
Navigator.push( // Navigator.push(
context, // context,
MaterialPageRoute( // MaterialPageRoute(
builder: (context) => const RegionPage(), // builder: (context) => const RegionPage(),
), // ),
).then((result) { // ).then((result) {
profileBloc.add(InitialProfileEvent()); // profileBloc.add(InitialProfileEvent());
}); // });
}, // },
child: Padding( // child: Padding(
padding: const EdgeInsets.only(top: 20, bottom: 20), // padding: const EdgeInsets.only(top: 20, bottom: 20),
child: Row( // child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, // mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ // children: [
const BodyMedium(text: 'Region '), // const BodyMedium(text: 'Region '),
Flexible( // Flexible(
child: BodyMedium( // child: BodyMedium(
text: HomeCubit.user!.regionName ?? 'No Region')), // text: HomeCubit.user!.regionName ?? 'No Region')),
], // ],
), // ),
), // ),
), // ),
Container( // Container(
height: 1, // height: 1,
color: ColorsManager.greyColor, // color: ColorsManager.greyColor,
), // ),
InkWell( // InkWell(
onTap: () { // onTap: () {
profileBloc.add(const ChangeNameEvent(value: false)); // profileBloc.add(const ChangeNameEvent(value: false));
Navigator.push( // Navigator.push(
context, // context,
MaterialPageRoute( // MaterialPageRoute(
builder: (context) => const TimeZoneScreenPage(), // builder: (context) => const TimeZoneScreenPage(),
), // ),
).then((result) { // ).then((result) {
profileBloc.add(InitialProfileEvent()); // profileBloc.add(InitialProfileEvent());
}); // });
}, // },
child: Padding( // child: Padding(
padding: const EdgeInsets.only(top: 15, bottom: 15), // padding: const EdgeInsets.only(top: 15, bottom: 15),
child: Row( // child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, // mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ // children: [
const BodyMedium(text: 'Time Zone '), // const BodyMedium(text: 'Time Zone '),
Flexible( // Flexible(
child: BodyMedium( // child: BodyMedium(
text: HomeCubit.user!.timeZone ?? "No Time Zone"), // text: HomeCubit.user!.timeZone ?? "No Time Zone"),
), // ),
], // ],
), // ),
), // ),
), // ),
], ],
)), )),
], ],

View File

@ -10,7 +10,7 @@ class SecurtyView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return DefaultScaffold( return DefaultScaffold(
title: 'Securty', title: 'Security',
child: Column( child: Column(
children: [ children: [
DefaultContainer( DefaultContainer(
@ -24,11 +24,11 @@ class SecurtyView extends StatelessWidget {
children: [ children: [
InkWell( InkWell(
onTap: () {}, onTap: () {},
child: Column( child: const Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
const Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
BodyMedium( BodyMedium(
@ -41,111 +41,111 @@ class SecurtyView extends StatelessWidget {
) )
], ],
), ),
Container( // Container(
margin: const EdgeInsets.symmetric(vertical: 15), // margin: const EdgeInsets.symmetric(vertical: 15),
height: 1, // height: 1,
color: ColorsManager.greyColor, // color: ColorsManager.greyColor,
), // ),
],
),
),
InkWell(
onTap: () {},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
const Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
BodyMedium(
text: 'App Lock',
),
Icon(
Icons.arrow_forward_ios,
color: ColorsManager.greyColor,
size: 15,
)
],
),
Container(
margin: const EdgeInsets.symmetric(vertical: 15),
height: 1,
color: ColorsManager.greyColor,
),
],
),
),
InkWell(
onTap: () {},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
const Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
BodyMedium(
text: 'User Code',
),
Icon(
Icons.arrow_forward_ios,
color: ColorsManager.greyColor,
size: 15,
)
],
),
Container(
margin: const EdgeInsets.symmetric(vertical: 15),
height: 1,
color: ColorsManager.greyColor,
),
],
),
),
InkWell(
onTap: () {},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
const Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
BodyMedium(
text: 'Delete Account',
),
Icon(
Icons.arrow_forward_ios,
color: ColorsManager.greyColor,
size: 15,
)
],
),
Container(
margin: const EdgeInsets.symmetric(vertical: 15),
height: 1,
color: ColorsManager.greyColor,
),
],
),
),
InkWell(
onTap: () {},
child: const Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
BodyMedium(
text: 'Device Update',
),
Icon(
Icons.arrow_forward_ios,
color: ColorsManager.greyColor,
size: 15,
)
], ],
), ),
), ),
// InkWell(
// onTap: () {},
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisSize: MainAxisSize.min,
// children: [
// const Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// BodyMedium(
// text: 'App Lock',
// ),
// Icon(
// Icons.arrow_forward_ios,
// color: ColorsManager.greyColor,
// size: 15,
// )
// ],
// ),
// Container(
// margin: const EdgeInsets.symmetric(vertical: 15),
// height: 1,
// color: ColorsManager.greyColor,
// ),
// ],
// ),
// ),
// InkWell(
// onTap: () {},
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisSize: MainAxisSize.min,
// children: [
// const Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// BodyMedium(
// text: 'User Code',
// ),
// Icon(
// Icons.arrow_forward_ios,
// color: ColorsManager.greyColor,
// size: 15,
// )
// ],
// ),
// Container(
// margin: const EdgeInsets.symmetric(vertical: 15),
// height: 1,
// color: ColorsManager.greyColor,
// ),
// ],
// ),
// ),
// InkWell(
// onTap: () {},
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisSize: MainAxisSize.min,
// children: [
// const Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// BodyMedium(
// text: 'Delete Account',
// ),
// Icon(
// Icons.arrow_forward_ios,
// color: ColorsManager.greyColor,
// size: 15,
// )
// ],
// ),
// Container(
// margin: const EdgeInsets.symmetric(vertical: 15),
// height: 1,
// color: ColorsManager.greyColor,
// ),
// ],
// ),
// ),
// InkWell(
// onTap: () {},
// child: const Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// BodyMedium(
// text: 'Device Update',
// ),
// Icon(
// Icons.arrow_forward_ios,
// color: ColorsManager.greyColor,
// size: 15,
// )
// ],
// ),
// ),
], ],
), ),
), ),

View File

@ -53,17 +53,16 @@ abstract class ApiEndpoints {
//POST //POST
static const String addUnit = '/unit'; static const String addUnit = '/unit';
static const String addUnitToUser = '/unit/user'; static const String addUnitToUser = '/unit/user';
static const String verifyInvitationCode = static const String verifyInvitationCode = '/user/{userUuid}/spaces/verify-code';
'/user/{userUuid}/spaces/verify-code';
//GET //GET
static const String unitByUuid = '/unit/'; static const String unitByUuid = '/unit/';
static const String listSubspace = static const String listSubspace =
'projects/{projectUuid}/communities/{communityUuid}/spaces/{spaceUuid}/subspaces'; '/projects/{projectUuid}/communities/{communityUuid}/spaces/{spaceUuid}/subspaces';
static const String unitParent = '/unit/parent/{unitUuid}'; static const String unitParent = '/unit/parent/{unitUuid}';
static const String unitUser = '/unit/user/'; static const String unitUser = '/unit/user/';
static const String invitationCode = static const String invitationCode =
'projects/{projectUuid}/communities/{communityUuid}/spaces/{unitUuid}/invitation-code'; '/projects/{projectUuid}/communities/{communityUuid}/spaces/{unitUuid}/invitation-code';
//PUT //PUT
static const String renameUnit = '/unit/{unitUuid}'; static const String renameUnit = '/unit/{unitUuid}';
@ -71,7 +70,7 @@ abstract class ApiEndpoints {
//Subspace Module //Subspace Module
//POST //POST
static const String addSubSpace = static const String addSubSpace =
'projects/{projectUuid}/communities/{communityUuid}/spaces/{spaceUuid}/subspaces'; '/projects/{projectUuid}/communities/{communityUuid}/spaces/{spaceUuid}/subspaces';
///Room Module ///Room Module
//POST //POST
@ -88,7 +87,7 @@ abstract class ApiEndpoints {
//GET //GET
static const String userSpaces = '/user/{userUuid}/spaces'; static const String userSpaces = '/user/{userUuid}/spaces';
static const String spaceDevices = static const String spaceDevices =
'projects/{projectUuid}/communities/{communityUuid}/spaces/{spaceUuid}/devices'; '/projects/{projectUuid}/communities/{communityUuid}/spaces/{spaceUuid}/devices';
///Group Module ///Group Module
//POST //POST
@ -96,8 +95,7 @@ abstract class ApiEndpoints {
static const String controlGroup = '/group/control'; static const String controlGroup = '/group/control';
//GET //GET
static const String groupBySpace = '/group/{unitUuid}'; static const String groupBySpace = '/group/{unitUuid}';
static const String devicesByGroupName = static const String devicesByGroupName = '/group/{unitUuid}/devices/{groupName}';
'/group/{unitUuid}/devices/{groupName}';
static const String groupByUuid = '/group/{groupUuid}'; static const String groupByUuid = '/group/{groupUuid}';
//DELETE //DELETE
@ -109,22 +107,19 @@ abstract class ApiEndpoints {
static const String addDeviceToRoom = '/device/room'; static const String addDeviceToRoom = '/device/room';
static const String addDeviceToGroup = '/device/group'; static const String addDeviceToGroup = '/device/group';
static const String controlDevice = '/device/{deviceUuid}/control'; static const String controlDevice = '/device/{deviceUuid}/control';
static const String firmwareDevice = static const String firmwareDevice = '/device/{deviceUuid}/firmware/{firmwareVersion}';
'/device/{deviceUuid}/firmware/{firmwareVersion}';
static const String getDevicesByUserId = '/device/user/{userId}'; static const String getDevicesByUserId = '/device/user/{userId}';
static const String getDevicesByUnitId = '/device/unit/{unitUuid}'; static const String getDevicesByUnitId = '/device/unit/{unitUuid}';
static const String openDoorLock = '/door-lock/open/{doorLockUuid}'; static const String openDoorLock = '/door-lock/open/{doorLockUuid}';
//GET //GET
static const String deviceByRoom = static const String deviceByRoom =
'projects/{projectUuid}/communities/{communityUuid}/spaces/{spaceUuid}/subspaces/{subSpaceUuid}/devices'; '/projects/{projectUuid}/communities/{communityUuid}/spaces/{spaceUuid}/subspaces/{subSpaceUuid}/devices';
static const String deviceByUuid = '/device/{deviceUuid}'; static const String deviceByUuid = '/device/{deviceUuid}';
static const String deviceFunctions = '/device/{deviceUuid}/functions'; static const String deviceFunctions = '/device/{deviceUuid}/functions';
static const String gatewayApi = '/device/gateway/{gatewayUuid}/devices'; static const String gatewayApi = '/device/gateway/{gatewayUuid}/devices';
static const String deviceFunctionsStatus = static const String deviceFunctionsStatus = '/device/{deviceUuid}/functions/status';
'/device/{deviceUuid}/functions/status'; static const String powerClamp = '/device/{powerClampUuid}/power-clamp/status';
static const String powerClamp =
'/device/{powerClampUuid}/power-clamp/status';
///Device Permission Module ///Device Permission Module
//POST //POST
@ -135,7 +130,7 @@ abstract class ApiEndpoints {
static const String editDevicePermission = '/device-permission/edit/{userId}'; static const String editDevicePermission = '/device-permission/edit/{userId}';
static const String assignDeviceToRoom = static const String assignDeviceToRoom =
'projects/{projectUuid}/communities/{communityUuid}/spaces/{spaceUuid}/subspaces/{subSpaceUuid}/devices/{deviceUuid}'; '/projects/{projectUuid}/communities/{communityUuid}/spaces/{spaceUuid}/subspaces/{subSpaceUuid}/devices/{deviceUuid}';
/// Scene & Automation API //////////////////// /// Scene & Automation API ////////////////////
/// POST /// POST
@ -145,23 +140,21 @@ abstract class ApiEndpoints {
/// GET /// GET
static const String getUnitScenes = static const String getUnitScenes =
'projects/{projectUuid}/communities/{communityUuid}/spaces/{spaceUuid}/scenes'; '/projects/{projectUuid}/communities/{communityUuid}/spaces/{spaceUuid}/scenes';
static const String getScene = '/scene/tap-to-run/{sceneId}'; static const String getScene = '/scene/tap-to-run/{sceneId}';
static const String getIconScene = '/scene/icon'; static const String getIconScene = '/scene/icon';
static const String getUnitAutomation = '/automation/{unitUuid}'; static const String getUnitAutomation = '/automation/{unitUuid}';
static const String getAutomationDetails = static const String getAutomationDetails = '/automation/details/{automationId}';
'/automation/details/{automationId}';
/// PUT /// PUT
static const String updateScene = '/scene/tap-to-run/{sceneId}'; static const String updateScene = '/scene/tap-to-run/{sceneId}';
static const String updateAutomation = '/automation/{automationId}'; static const String updateAutomation = '/automation/{automationId}';
static const String updateAutomationStatus = static const String updateAutomationStatus = '/automation/status/{automationId}';
'/automation/status/{automationId}';
/// DELETE /// DELETE
static const String deleteScene = '/scene/tap-to-run/{sceneId}'; static const String deleteScene = '/scene/tap-to-run/{sceneId}';
@ -170,10 +163,8 @@ abstract class ApiEndpoints {
//////////////////////Door Lock ////////////////////// //////////////////////Door Lock //////////////////////
//online //online
static const String addTemporaryPassword = static const String addTemporaryPassword = '/door-lock/temporary-password/online/{doorLockUuid}';
'/door-lock/temporary-password/online/{doorLockUuid}'; static const String getTemporaryPassword = '/door-lock/temporary-password/online/{doorLockUuid}';
static const String getTemporaryPassword =
'/door-lock/temporary-password/online/{doorLockUuid}';
//one-time offline //one-time offline
static const String addOneTimeTemporaryPassword = static const String addOneTimeTemporaryPassword =
@ -205,8 +196,7 @@ abstract class ApiEndpoints {
'/door-lock/temporary-password/online/{doorLockUuid}/{passwordId}'; '/door-lock/temporary-password/online/{doorLockUuid}/{passwordId}';
static const String saveSchedule = '/schedule/{deviceUuid}'; static const String saveSchedule = '/schedule/{deviceUuid}';
static const String getSchedule = static const String getSchedule = '/schedule/{deviceUuid}?category={category}';
'/schedule/{deviceUuid}?category={category}';
static const String changeSchedule = '/schedule/enable/{deviceUuid}'; static const String changeSchedule = '/schedule/enable/{deviceUuid}';
static const String deleteSchedule = '/schedule/{deviceUuid}/{scheduleId}'; static const String deleteSchedule = '/schedule/{deviceUuid}/{scheduleId}';
static const String reportLogs = static const String reportLogs =
@ -215,10 +205,8 @@ abstract class ApiEndpoints {
static const String statusBatch = '/device/status/batch'; static const String statusBatch = '/device/status/batch';
static const String deviceScene = '/device/{deviceUuid}/scenes'; static const String deviceScene = '/device/{deviceUuid}/scenes';
static const String fourSceneByName = static const String fourSceneByName = '/device/{deviceUuid}/scenes?switchName={switchName}';
'/device/{deviceUuid}/scenes?switchName={switchName}';
static const String resetDevice = '/factory/reset/{deviceUuid}'; static const String resetDevice = '/factory/reset/{deviceUuid}';
static const String unAssignScenesDevice = static const String unAssignScenesDevice = '/device/{deviceUuid}/scenes?switchName={switchName}';
'/device/{deviceUuid}/scenes?switchName={switchName}';
} }

View File

@ -99,9 +99,7 @@ Map<String, DeviceType> devicesTypesMap = {
Map<DeviceType, List<FunctionModel>> devicesFunctionsMap = { Map<DeviceType, List<FunctionModel>> devicesFunctionsMap = {
DeviceType.AC: [ DeviceType.AC: [
FunctionModel( FunctionModel(
code: 'switch', code: 'switch', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel( FunctionModel(
code: 'mode', code: 'mode',
type: functionTypesMap['Enum'], type: functionTypesMap['Enum'],
@ -124,9 +122,7 @@ Map<DeviceType, List<FunctionModel>> devicesFunctionsMap = {
// "range": ["low", "middle", "high", "auto"] // "range": ["low", "middle", "high", "auto"]
})), })),
FunctionModel( FunctionModel(
code: 'child_lock', code: 'child_lock', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
], ],
DeviceType.Gateway: [ DeviceType.Gateway: [
FunctionModel( FunctionModel(
@ -140,9 +136,7 @@ Map<DeviceType, List<FunctionModel>> devicesFunctionsMap = {
"range": ["normal", "alarm"] "range": ["normal", "alarm"]
})), })),
FunctionModel( FunctionModel(
code: 'factory_reset', code: 'factory_reset', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel( FunctionModel(
code: 'alarm_active', code: 'alarm_active',
type: functionTypesMap['String'], type: functionTypesMap['String'],
@ -152,8 +146,7 @@ Map<DeviceType, List<FunctionModel>> devicesFunctionsMap = {
FunctionModel( FunctionModel(
code: 'sensitivity', code: 'sensitivity',
type: functionTypesMap['Integer'], type: functionTypesMap['Integer'],
values: ValueModel.fromJson( values: ValueModel.fromJson({"unit": "", "min": 1, "max": 10, "scale": 0, "step": 1})),
{"unit": "", "min": 1, "max": 10, "scale": 0, "step": 1})),
], ],
DeviceType.DoorLock: [ DeviceType.DoorLock: [
FunctionModel( FunctionModel(
@ -161,9 +154,7 @@ Map<DeviceType, List<FunctionModel>> devicesFunctionsMap = {
type: functionTypesMap['Raw'], type: functionTypesMap['Raw'],
values: ValueModel.fromJson({})), values: ValueModel.fromJson({})),
FunctionModel( FunctionModel(
code: 'remote_no_dp_key', code: 'remote_no_dp_key', type: functionTypesMap['Raw'], values: ValueModel.fromJson({})),
type: functionTypesMap['Raw'],
values: ValueModel.fromJson({})),
FunctionModel( FunctionModel(
code: 'normal_open_switch', code: 'normal_open_switch',
type: functionTypesMap['Boolean'], type: functionTypesMap['Boolean'],
@ -173,87 +164,64 @@ Map<DeviceType, List<FunctionModel>> devicesFunctionsMap = {
FunctionModel( FunctionModel(
code: 'far_detection', code: 'far_detection',
type: functionTypesMap['Integer'], type: functionTypesMap['Integer'],
values: ValueModel.fromJson( values: ValueModel.fromJson({"unit": "cm", "min": 75, "max": 600, "scale": 0, "step": 75})),
{"unit": "cm", "min": 75, "max": 600, "scale": 0, "step": 75})),
FunctionModel( FunctionModel(
code: 'presence_time', code: 'presence_time',
type: functionTypesMap['Integer'], type: functionTypesMap['Integer'],
values: ValueModel.fromJson( values:
{"unit": "Min", "min": 0, "max": 65535, "scale": 0, "step": 1})), ValueModel.fromJson({"unit": "Min", "min": 0, "max": 65535, "scale": 0, "step": 1})),
FunctionModel( FunctionModel(
code: 'motion_sensitivity_value', code: 'motion_sensitivity_value',
type: functionTypesMap['Integer'], type: functionTypesMap['Integer'],
values: ValueModel.fromJson( values: ValueModel.fromJson({"unit": "", "min": 1, "max": 5, "scale": 0, "step": 1})),
{"unit": "", "min": 1, "max": 5, "scale": 0, "step": 1})),
FunctionModel( FunctionModel(
code: 'motionless_sensitivity', code: 'motionless_sensitivity',
type: functionTypesMap['Integer'], type: functionTypesMap['Integer'],
values: ValueModel.fromJson( values: ValueModel.fromJson({"unit": "", "min": 1, "max": 5, "scale": 0, "step": 1})),
{"unit": "", "min": 1, "max": 5, "scale": 0, "step": 1})),
FunctionModel( FunctionModel(
code: 'indicator', code: 'indicator', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
], ],
DeviceType.OneGang: [ DeviceType.OneGang: [
FunctionModel( FunctionModel(
code: 'switch_1', code: 'switch_1', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel( FunctionModel(
code: 'countdown_1', code: 'countdown_1',
type: functionTypesMap['Integer'], type: functionTypesMap['Integer'],
values: ValueModel.fromJson( values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
{"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
], ],
DeviceType.TwoGang: [ DeviceType.TwoGang: [
FunctionModel( FunctionModel(
code: 'switch_1', code: 'switch_1', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel( FunctionModel(
code: 'switch_2', code: 'switch_2', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel( FunctionModel(
code: 'countdown_1', code: 'countdown_1',
type: functionTypesMap['Integer'], type: functionTypesMap['Integer'],
values: ValueModel.fromJson( values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
{"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
FunctionModel( FunctionModel(
code: 'countdown_2', code: 'countdown_2',
type: functionTypesMap['Integer'], type: functionTypesMap['Integer'],
values: ValueModel.fromJson( values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
{"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
], ],
DeviceType.ThreeGang: [ DeviceType.ThreeGang: [
FunctionModel( FunctionModel(
code: 'switch_1', code: 'switch_1', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel( FunctionModel(
code: 'switch_2', code: 'switch_2', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel( FunctionModel(
code: 'switch_3', code: 'switch_3', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel( FunctionModel(
code: 'countdown_1', code: 'countdown_1',
type: functionTypesMap['Integer'], type: functionTypesMap['Integer'],
values: ValueModel.fromJson( values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
{"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
FunctionModel( FunctionModel(
code: 'countdown_2', code: 'countdown_2',
type: functionTypesMap['Integer'], type: functionTypesMap['Integer'],
values: ValueModel.fromJson( values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
{"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
FunctionModel( FunctionModel(
code: 'countdown_3', code: 'countdown_3',
type: functionTypesMap['Integer'], type: functionTypesMap['Integer'],
values: ValueModel.fromJson( values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
{"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
], ],
DeviceType.Curtain: [ DeviceType.Curtain: [
FunctionModel( FunctionModel(
@ -265,19 +233,15 @@ Map<DeviceType, List<FunctionModel>> devicesFunctionsMap = {
FunctionModel( FunctionModel(
code: 'percent_control', code: 'percent_control',
type: functionTypesMap['Integer'], type: functionTypesMap['Integer'],
values: ValueModel.fromJson( values: ValueModel.fromJson({"unit": "%", "min": 0, "max": 100, "scale": 0, "step": 1})),
{"unit": "%", "min": 0, "max": 100, "scale": 0, "step": 1})),
], ],
DeviceType.WH: [ DeviceType.WH: [
FunctionModel( FunctionModel(
code: 'switch_1', code: 'switch_1', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel( FunctionModel(
code: 'countdown_1', code: 'countdown_1',
type: functionTypesMap['Integer'], type: functionTypesMap['Integer'],
values: ValueModel.fromJson( values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
{"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
FunctionModel( FunctionModel(
code: 'relay_status', code: 'relay_status',
type: functionTypesMap['Enum'], type: functionTypesMap['Enum'],
@ -301,9 +265,7 @@ Map<DeviceType, List<FunctionModel>> devicesFunctionsMap = {
], ],
DeviceType.DS: [ DeviceType.DS: [
FunctionModel( FunctionModel(
code: 'doorcontact_state', code: 'doorcontact_state', type: functionTypesMap['Raw'], values: ValueModel.fromJson({})),
type: functionTypesMap['Raw'],
values: ValueModel.fromJson({})),
FunctionModel( FunctionModel(
code: 'battery_percentage', code: 'battery_percentage',
type: functionTypesMap['Integer'], type: functionTypesMap['Integer'],
@ -311,14 +273,11 @@ Map<DeviceType, List<FunctionModel>> devicesFunctionsMap = {
], ],
DeviceType.OneTouch: [ DeviceType.OneTouch: [
FunctionModel( FunctionModel(
code: 'switch_1', code: 'switch_1', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel( FunctionModel(
code: 'countdown_1', code: 'countdown_1',
type: functionTypesMap['Integer'], type: functionTypesMap['Integer'],
values: ValueModel.fromJson( values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
{"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
FunctionModel( FunctionModel(
code: 'relay_status', code: 'relay_status',
type: functionTypesMap['Enum'], type: functionTypesMap['Enum'],
@ -340,23 +299,17 @@ Map<DeviceType, List<FunctionModel>> devicesFunctionsMap = {
], ],
DeviceType.TowTouch: [ DeviceType.TowTouch: [
FunctionModel( FunctionModel(
code: 'switch_1', code: 'switch_1', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel( FunctionModel(
code: 'switch_2', code: 'switch_2', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel( FunctionModel(
code: 'countdown_1', code: 'countdown_1',
type: functionTypesMap['Integer'], type: functionTypesMap['Integer'],
values: ValueModel.fromJson( values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
{"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
FunctionModel( FunctionModel(
code: 'countdown_2', code: 'countdown_2',
type: functionTypesMap['Integer'], type: functionTypesMap['Integer'],
values: ValueModel.fromJson( values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
{"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
FunctionModel( FunctionModel(
code: 'relay_status', code: 'relay_status',
type: functionTypesMap['Enum'], type: functionTypesMap['Enum'],
@ -384,32 +337,23 @@ Map<DeviceType, List<FunctionModel>> devicesFunctionsMap = {
], ],
DeviceType.ThreeTouch: [ DeviceType.ThreeTouch: [
FunctionModel( FunctionModel(
code: 'switch_1', code: 'switch_1', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel( FunctionModel(
code: 'switch_2', code: 'switch_2', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel( FunctionModel(
code: 'switch_3', code: 'switch_3', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel( FunctionModel(
code: 'countdown_1', code: 'countdown_1',
type: functionTypesMap['Integer'], type: functionTypesMap['Integer'],
values: ValueModel.fromJson( values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
{"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
FunctionModel( FunctionModel(
code: 'countdown_2', code: 'countdown_2',
type: functionTypesMap['Integer'], type: functionTypesMap['Integer'],
values: ValueModel.fromJson( values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
{"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
FunctionModel( FunctionModel(
code: 'countdown_3', code: 'countdown_3',
type: functionTypesMap['Integer'], type: functionTypesMap['Integer'],
values: ValueModel.fromJson( values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
{"unit": "s", "min": 0, "max": 43200, "scale": 0, "step": 1})),
FunctionModel( FunctionModel(
code: 'relay_status', code: 'relay_status',
type: functionTypesMap['Enum'], type: functionTypesMap['Enum'],
@ -443,24 +387,19 @@ Map<DeviceType, List<FunctionModel>> devicesFunctionsMap = {
], ],
DeviceType.GarageDoor: [ DeviceType.GarageDoor: [
FunctionModel( FunctionModel(
code: 'switch_1', code: 'switch_1', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel( FunctionModel(
code: 'countdown_1', code: 'countdown_1',
type: functionTypesMap['Integer'], type: functionTypesMap['Integer'],
values: ValueModel.fromJson( values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 86400, "scale": 0, "step": 1})),
{"unit": "s", "min": 0, "max": 86400, "scale": 0, "step": 1})),
FunctionModel( FunctionModel(
code: 'tr_timecon', code: 'tr_timecon',
type: functionTypesMap['Integer'], type: functionTypesMap['Integer'],
values: ValueModel.fromJson( values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 120, "scale": 0, "step": 1})),
{"unit": "s", "min": 0, "max": 120, "scale": 0, "step": 1})),
FunctionModel( FunctionModel(
code: 'countdown_alarm', code: 'countdown_alarm',
type: functionTypesMap['Integer'], type: functionTypesMap['Integer'],
values: ValueModel.fromJson( values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 86400, "scale": 0, "step": 1})),
{"unit": "s", "min": 0, "max": 86400, "scale": 0, "step": 1})),
FunctionModel( FunctionModel(
code: 'door_control_1', code: 'door_control_1',
type: functionTypesMap['Enum'], type: functionTypesMap['Enum'],
@ -481,24 +420,19 @@ Map<DeviceType, List<FunctionModel>> devicesFunctionsMap = {
DeviceType.WaterLeak: [], DeviceType.WaterLeak: [],
DeviceType.PC: [ DeviceType.PC: [
FunctionModel( FunctionModel(
code: 'switch_1', code: 'switch_1', type: functionTypesMap['Boolean'], values: ValueModel.fromJson({})),
type: functionTypesMap['Boolean'],
values: ValueModel.fromJson({})),
FunctionModel( FunctionModel(
code: 'countdown_1', code: 'countdown_1',
type: functionTypesMap['Integer'], type: functionTypesMap['Integer'],
values: ValueModel.fromJson( values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 86400, "scale": 0, "step": 1})),
{"unit": "s", "min": 0, "max": 86400, "scale": 0, "step": 1})),
FunctionModel( FunctionModel(
code: 'tr_timecon', code: 'tr_timecon',
type: functionTypesMap['Integer'], type: functionTypesMap['Integer'],
values: ValueModel.fromJson( values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 120, "scale": 0, "step": 1})),
{"unit": "s", "min": 0, "max": 120, "scale": 0, "step": 1})),
FunctionModel( FunctionModel(
code: 'countdown_alarm', code: 'countdown_alarm',
type: functionTypesMap['Integer'], type: functionTypesMap['Integer'],
values: ValueModel.fromJson( values: ValueModel.fromJson({"unit": "s", "min": 0, "max": 86400, "scale": 0, "step": 1})),
{"unit": "s", "min": 0, "max": 86400, "scale": 0, "step": 1})),
FunctionModel( FunctionModel(
code: 'door_control_1', code: 'door_control_1',
type: functionTypesMap['Enum'], type: functionTypesMap['Enum'],
@ -542,13 +476,9 @@ Map<DeviceType, List<FunctionModel>> devicesFunctionsMap = {
"range": ["scene"] "range": ["scene"]
})), })),
FunctionModel( FunctionModel(
code: 'scene_id_group_id', code: 'scene_id_group_id', type: functionTypesMap['Raw'], values: ValueModel.fromJson({})),
type: functionTypesMap['Raw'],
values: ValueModel.fromJson({})),
FunctionModel( FunctionModel(
code: 'switch_backlight', code: 'switch_backlight', type: functionTypesMap['Enum'], values: ValueModel.fromJson({})),
type: functionTypesMap['Enum'],
values: ValueModel.fromJson({})),
], ],
DeviceType.SixScene: [ DeviceType.SixScene: [
FunctionModel( FunctionModel(
@ -588,19 +518,13 @@ Map<DeviceType, List<FunctionModel>> devicesFunctionsMap = {
"range": ["scene"] "range": ["scene"]
})), })),
FunctionModel( FunctionModel(
code: 'scene_id_group_id', code: 'scene_id_group_id', type: functionTypesMap['Raw'], values: ValueModel.fromJson({})),
type: functionTypesMap['Raw'],
values: ValueModel.fromJson({})),
FunctionModel( FunctionModel(
code: 'switch_backlight', code: 'switch_backlight', type: functionTypesMap['Enum'], values: ValueModel.fromJson({})),
type: functionTypesMap['Enum'],
values: ValueModel.fromJson({})),
], ],
DeviceType.SOS: [ DeviceType.SOS: [
FunctionModel( FunctionModel(
code: 'contact_state', code: 'contact_state', type: functionTypesMap['Raw'], values: ValueModel.fromJson({})),
type: functionTypesMap['Raw'],
values: ValueModel.fromJson({})),
FunctionModel( FunctionModel(
code: 'battery_percentage', code: 'battery_percentage',
type: functionTypesMap['Integer'], type: functionTypesMap['Integer'],
@ -700,69 +624,69 @@ List<Map<String, Object>> menuSections = [
], ],
}, },
//General Settings //General Settings
{ // {
'title': 'General Settings', // 'title': 'General Settings',
'color': const Color(0xFF023DFE), // 'color': const Color(0xFF023DFE),
'buttons': [ // 'buttons': [
{ // {
'title': 'Voice Assistant', // 'title': 'Voice Assistant',
'Icon': Assets.assetsIconsMenuIconsGeneralSettingsIconsVoiceAssistant, // 'Icon': Assets.assetsIconsMenuIconsGeneralSettingsIconsVoiceAssistant,
'page': null // 'page': null
}, // },
{ // {
'title': 'Temperature unit', // 'title': 'Temperature unit',
'Icon': Assets.assetsIconsMenuIconsGeneralSettingsIconsTemperatureUnit, // 'Icon': Assets.assetsIconsMenuIconsGeneralSettingsIconsTemperatureUnit,
'page': null // 'page': null
}, // },
{ // {
'title': 'Touch tone on panel', // 'title': 'Touch tone on panel',
'Icon': Assets.assetsIconsMenuIconsGeneralSettingsIconsTouchTone, // 'Icon': Assets.assetsIconsMenuIconsGeneralSettingsIconsTouchTone,
'page': null // 'page': null
}, // },
{ // {
'title': 'Language', // 'title': 'Language',
'Icon': Assets.assetsIconsMenuIconsGeneralSettingsIconsLanguage, // 'Icon': Assets.assetsIconsMenuIconsGeneralSettingsIconsLanguage,
'page': null // 'page': null
}, // },
{ // {
'title': 'Network Diagnosis', // 'title': 'Network Diagnosis',
'Icon': Assets.assetsIconsMenuIconsGeneralSettingsIconsNetworkDiagnosis, // 'Icon': Assets.assetsIconsMenuIconsGeneralSettingsIconsNetworkDiagnosis,
'page': null // 'page': null
}, // },
{ // {
'title': 'Clear Cache', // 'title': 'Clear Cache',
'Icon': Assets.assetsIconsMenuIconsGeneralSettingsIconsClearCach, // 'Icon': Assets.assetsIconsMenuIconsGeneralSettingsIconsClearCach,
'page': null // 'page': null
}, // },
], // ],
}, // },
//Messages Center // //Messages Center
{ // {
'title': 'Messages Center', // 'title': 'Messages Center',
'color': const Color(0xFF0088FF), // 'color': const Color(0xFF0088FF),
'buttons': [ // 'buttons': [
{ // {
'title': 'Alerts', // 'title': 'Alerts',
'Icon': Assets.assetsIconsMenuIconsMessagesCenterIconsAlerts, // 'Icon': Assets.assetsIconsMenuIconsMessagesCenterIconsAlerts,
'page': null // 'page': null
}, // },
{ // {
'title': 'Messages', // 'title': 'Messages',
'Icon': Assets.assetsIconsMenuIconsMessagesCenterIconsMessages, // 'Icon': Assets.assetsIconsMenuIconsMessagesCenterIconsMessages,
'page': null // 'page': null
}, // },
{ // {
'title': 'FAQs', // 'title': 'FAQs',
'Icon': Assets.assetsIconsMenuIconsMessagesCenterIconsFAQs, // 'Icon': Assets.assetsIconsMenuIconsMessagesCenterIconsFAQs,
'page': null // 'page': null
}, // },
{ // {
'title': 'Help & Feedback', // 'title': 'Help & Feedback',
'Icon': Assets.assetsIconsMenuIconsMessagesCenterIconsHelpAndFeedback, // 'Icon': Assets.assetsIconsMenuIconsMessagesCenterIconsHelpAndFeedback,
'page': null // 'page': null
}, // },
], // ],
}, // },
//Security And Privacy //Security And Privacy
{ {
'title': 'Security And Privacy', 'title': 'Security And Privacy',
@ -773,11 +697,11 @@ List<Map<String, Object>> menuSections = [
'Icon': Assets.assetsIconsMenuIconsSecurityAndPrivacyIconsSecurty, 'Icon': Assets.assetsIconsMenuIconsSecurityAndPrivacyIconsSecurty,
'page': const SecurtyView() 'page': const SecurtyView()
}, },
{ // {
'title': 'Privacy', // 'title': 'Privacy',
'Icon': Assets.assetsIconsMenuIconsSecurityAndPrivacyIconsPrivacy, // 'Icon': Assets.assetsIconsMenuIconsSecurityAndPrivacyIconsPrivacy,
'page': const PrivacyView() // 'page': const PrivacyView()
}, // },
], ],
}, },
//Legal Information //Legal Information
@ -785,11 +709,7 @@ List<Map<String, Object>> menuSections = [
'title': 'Legal Information', 'title': 'Legal Information',
'color': const Color(0xFF001B72), 'color': const Color(0xFF001B72),
'buttons': [ 'buttons': [
{ {'title': 'About', 'Icon': Assets.assetsIconsMenuIconsLeagalInfoIconsAbout, 'page': null},
'title': 'About',
'Icon': Assets.assetsIconsMenuIconsLeagalInfoIconsAbout,
'page': null
},
{ {
'title': 'Privacy Policy', 'title': 'Privacy Policy',
'Icon': Assets.assetsIconsMenuIconsLeagalInfoIconsPrivacyPolicy, 'Icon': Assets.assetsIconsMenuIconsLeagalInfoIconsPrivacyPolicy,