修改弹窗

hmxc
张萌 3 years ago
parent 5dc9862603
commit b736d2df69

@ -1,4 +1,4 @@
{ {
"flutterSdkVersion": "2.0.2", "flutterSdkVersion": "2.2.0",
"flavors": {} "flavors": {}
} }

@ -23,7 +23,6 @@ if (flutterVersionName == null) {
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

@ -9,7 +9,6 @@ buildscript {
classpath 'com.android.tools.build:gradle:3.5.0' classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.5' classpath 'com.google.gms:google-services:4.3.5'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.5.1'
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

@ -2,10 +2,10 @@ part 'engineer_repair.dart';
class API { class API {
///HOST ///HOST
static const String host = 'http://39.103.177.88:8804'; static const String host = 'http://shop.kaidalai.cn';
/// ///
static const String baseURL = '$host/IntelligentCommunity/butlerApp'; static const String baseURL = '$host/api/butlerApp';
/// ///
static String get resource => '$host/static'; static String get resource => '$host/static';

@ -1,36 +0,0 @@
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;
}
}

@ -0,0 +1,24 @@
import 'package:json_annotation/json_annotation.dart';
part 'fall_model.g.dart';
@JsonSerializable()
class FallModel {
final String? userName;
final String? tel;
final String? address;
final num? lon;
final num? lat;
final int? type;
factory FallModel.fromJson(Map<String, dynamic> json) =>
_$FallModelFromJson(json);
const FallModel({
this.userName,
this.tel,
this.address,
this.lon,
this.lat,
this.type,
});
}

@ -0,0 +1,18 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'fall_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
FallModel _$FallModelFromJson(Map<String, dynamic> json) {
return FallModel(
userName: json['userName'] as String?,
tel: json['tel'] as String?,
address: json['address'] as String?,
lon: json['lon'] as num?,
lat: json['lat'] as num?,
type: json['type'] as int?,
);
}

@ -0,0 +1,25 @@
import 'package:json_annotation/json_annotation.dart';
part 'fire_model.g.dart';
@JsonSerializable()
class FireModel {
String? alarmNo;
String? alarmType;
String? deviceName;
String? deviceNo;
String? time;
int? type;
factory FireModel.fromJson(Map<String, dynamic> json) =>
_$FireModelFromJson(json);
FireModel({
this.alarmNo,
this.alarmType,
this.deviceName,
this.deviceNo,
this.time,
this.type,
});
}

@ -0,0 +1,16 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'fire_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
FireModel _$FireModelFromJson(Map<String, dynamic> json) => FireModel(
alarmNo: json['alarmNo'] as String?,
alarmType: json['alarmType'] as String?,
deviceName: json['deviceName'] as String?,
deviceNo: json['deviceNo'] as String?,
time: json['time'] as String?,
type: json['type'] as int?,
);

@ -1,36 +1,36 @@
import 'dart:convert'; import 'dart:convert';
import 'package:aku_new_community_manager/style/app_style.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
import 'package:aku_new_community_manager/style/app_style.dart'; import 'alarm_models/fall_model.dart';
import 'alarm_models/fire_model.dart';
import 'AlarmModel.dart';
class FireDialog { class FireDialog {
static Future fireAlert(String subTitle) async { static Future fireAlert(String subTitle) async {
var json = jsonDecode(subTitle); Map<String, dynamic> json = jsonDecode(subTitle);
AlarmModel alarmModel = AlarmModel.fromJson(json); int type = json['type'] as int;
await Get.dialog( await Get.dialog(
CupertinoAlertDialog( CupertinoAlertDialog(
title: getImage(alarmModel), title: getImage(type),
content: Column( content: Column(
children: [ children: [
20.w.heightBox, 20.w.heightBox,
Text(getTitle(alarmModel),style: TextStyle(color: Colors.black,fontSize: 34.sp),), Text(
getTitle(type),
style: TextStyle(color: Colors.black, fontSize: 34.sp),
),
10.w.heightBox, 10.w.heightBox,
Text(
Text(getContent(alarmModel),style: TextStyle(color: Colors.black,fontSize: 26.sp),textAlign: TextAlign.start,), getContent(json, type),
style: TextStyle(color: Colors.black, fontSize: 26.sp),
textAlign: TextAlign.start,
),
], ],
), ),
actions: [ actions: [
@ -44,9 +44,8 @@ class FireDialog {
); );
} }
static String getTitle(int type) {
static String getTitle(AlarmModel alarmModel){ switch (type) {
switch(alarmModel.type){
case 1: case 1:
return '发现火灾!请立刻组织疏散人群!'; return '发现火灾!请立刻组织疏散人群!';
case 2: case 2:
@ -55,40 +54,61 @@ class FireDialog {
return '管家端APP报警'; return '管家端APP报警';
default: default:
return ''; return '';
} }
} }
static String getContent(AlarmModel alarmModel){ static String getContent(Map<String, dynamic> json, int type) {
switch(alarmModel.type){ switch (type) {
case 1: case 1:
var alarmModel = FireModel.fromJson(json);
return '${alarmModel.time},${alarmModel.deviceName}附近出现了火灾报警,请各位业主、租户保持镇静,不要慌乱,有序开始撤离!'; return '${alarmModel.time},${alarmModel.deviceName}附近出现了火灾报警,请各位业主、租户保持镇静,不要慌乱,有序开始撤离!';
case 2: case 2:
var alarmModel = FireModel.fromJson(json);
return '${alarmModel.time},小区内有设备${alarmModel.deviceName}发生了报警,请物业负责人员尽快前往现场排查故障!'; return '${alarmModel.time},小区内有设备${alarmModel.deviceName}发生了报警,请物业负责人员尽快前往现场排查故障!';
case 3: case 3:
return '注意:\n${alarmModel.time},${alarmModel.deviceNo}${alarmModel.deviceName}'+ var alarmModel = FireModel.fromJson(json);
'在管家端app上点击了"一键报警",请尽快联系他沟通情况。\n'+ return '注意:\n${alarmModel.time},${alarmModel.deviceNo}${alarmModel.deviceName}' +
'${alarmModel.deviceName}联系方式:${alarmModel.alarmNo}\n'+ '在管家端app上点击了"一键报警",请尽快联系他沟通情况。\n' +
'如未能联系到${alarmModel.deviceName}。可择情报警' '${alarmModel.deviceName}联系方式:${alarmModel.alarmNo}\n' +
; '如未能联系到${alarmModel.deviceName}。可择情报警';
case 4:
var alarmModel = FallModel.fromJson(json);
return '注意:\n\n有住户 ${alarmModel.userName} 发生跌倒情况,请及时上门或联系人员前往查看,住户联系方式:${alarmModel.tel}\n\n' +
'跌倒位置————\n${alarmModel.address},经度${alarmModel.lon},纬度${alarmModel.lat}\n\n如未能联系到住户,可择情报警';
case 5:
var alarmModel = FallModel.fromJson(json);
return '注意:\n\n有住户 ${alarmModel.userName} 使用了SOS紧急联系报警请及时上门或联系人员前往查看住户联系方式${alarmModel.tel}\n\n' +
'跌倒位置————\n${alarmModel.address},经度${alarmModel.lon},纬度${alarmModel.lat}\n\n如未能联系到住户,可择情报警';
default: default:
return ''; return '';
} }
} }
static Widget getImage(AlarmModel alarmModel){ static Widget getImage(int type) {
switch(alarmModel.type){ switch (type) {
case 1: case 1:
return Image.asset(R.ASSETS_HOME_FIRE_ALARM_PNG,width: 100.w,height: 100.w,fit: BoxFit.fitHeight,); return Image.asset(
R.ASSETS_HOME_FIRE_ALARM_PNG,
width: 100.w,
height: 100.w,
fit: BoxFit.fitHeight,
);
case 2: case 2:
return Image.asset(R.ASSETS_HOME_DEVICE_ALARM_PNG,width: 100.w,height: 100.w,fit: BoxFit.fitHeight,); return Image.asset(
R.ASSETS_HOME_DEVICE_ALARM_PNG,
width: 100.w,
height: 100.w,
fit: BoxFit.fitHeight,
);
case 3: case 3:
return Image.asset(R.ASSETS_HOME_APP_ALARM_PNG,width: 100.w,height: 100.w,fit: BoxFit.fitHeight,); return Image.asset(
R.ASSETS_HOME_APP_ALARM_PNG,
width: 100.w,
height: 100.w,
fit: BoxFit.fitHeight,
);
default: default:
return SizedBox(); return SizedBox();
} }
} }
} }

@ -1,10 +1,11 @@
import 'dart:async'; import 'dart:async';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
import 'package:power_logger/power_logger.dart'; import 'package:power_logger/power_logger.dart';
import 'package:web_socket_channel/io.dart'; import 'package:web_socket_channel/io.dart';
import 'package:web_socket_channel/web_socket_channel.dart'; import 'package:web_socket_channel/web_socket_channel.dart';
const String baseUri = 'wss://test.kaidalai.cn/websocket/butlerApp'; const String baseUri = 'wss://shop.kaidalai.cn/websocket/butlerApp';
enum SOCKETSTATUS { enum SOCKETSTATUS {
CONNECTED, // CONNECTED, //
BREAKOFF, // BREAKOFF, //

@ -11,9 +11,9 @@ class Config {
/// ///
static String get apkDevDir => static String get apkDevDir =>
'/users/datang/team/bee/app/aku_new_community_manager/dev'; '/users/zhangmeng/team/bee/app/aku_new_community_manager/dev';
///aku_new_community_manager ///aku_new_community_manager
static String get apkDir => static String get apkDir =>
'/users/datang/team/bee/app/aku_new_community_manager/release'; '/users/zhangmeng/team/bee/app/aku_new_community_manager/release';
} }

@ -93,6 +93,6 @@ void gen() async {
@Task('生成model') @Task('生成model')
void genClean() async { void genClean() async {
await Pub.runAsync('build_runner', await Pub.run('build_runner',
arguments: ['build', '--delete-conflicting-outputs']); arguments: ['build', '--delete-conflicting-outputs']);
} }

Loading…
Cancel
Save