mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +00:00
push notification dialog design
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
import 'package:syncrow_web/pages/device_managment/all_devices/models/room.dart';
|
import 'package:syncrow_web/pages/device_managment/all_devices/models/room.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/all_devices/models/unit.dart';
|
import 'package:syncrow_web/pages/device_managment/all_devices/models/unit.dart';
|
||||||
|
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||||
|
|
||||||
class AllDevicesModel {
|
class AllDevicesModel {
|
||||||
/*
|
/*
|
||||||
@ -106,7 +106,7 @@ class AllDevicesModel {
|
|||||||
categoryName = json['categoryName']?.toString();
|
categoryName = json['categoryName']?.toString();
|
||||||
createTime = int.tryParse(json['createTime']?.toString() ?? '');
|
createTime = int.tryParse(json['createTime']?.toString() ?? '');
|
||||||
gatewayId = json['gatewayId']?.toString();
|
gatewayId = json['gatewayId']?.toString();
|
||||||
icon = json['icon']?.toString();
|
icon = json['icon'] ?? _getDefaultIcon(productType);
|
||||||
ip = json['ip']?.toString();
|
ip = json['ip']?.toString();
|
||||||
lat = json['lat']?.toString();
|
lat = json['lat']?.toString();
|
||||||
localKey = json['localKey']?.toString();
|
localKey = json['localKey']?.toString();
|
||||||
@ -122,6 +122,35 @@ class AllDevicesModel {
|
|||||||
uuid = json['uuid']?.toString();
|
uuid = json['uuid']?.toString();
|
||||||
batteryLevel = int.tryParse(json['battery']?.toString() ?? '');
|
batteryLevel = int.tryParse(json['battery']?.toString() ?? '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String _getDefaultIcon(String? productType) {
|
||||||
|
switch (productType) {
|
||||||
|
case 'LightBulb':
|
||||||
|
return Assets.lightBulb;
|
||||||
|
case 'CeilingSensor':
|
||||||
|
case 'WallSensor':
|
||||||
|
return Assets.sensors;
|
||||||
|
case 'AC':
|
||||||
|
return Assets.ac;
|
||||||
|
case 'DoorLock':
|
||||||
|
return Assets.doorLock;
|
||||||
|
case 'Curtain':
|
||||||
|
return Assets.curtain;
|
||||||
|
case '3G':
|
||||||
|
case '2G':
|
||||||
|
case '1G':
|
||||||
|
return Assets.gangSwitch;
|
||||||
|
case 'Gateway':
|
||||||
|
return Assets.gateway;
|
||||||
|
case 'WH':
|
||||||
|
return Assets.blackLogo;
|
||||||
|
case 'DS':
|
||||||
|
return Assets.sensors;
|
||||||
|
default:
|
||||||
|
return Assets.logo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final data = <String, dynamic>{};
|
final data = <String, dynamic>{};
|
||||||
if (room != null) {
|
if (room != null) {
|
||||||
@ -159,61 +188,61 @@ class AllDevicesModel {
|
|||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
if (identical(this, other)) return true;
|
if (identical(this, other)) return true;
|
||||||
|
|
||||||
return other is AllDevicesModel &&
|
return other is AllDevicesModel &&
|
||||||
other.room == room &&
|
other.room == room &&
|
||||||
other.unit == unit &&
|
other.unit == unit &&
|
||||||
other.productUuid == productUuid &&
|
other.productUuid == productUuid &&
|
||||||
other.productType == productType &&
|
other.productType == productType &&
|
||||||
other.permissionType == permissionType &&
|
other.permissionType == permissionType &&
|
||||||
other.activeTime == activeTime &&
|
other.activeTime == activeTime &&
|
||||||
other.category == category &&
|
other.category == category &&
|
||||||
other.categoryName == categoryName &&
|
other.categoryName == categoryName &&
|
||||||
other.createTime == createTime &&
|
other.createTime == createTime &&
|
||||||
other.gatewayId == gatewayId &&
|
other.gatewayId == gatewayId &&
|
||||||
other.icon == icon &&
|
other.icon == icon &&
|
||||||
other.ip == ip &&
|
other.ip == ip &&
|
||||||
other.lat == lat &&
|
other.lat == lat &&
|
||||||
other.localKey == localKey &&
|
other.localKey == localKey &&
|
||||||
other.lon == lon &&
|
other.lon == lon &&
|
||||||
other.model == model &&
|
other.model == model &&
|
||||||
other.name == name &&
|
other.name == name &&
|
||||||
other.nodeId == nodeId &&
|
other.nodeId == nodeId &&
|
||||||
other.online == online &&
|
other.online == online &&
|
||||||
other.ownerId == ownerId &&
|
other.ownerId == ownerId &&
|
||||||
other.sub == sub &&
|
other.sub == sub &&
|
||||||
other.timeZone == timeZone &&
|
other.timeZone == timeZone &&
|
||||||
other.updateTime == updateTime &&
|
other.updateTime == updateTime &&
|
||||||
other.uuid == uuid &&
|
other.uuid == uuid &&
|
||||||
other.batteryLevel == batteryLevel;
|
other.batteryLevel == batteryLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode {
|
int get hashCode {
|
||||||
return room.hashCode ^
|
return room.hashCode ^
|
||||||
unit.hashCode ^
|
unit.hashCode ^
|
||||||
productUuid.hashCode ^
|
productUuid.hashCode ^
|
||||||
productType.hashCode ^
|
productType.hashCode ^
|
||||||
permissionType.hashCode ^
|
permissionType.hashCode ^
|
||||||
activeTime.hashCode ^
|
activeTime.hashCode ^
|
||||||
category.hashCode ^
|
category.hashCode ^
|
||||||
categoryName.hashCode ^
|
categoryName.hashCode ^
|
||||||
createTime.hashCode ^
|
createTime.hashCode ^
|
||||||
gatewayId.hashCode ^
|
gatewayId.hashCode ^
|
||||||
icon.hashCode ^
|
icon.hashCode ^
|
||||||
ip.hashCode ^
|
ip.hashCode ^
|
||||||
lat.hashCode ^
|
lat.hashCode ^
|
||||||
localKey.hashCode ^
|
localKey.hashCode ^
|
||||||
lon.hashCode ^
|
lon.hashCode ^
|
||||||
model.hashCode ^
|
model.hashCode ^
|
||||||
name.hashCode ^
|
name.hashCode ^
|
||||||
nodeId.hashCode ^
|
nodeId.hashCode ^
|
||||||
online.hashCode ^
|
online.hashCode ^
|
||||||
ownerId.hashCode ^
|
ownerId.hashCode ^
|
||||||
sub.hashCode ^
|
sub.hashCode ^
|
||||||
timeZone.hashCode ^
|
timeZone.hashCode ^
|
||||||
updateTime.hashCode ^
|
updateTime.hashCode ^
|
||||||
uuid.hashCode ^
|
uuid.hashCode ^
|
||||||
batteryLevel.hashCode;
|
batteryLevel.hashCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,3 +37,5 @@ class UpdateLockEvent extends DoorLockEvent {
|
|||||||
@override
|
@override
|
||||||
List<Object> get props => [value];
|
List<Object> get props => [value];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ class _DeviceItem extends StatelessWidget {
|
|||||||
const Spacer(),
|
const Spacer(),
|
||||||
Text(
|
Text(
|
||||||
device.name ?? 'Unknown Device',
|
device.name ?? 'Unknown Device',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.start,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
|
@ -6,6 +6,7 @@ import 'package:syncrow_web/pages/device_managment/main_door_sensor/bloc/main_do
|
|||||||
import 'package:syncrow_web/pages/device_managment/main_door_sensor/bloc/main_door_sensor_event.dart';
|
import 'package:syncrow_web/pages/device_managment/main_door_sensor/bloc/main_door_sensor_event.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/main_door_sensor/bloc/main_door_sensor_state.dart';
|
import 'package:syncrow_web/pages/device_managment/main_door_sensor/bloc/main_door_sensor_state.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/main_door_sensor/models/main_door_status_model.dart';
|
import 'package:syncrow_web/pages/device_managment/main_door_sensor/models/main_door_status_model.dart';
|
||||||
|
import 'package:syncrow_web/pages/device_managment/main_door_sensor/widgets/notification_dialog.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/shared/device_controls_container.dart';
|
import 'package:syncrow_web/pages/device_managment/shared/device_controls_container.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/shared/table/report_table.dart';
|
import 'package:syncrow_web/pages/device_managment/shared/table/report_table.dart';
|
||||||
import 'package:syncrow_web/utils/color_manager.dart';
|
import 'package:syncrow_web/utils/color_manager.dart';
|
||||||
@ -82,7 +83,7 @@ class MainDoorSensorControlView extends StatelessWidget
|
|||||||
paddingAmount: 8,
|
paddingAmount: 8,
|
||||||
),
|
),
|
||||||
IconNameStatusContainer(
|
IconNameStatusContainer(
|
||||||
name: 'Open/Close\n Record',
|
name: 'Open/Close\nRecord',
|
||||||
icon: Assets.mainDoorReports,
|
icon: Assets.mainDoorReports,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
final from = DateTime.now()
|
final from = DateTime.now()
|
||||||
@ -102,9 +103,14 @@ class MainDoorSensorControlView extends StatelessWidget
|
|||||||
textColor: ColorsManager.blackColor,
|
textColor: ColorsManager.blackColor,
|
||||||
),
|
),
|
||||||
IconNameStatusContainer(
|
IconNameStatusContainer(
|
||||||
name: 'Notifications\n Settings',
|
name: 'Notifications\nSettings',
|
||||||
icon: Assets.mainDoorNotifi,
|
icon: Assets.mainDoorNotifi,
|
||||||
onTap: () {},
|
onTap: () {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => const NotificationDialog(),
|
||||||
|
);
|
||||||
|
},
|
||||||
status: false,
|
status: false,
|
||||||
textColor: ColorsManager.blackColor,
|
textColor: ColorsManager.blackColor,
|
||||||
),
|
),
|
||||||
|
@ -0,0 +1,97 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:syncrow_web/pages/device_managment/shared/toggle_widget.dart';
|
||||||
|
import 'package:syncrow_web/utils/color_manager.dart';
|
||||||
|
|
||||||
|
class NotificationDialog extends StatelessWidget {
|
||||||
|
const NotificationDialog({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Dialog(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
insetPadding: const EdgeInsets.all(20),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
),
|
||||||
|
child: SizedBox(
|
||||||
|
width: 798,
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(20.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
const SizedBox(),
|
||||||
|
Text(
|
||||||
|
'Notification Settings',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 22,
|
||||||
|
color: ColorsManager.dialogBlueTitle,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: 25,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.transparent,
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
border: Border.all(
|
||||||
|
color: Colors.grey,
|
||||||
|
width: 1.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: IconButton(
|
||||||
|
padding: EdgeInsets.all(1),
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.close,
|
||||||
|
color: Colors.grey,
|
||||||
|
size: 18,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: [
|
||||||
|
ToggleWidget(
|
||||||
|
value: true,
|
||||||
|
code: 'notification',
|
||||||
|
deviceId: '',
|
||||||
|
label: 'Low Battery',
|
||||||
|
onChange: (v) {},
|
||||||
|
icon: '-1',
|
||||||
|
),
|
||||||
|
ToggleWidget(
|
||||||
|
value: true,
|
||||||
|
code: 'notification',
|
||||||
|
deviceId: '',
|
||||||
|
label: 'Closing\nReminders',
|
||||||
|
onChange: (v) {},
|
||||||
|
icon: '-1',
|
||||||
|
),
|
||||||
|
ToggleWidget(
|
||||||
|
value: true,
|
||||||
|
code: 'notification',
|
||||||
|
deviceId: '',
|
||||||
|
label: 'Door Alarm',
|
||||||
|
onChange: (v) {},
|
||||||
|
icon: '-1',
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -40,16 +40,21 @@ class ToggleWidget extends StatelessWidget {
|
|||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
ClipOval(
|
icon == '-1'
|
||||||
child: Container(
|
? const SizedBox(
|
||||||
color: ColorsManager.whiteColors,
|
height: 60,
|
||||||
child: SvgPicture.asset(
|
width: 60,
|
||||||
icon ?? Assets.lightPulp,
|
)
|
||||||
width: 60,
|
: ClipOval(
|
||||||
height: 60,
|
child: Container(
|
||||||
fit: BoxFit.cover,
|
color: ColorsManager.whiteColors,
|
||||||
),
|
child: SvgPicture.asset(
|
||||||
)),
|
icon ?? Assets.lightPulp,
|
||||||
|
width: 60,
|
||||||
|
height: 60,
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
|
)),
|
||||||
Text(
|
Text(
|
||||||
label,
|
label,
|
||||||
style: context.textTheme.titleMedium!.copyWith(
|
style: context.textTheme.titleMedium!.copyWith(
|
||||||
|
@ -41,7 +41,8 @@ class HomeMobilePage extends StatelessWidget {
|
|||||||
SizedBox(height: size.height * 0.05),
|
SizedBox(height: size.height * 0.05),
|
||||||
const Text(
|
const Text(
|
||||||
'ACCESS YOUR APPS',
|
'ACCESS YOUR APPS',
|
||||||
style: TextStyle(fontSize: 20, fontWeight: FontWeight.w700),
|
style:
|
||||||
|
TextStyle(fontSize: 20, fontWeight: FontWeight.w700),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 30),
|
const SizedBox(height: 30),
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -51,7 +52,8 @@ class HomeMobilePage extends StatelessWidget {
|
|||||||
width: size.width * 0.68,
|
width: size.width * 0.68,
|
||||||
child: GridView.builder(
|
child: GridView.builder(
|
||||||
itemCount: 8,
|
itemCount: 8,
|
||||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
gridDelegate:
|
||||||
|
const SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
crossAxisCount: 2,
|
crossAxisCount: 2,
|
||||||
crossAxisSpacing: 20.0,
|
crossAxisSpacing: 20.0,
|
||||||
mainAxisSpacing: 20.0,
|
mainAxisSpacing: 20.0,
|
||||||
@ -63,7 +65,8 @@ class HomeMobilePage extends StatelessWidget {
|
|||||||
active: homeItems[index]['active'],
|
active: homeItems[index]['active'],
|
||||||
name: homeItems[index]['title'],
|
name: homeItems[index]['title'],
|
||||||
img: homeItems[index]['icon'],
|
img: homeItems[index]['icon'],
|
||||||
onTap: () => homeBloc.homeItems[index].onPress(context),
|
onTap: () =>
|
||||||
|
homeBloc.homeItems[index].onPress(context),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
Reference in New Issue
Block a user