警报修改

hmxc
章文轩 3 years ago
parent 6325d49437
commit eb1ac12092

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

@ -3,13 +3,23 @@
class R {
const R._();
/// ![preview](file:///Users/datang/aku_community_manager/assets/home/app_alarm.png)
static const String ASSETS_HOME_APP_ALARM_PNG = 'assets/home/app_alarm.png';
/// ![preview](file:///Users/datang/aku_community_manager/assets/home/clock_in_out.png)
static const String ASSETS_HOME_CLOCK_IN_OUT_PNG =
'assets/home/clock_in_out.png';
/// ![preview](file:///Users/datang/aku_community_manager/assets/home/device_alarm.png)
static const String ASSETS_HOME_DEVICE_ALARM_PNG =
'assets/home/device_alarm.png';
/// ![preview](file:///Users/datang/aku_community_manager/assets/home/facilities.png)
static const String ASSETS_HOME_FACILITIES_PNG = 'assets/home/facilities.png';
/// ![preview](file:///Users/datang/aku_community_manager/assets/home/fire_alarm.png)
static const String ASSETS_HOME_FIRE_ALARM_PNG = 'assets/home/fire_alarm.png';
/// ![preview](file:///Users/datang/aku_community_manager/assets/home/house_keeping.png)
static const String ASSETS_HOME_HOUSE_KEEPING_PNG =
'assets/home/house_keeping.png';

@ -0,0 +1,36 @@
class AlarmModel {
String? alarmNo;
String? alarmType;
String? deviceName;
String? deviceNo;
String? time;
int? type;
AlarmModel(
{this.alarmNo,
this.alarmType,
this.deviceName,
this.deviceNo,
this.time,
this.type});
AlarmModel.fromJson(Map<String, dynamic> json) {
alarmNo = json['alarmNo'];
alarmType = json['alarmType'];
deviceName = json['deviceName'];
deviceNo = json['deviceNo'];
time = json['time'];
type = json['type'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['alarmNo'] = this.alarmNo;
data['alarmType'] = this.alarmType;
data['deviceName'] = this.deviceName;
data['deviceNo'] = this.deviceNo;
data['time'] = this.time;
data['type'] = this.type;
return data;
}
}

@ -1,24 +1,33 @@
import 'dart:convert';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:aku_community_manager/style/app_style.dart';
import 'AlarmModel.dart';
class FireDialog {
static Future fireAlert(String subTitle) async {
var json = jsonDecode(subTitle);
AlarmModel alarmModel = AlarmModel.fromJson(json);
await Get.dialog(
CupertinoAlertDialog(
title: Text('发现火灾!请立刻组织疏散人群!'),
title: getImage(alarmModel),
content: Column(
children: [
Text(subTitle),
Text(getTitle(alarmModel)),
10.w.heightBox,
Icon(
CupertinoIcons.bell_fill,
color: Colors.red,
size: 48.w,
),
Text(getContent(alarmModel)),
],
),
actions: [
@ -31,4 +40,52 @@ class FireDialog {
barrierDismissible: false,
);
}
static String getTitle(AlarmModel alarmModel){
switch(alarmModel.type){
case 1:
return '发现火灾!请立刻组织疏散人群!';
case 2:
return '设备故障';
case 3:
return '管家端APP报警';
default:
return '';
}
}
static String getContent(AlarmModel alarmModel){
switch(alarmModel.type){
case 1:
return '${alarmModel.time},${alarmModel.deviceName}附近出现了火灾报警,请各位业主、租户保持镇静,不要慌乱,有序开始撤离!';
case 2:
return '${alarmModel.time},小区内有设备${alarmModel.deviceName}发生了报警,请物业负责人员尽快前往现场排查故障!';
case 3:
return '注意:\n${alarmModel.time},${alarmModel.deviceNo}${alarmModel.deviceName}'+
'在管家端app上点击了"一键报警",请尽快联系他沟通情况。\n'+
'${alarmModel.deviceName}联系方式:${alarmModel.alarmNo}\n'+
'如未能联系到${alarmModel.deviceName}。可择情报警'
;
default:
return '';
}
}
static Widget getImage(AlarmModel alarmModel){
switch(alarmModel.type){
case 1:
return Image.asset(R.ASSETS_HOME_FIRE_ALARM_PNG,width: 110.w,height: 110.w,fit: BoxFit.fill,);
case 2:
return Image.asset(R.ASSETS_HOME_DEVICE_ALARM_PNG,width: 110.w,height: 110.w,fit: BoxFit.fill,);
case 3:
return Image.asset(R.ASSETS_HOME_APP_ALARM_PNG,width: 110.w,height: 110.w,fit: BoxFit.fill,);
default:
return SizedBox();
}
}
}
Loading…
Cancel
Save