From c76bfad11e57b6ef9c8444e6cca7e25c42ed94c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E8=90=8C?= <494089941@qq.com> Date: Tue, 7 Jun 2022 11:46:00 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E9=83=A8=E5=88=86=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E5=BA=93=20=E4=BF=AE=E6=94=B9websocket=E6=8E=A5?= =?UTF-8?q?=E6=94=B6=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/constants/app_theme.dart | 29 ++- lib/generated_plugin_registrant.dart | 2 - lib/pages/splash/splash_page.dart | 65 +------ lib/pages/tab_navigator.dart | 35 ---- lib/utils/data_util.dart | 10 - lib/utils/updater/updater_model.dart | 28 --- lib/utils/updater/updater_model.g.dart | 15 -- lib/utils/updater/updater_page.dart | 171 ------------------ .../websocket/alarm_models/fire_model.dart | 76 ++++++-- .../websocket/alarm_models/fire_model.g.dart | 11 ++ lib/utils/websocket/fire_dialog.dart | 110 +++++++---- lib/widget/dialog/bee_custom_dialog.dart | 65 +++++++ macos/Flutter/GeneratedPluginRegistrant.swift | 4 - pubspec.lock | 105 ----------- pubspec.yaml | 8 +- 15 files changed, 238 insertions(+), 496 deletions(-) delete mode 100644 lib/utils/data_util.dart delete mode 100644 lib/utils/updater/updater_model.dart delete mode 100644 lib/utils/updater/updater_model.g.dart delete mode 100644 lib/utils/updater/updater_page.dart create mode 100644 lib/widget/dialog/bee_custom_dialog.dart diff --git a/lib/constants/app_theme.dart b/lib/constants/app_theme.dart index 2871d246..7e5fddfe 100644 --- a/lib/constants/app_theme.dart +++ b/lib/constants/app_theme.dart @@ -9,9 +9,9 @@ class AppTheme { extensions: >[ MyAppStyle( mainColor: Colors.blue, - bodyText3: TextStyle( - fontSize: 30.sp, - color: const Color(0xFF333333), + dialogContentText: TextStyle( + fontSize: 28.sp, + color: Colors.black.withOpacity(0.85), ), ) ], @@ -187,14 +187,20 @@ class SystemStyle { @immutable class MyAppStyle extends ThemeExtension { - final TextStyle? bodyText3; + final TextStyle? dialogContentText; + final TextStyle? dialogActionButtonText; final Color? mainColor; @override - MyAppStyle copyWith({Color? mainColor, TextStyle? bodyText3}) { + MyAppStyle copyWith( + {Color? mainColor, + TextStyle? dialogContentText, + TextStyle? dialogActionButtonText}) { return MyAppStyle( mainColor: mainColor ?? this.mainColor, - bodyText3: bodyText3 ?? this.bodyText3); + dialogContentText: dialogContentText ?? this.dialogContentText, + dialogActionButtonText: + dialogActionButtonText ?? this.dialogActionButtonText); } @override @@ -203,13 +209,16 @@ class MyAppStyle extends ThemeExtension { return this; } return MyAppStyle( - mainColor: Color.lerp(mainColor, other.mainColor, t), - bodyText3: TextStyle.lerp(bodyText3, other.bodyText3, t), - ); + mainColor: Color.lerp(mainColor, other.mainColor, t), + dialogContentText: + TextStyle.lerp(dialogContentText, other.dialogContentText, t), + dialogActionButtonText: TextStyle.lerp( + dialogActionButtonText, other.dialogActionButtonText, t)); } const MyAppStyle({ - this.bodyText3, + this.dialogContentText, this.mainColor, + this.dialogActionButtonText, }); } diff --git a/lib/generated_plugin_registrant.dart b/lib/generated_plugin_registrant.dart index e821df08..366ed6c3 100644 --- a/lib/generated_plugin_registrant.dart +++ b/lib/generated_plugin_registrant.dart @@ -12,7 +12,6 @@ import 'package:flutter_sound_web/flutter_sound_web.dart'; import 'package:image_picker_for_web/image_picker_for_web.dart'; import 'package:just_audio_web/just_audio_web.dart'; import 'package:package_info_plus_web/package_info_plus_web.dart'; -import 'package:shared_preferences_web/shared_preferences_web.dart'; import 'package:url_launcher_web/url_launcher_web.dart'; import 'package:flutter_web_plugins/flutter_web_plugins.dart'; @@ -25,7 +24,6 @@ void registerPlugins(Registrar registrar) { ImagePickerPlugin.registerWith(registrar); JustAudioPlugin.registerWith(registrar); PackageInfoPlugin.registerWith(registrar); - SharedPreferencesPlugin.registerWith(registrar); UrlLauncherPlugin.registerWith(registrar); registrar.registerMessageHandler(); } diff --git a/lib/pages/splash/splash_page.dart b/lib/pages/splash/splash_page.dart index c0b0afa6..baa93075 100644 --- a/lib/pages/splash/splash_page.dart +++ b/lib/pages/splash/splash_page.dart @@ -1,7 +1,6 @@ -import 'package:aku_app_upgrade/aku_app_upgrade.dart'; -import 'package:flutter/gestures.dart'; +import 'dart:io'; + import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:amap_flutter_location/amap_flutter_location.dart'; import 'package:equatable/equatable.dart'; @@ -28,60 +27,6 @@ class SplashPage extends StatefulWidget { } class _SplashPageState extends State { - TapGestureRecognizer _agreementRecognizer = TapGestureRecognizer(); - TapGestureRecognizer _privacyRecognizer = TapGestureRecognizer(); - - Future _showLoginVerify() async { - var re = await Get.dialog(AppVerifyDialog()); - return re; - // return await showCupertinoDialog( - // barrierDismissible: false, - // context: context, - // builder: (context) { - // return CupertinoAlertDialog( - // title: Text('隐私政策和用户协议'), - // content: RichText( - // text: TextSpan( - // text: '点击登录即表示您已阅读并同意', - // style: TextStyle(color: Colors.black), - // children: [ - // TextSpan( - // text: '《用户协议》', - // style: TextStyle(color: Colors.blue), - // recognizer: _agreementRecognizer - // ..onTap = () { - // Get.to(() => AgreementPage()); - // }), - // TextSpan( - // text: '《隐私政策》', - // style: TextStyle(color: Colors.blue), - // recognizer: _privacyRecognizer - // ..onTap = () { - // Get.to(() => PrivacyPage()); - // }), - // TextSpan( - // style: TextStyle(color: Colors.black), - // text: - // '(特别是免除或限制责任、管辖等粗体下划线标注的条款)。如您不同意上述协议的任何条款,您应立即停止登录及使用本软件及服务。') - // ]), - // ), - // - // // ), - // actions: [ - // CupertinoDialogAction( - // child: Text('拒绝'), - // onPressed: () => Get.back(result: false), - // ), - // CupertinoDialogAction( - // child: Text('同意'), - // onPressed: () => Get.back(result: true), - // ), - // ], - // ); - // }, - // ); - } - @override void initState() { super.initState(); @@ -97,9 +42,9 @@ class _SplashPageState extends State { await HiveStore.init(); var agreement = await HiveStore.appBox?.get('agreement') ?? false; if (!agreement) { - var result = await _showLoginVerify(); + var result = await Get.dialog(AppVerifyDialog()); if (result == null || !result) { - SystemNavigator.pop(); + exit(0); HiveStore.appBox!.put('agreement', false); } else { HiveStore.appBox!.put('agreement', true); @@ -111,7 +56,7 @@ class _SplashPageState extends State { // await Permission.locationWhenInUse.request(); // } //第三方加载 - await AppUpgrade().checkUpgrade(context); + // await AppUpgrade().checkUpgrade(context); MainInitialize.initJPush(); EquatableConfig.stringify = true; AMapFlutterLocation.updatePrivacyShow(true, true); diff --git a/lib/pages/tab_navigator.dart b/lib/pages/tab_navigator.dart index c201c31d..6b36fe71 100644 --- a/lib/pages/tab_navigator.dart +++ b/lib/pages/tab_navigator.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:bot_toast/bot_toast.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; -import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:provider/provider.dart'; @@ -41,18 +40,10 @@ class _TabNavigatorState extends State List _pages = []; EasyRefreshController _refreshController = EasyRefreshController(); - late FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin; @override void initState() { super.initState(); - flutterLocalNotificationsPlugin = new FlutterLocalNotificationsPlugin(); - var android = new AndroidInitializationSettings('@mipmap/ic_launcher'); - var iOS = new IOSInitializationSettings(); - var initSettings = new InitializationSettings(android: android,iOS: iOS); - flutterLocalNotificationsPlugin.initialize(initSettings); - //showNotification(); - final appProvider = Provider.of(Get.context!); Future.delayed(Duration(milliseconds: 0), () async { await appProvider.getMyAddress(); //设置默认地址 @@ -228,30 +219,4 @@ class _TabNavigatorState extends State ), ); } - - Future onSelectNotification(String payload) async { - if (payload != null) { - debugPrint('notification payload: ' + payload); - } -//payload 可作为通知的一个标记,区分点击的通知。 - debugPrint('payload:$payload'); - if(payload == "complete") { - await showDialog(context: context, builder: (_) => AlertDialog( - title: Text('Notification'), - content: Text('$payload'), - ),); - } - } - - showNotification() async { - var android = new AndroidNotificationDetails( - 'channel id', 'channel NAME', - priority: Priority.high, - importance: Importance.max,); - var iOS = new IOSNotificationDetails(); - var platform = new NotificationDetails(android: android, iOS: iOS); - await flutterLocalNotificationsPlugin.show( - 0, 'New Video is out', 'Flutter Local Notification', platform, - payload: 'Nitish Kumar Singh is part time Youtuber'); - } } diff --git a/lib/utils/data_util.dart b/lib/utils/data_util.dart deleted file mode 100644 index 74319fbb..00000000 --- a/lib/utils/data_util.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:sp_util/sp_util.dart'; - -import 'constants.dart'; - -class DataUtil { - static saveCurrentTimeMillis(int timeStart) async { - await SpUtil.getInstance(); - SpUtil.putInt(Constants.timeStart, timeStart); - } -} diff --git a/lib/utils/updater/updater_model.dart b/lib/utils/updater/updater_model.dart deleted file mode 100644 index 35b0069d..00000000 --- a/lib/utils/updater/updater_model.dart +++ /dev/null @@ -1,28 +0,0 @@ -import 'package:equatable/equatable.dart'; -import 'package:json_annotation/json_annotation.dart'; -part 'updater_model.g.dart'; - -@JsonSerializable() -class UpdaterModel extends Equatable{ - final int id; - final String versionNumber; - final String buildNo; - final int forceUpdate; - final String createDate; - - factory UpdaterModel.fromJson(Map json) =>_$UpdaterModelFromJson(json); - - const UpdaterModel({ - required this.id, - required this.versionNumber, - required this.buildNo, - required this.forceUpdate, - required this.createDate, - }); - - @override - List get props => [ - id,versionNumber,buildNo,forceUpdate,createDate, - ]; -} - diff --git a/lib/utils/updater/updater_model.g.dart b/lib/utils/updater/updater_model.g.dart deleted file mode 100644 index 35da6db2..00000000 --- a/lib/utils/updater/updater_model.g.dart +++ /dev/null @@ -1,15 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'updater_model.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -UpdaterModel _$UpdaterModelFromJson(Map json) => UpdaterModel( - id: json['id'] as int, - versionNumber: json['versionNumber'] as String, - buildNo: json['buildNo'] as String, - forceUpdate: json['forceUpdate'] as int, - createDate: json['createDate'] as String, - ); diff --git a/lib/utils/updater/updater_page.dart b/lib/utils/updater/updater_page.dart deleted file mode 100644 index d9c39a7a..00000000 --- a/lib/utils/updater/updater_page.dart +++ /dev/null @@ -1,171 +0,0 @@ -import 'package:aku_new_community/utils/updater/updater_model.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:package_info/package_info.dart'; -import 'package:dio/dio.dart'; -import 'package:sp_util/sp_util.dart'; -import 'package:url_launcher/url_launcher.dart'; -import '../../constants/saas_api.dart'; -import '../constants.dart'; -import '../data_util.dart'; -import '../network/net_util.dart'; - -class UpdaterPage extends StatefulWidget { - final Widget child; - const UpdaterPage(this.child); - - @override - UpdatePagerState createState() => UpdatePagerState(); -} - -class UpdatePagerState extends State { - UpdaterModel? _model; - var _serviceVersionCode, - _serviceVersionName, - _serviceVersionPlatform, - _serviceVersionApp; - - @override - void initState() { - super.initState(); - //每次打开APP获取当前时间戳 - var timeEnd = DateTime.now().millisecondsSinceEpoch; - _getNewVersionAPP(); - //获取"Later"保存的时间戳 - var timeStart = SpUtil.getInt(Constants.timeStart); - if (timeStart == 0) { - //第一次打开APP时执行"版本更新"的网络请求 - _getNewVersionAPP(); - } else if (timeStart != 0 && timeEnd - timeStart! >= 24 * 60 * 60 * 1000) { - //如果新旧时间戳的差大于或等于一天,执行网络请求 - _getNewVersionAPP(); - } - - } - - //执行版本更新的网络请求 - _getNewVersionAPP() async { - var base = - await NetUtil().get(SAASAPI.updater.findNewVersion, params: { - 'version': '1.8.12', - }); - if (base.success) { - _model = UpdaterModel.fromJson(base.data); - setState(() {}); - } - _checkVersionCode(); - } - - //检查版本更新的版本号 - _checkVersionCode() async { - PackageInfo packageInfo = await PackageInfo.fromPlatform(); - String _currentVersionCode = packageInfo.version; - print('版本——————————————————————'+ '${_currentVersionCode}'); - int serviceVersionCode = int.parse(_serviceVersionCode); - print(serviceVersionCode); - int currentVersionCode = int.parse(_currentVersionCode); - print(currentVersionCode); - if (serviceVersionCode > currentVersionCode) { - _showNewVersionAppDialog(); //弹出对话框 - } - } - - //弹出"版本更新"对话框 - Future _showNewVersionAppDialog() async { - print('弹出框'); - if (_serviceVersionPlatform == "android") { - return showDialog( - context: context, - barrierDismissible: false, - builder: (BuildContext context) { - return AlertDialog( - title: Row( - children: [ - Image.asset("images/ic_launcher_icon.png", - height: 35.0, width: 35.0), - Padding( - padding: EdgeInsets.fromLTRB(30.0, 0.0, 10.0, 0.0), - child: Text('项目名称', - style: TextStyle( - color: Color(0xFF384F6F), fontSize: 20.0),),) - ], - ), - content: Text('提示的内容', - style: TextStyle( - color: Color(0xFF384F6F), fontSize: 18.0),), - actions: [ - OutlinedButton( - child: new Text('稍后再说', - style: TextStyle( - color: Color(0xFF384F6F), fontSize: 20.0),), - onPressed: () { - Navigator.of(context).pop(); - var timeStart = DateTime.now().millisecondsSinceEpoch; - DataUtil.saveCurrentTimeMillis(timeStart); //保存当前的时间戳 - }, - ), - OutlinedButton( - child: new Text('下载', - style: TextStyle( - color: Color(0xFF384F6F), fontSize: 20.0)), - onPressed: () { - //https://play.google.com/store/apps/details?id=项目包名 - launch(_serviceVersionApp); //到Google Play 官网下载 - Navigator.of(context).pop(); - }, - ) - ], - ); - }); - } else { - //iOS - return showDialog( - context: context, - barrierDismissible: false, - builder: (BuildContext context) { - return CupertinoAlertDialog( - title:Row( - children: [ - Image.asset("images/ic_launcher_icon.png", - height: 35.0, width: 35.0), - Padding( - padding: EdgeInsets.fromLTRB(30.0, 0.0, 10.0, 0.0), - child: Text('项目名称', - style: TextStyle( - color: Color(0xFF384F6F), fontSize: 20.0),),) - ], - ), - content: Text('提示的内容', - style: TextStyle( - color: Color(0xFF384F6F), fontSize: 18.0),), - - actions: [ - OutlinedButton( - child: new Text('稍后再说', - style: TextStyle( - color: Color(0xFF384F6F), fontSize: 20.0),), - onPressed: () { - Navigator.of(context).pop(); - var timeStart = DateTime.now().millisecondsSinceEpoch; - DataUtil.saveCurrentTimeMillis(timeStart); //保存当前的时间戳 - }, - ), - OutlinedButton( - child: new Text('下载', - style: TextStyle( - color: Color(0xFF384F6F), fontSize: 20.0)), - onPressed: () { - //https://play.google.com/store/apps/details?id=项目包名 - launch(_serviceVersionApp); //到Google Play 官网下载 - Navigator.of(context).pop(); - }, - ), - ], - ); - }); - } - } - - @override - Widget build(BuildContext context) => widget.child; -} diff --git a/lib/utils/websocket/alarm_models/fire_model.dart b/lib/utils/websocket/alarm_models/fire_model.dart index db4dee2b..e85b0295 100644 --- a/lib/utils/websocket/alarm_models/fire_model.dart +++ b/lib/utils/websocket/alarm_models/fire_model.dart @@ -13,6 +13,7 @@ class FireModel extends Equatable { final OneButtonAlarm? oneButtonAlarm; final ClientAlarm? clientAlarm; final ElderlyCareEquipmentReminder? elderlyCareEquipmentReminder; + final WorkOrderAlert? workOrderAlert; factory FireModel.fromJson(Map json) => _$FireModelFromJson(json); @@ -27,25 +28,30 @@ class FireModel extends Equatable { oneButtonAlarm, clientAlarm, elderlyCareEquipmentReminder, + workOrderAlert ]; - const FireModel({ - required this.model, - required this.communityCode, - required this.type, - this.fireAlarm, - this.deviceAlarm, - this.oneButtonAlarm, - this.clientAlarm, - this.elderlyCareEquipmentReminder, - }); + const FireModel( + {required this.model, + required this.communityCode, + required this.type, + this.fireAlarm, + this.deviceAlarm, + this.oneButtonAlarm, + this.clientAlarm, + this.elderlyCareEquipmentReminder, + this.workOrderAlert}); } +///火警 @JsonSerializable() class FireAlarm extends Equatable { final String time; final String deviceName; -factory FireAlarm.fromJson(Map json) =>_$FireAlarmFromJson(json); + + factory FireAlarm.fromJson(Map json) => + _$FireAlarmFromJson(json); + @override List get props => [ time, @@ -58,11 +64,15 @@ factory FireAlarm.fromJson(Map json) =>_$FireAlarmFromJson(json }); } +///设备报警 @JsonSerializable() class DeviceAlarm extends Equatable { final String time; final String deviceName; -factory DeviceAlarm.fromJson(Map json) =>_$DeviceAlarmFromJson(json); + + factory DeviceAlarm.fromJson(Map json) => + _$DeviceAlarmFromJson(json); + @override List get props => [ time, @@ -75,13 +85,17 @@ factory DeviceAlarm.fromJson(Map json) =>_$DeviceAlarmFromJson( }); } +///一键报警 @JsonSerializable() class OneButtonAlarm extends Equatable { final String time; final String roomName; final String name; final String tel; -factory OneButtonAlarm.fromJson(Map json) =>_$OneButtonAlarmFromJson(json); + + factory OneButtonAlarm.fromJson(Map json) => + _$OneButtonAlarmFromJson(json); + @override List get props => [ time, @@ -98,11 +112,15 @@ factory OneButtonAlarm.fromJson(Map json) =>_$OneButtonAlarmFro }); } +///客户端消息 @JsonSerializable() class ClientAlarm extends Equatable { final String time; final String content; -factory ClientAlarm.fromJson(Map json) =>_$ClientAlarmFromJson(json); + + factory ClientAlarm.fromJson(Map json) => + _$ClientAlarmFromJson(json); + @override List get props => [ time, @@ -115,12 +133,16 @@ factory ClientAlarm.fromJson(Map json) =>_$ClientAlarmFromJson( }); } +///养老设备报警 @JsonSerializable() class ElderlyCareEquipmentReminder extends Equatable { final String deviceNo; final int deviceType; final String content; -factory ElderlyCareEquipmentReminder.fromJson(Map json) =>_$ElderlyCareEquipmentReminderFromJson(json); + + factory ElderlyCareEquipmentReminder.fromJson(Map json) => + _$ElderlyCareEquipmentReminderFromJson(json); + @override List get props => [ deviceNo, @@ -134,3 +156,27 @@ factory ElderlyCareEquipmentReminder.fromJson(Map json) =>_$Eld required this.content, }); } + +///报事报修消息 +@JsonSerializable() +class WorkOrderAlert extends Equatable { + final int workOrderId; + final String content; + final String time; + + factory WorkOrderAlert.fromJson(Map json) => + _$WorkOrderAlertFromJson(json); + + const WorkOrderAlert({ + required this.workOrderId, + required this.content, + required this.time, + }); + + @override + List get props => [ + workOrderId, + content, + time, + ]; +} diff --git a/lib/utils/websocket/alarm_models/fire_model.g.dart b/lib/utils/websocket/alarm_models/fire_model.g.dart index 3900f809..0f96930a 100644 --- a/lib/utils/websocket/alarm_models/fire_model.g.dart +++ b/lib/utils/websocket/alarm_models/fire_model.g.dart @@ -27,6 +27,10 @@ FireModel _$FireModelFromJson(Map json) => FireModel( ? null : ElderlyCareEquipmentReminder.fromJson( json['elderlyCareEquipmentReminder'] as Map), + workOrderAlert: json['workOrderAlert'] == null + ? null + : WorkOrderAlert.fromJson( + json['workOrderAlert'] as Map), ); FireAlarm _$FireAlarmFromJson(Map json) => FireAlarm( @@ -59,3 +63,10 @@ ElderlyCareEquipmentReminder _$ElderlyCareEquipmentReminderFromJson( deviceType: json['deviceType'] as int, content: json['content'] as String, ); + +WorkOrderAlert _$WorkOrderAlertFromJson(Map json) => + WorkOrderAlert( + workOrderId: json['workOrderId'] as int, + content: json['content'] as String, + time: json['time'] as String, + ); diff --git a/lib/utils/websocket/fire_dialog.dart b/lib/utils/websocket/fire_dialog.dart index 57427e95..fd57b734 100644 --- a/lib/utils/websocket/fire_dialog.dart +++ b/lib/utils/websocket/fire_dialog.dart @@ -1,5 +1,9 @@ import 'dart:convert'; +import 'package:aku_new_community/constants/app_theme.dart'; +import 'package:aku_new_community/ui/function_and_service/work_order/work_order_detail_page.dart'; +import 'package:aku_new_community/widget/dialog/bee_custom_dialog.dart'; +import 'package:aku_new_community/widget/others/user_tool.dart'; import 'package:common_utils/common_utils.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -17,41 +21,47 @@ class FireDialog { static fireAlarm(String content) async { LoggerData.addData(content); var json = jsonDecode(content); - int type = json['type'] as int; - - await Get.dialog( - CupertinoAlertDialog( - title: getImage(type), - content: Column( - children: [ - Text( - getTitle(type), - style: TextStyle(color: Colors.black, fontSize: 34.sp), - ), - 10.hb, - Text( - getContent(json, type), - style: TextStyle(color: Colors.black, fontSize: 26.sp), - textAlign: TextAlign.start, + var alarmModel = FireModel.fromJson(json); + if (alarmModel.type == 6) { + await await Get.dialog( + BeeCustomDialog( + actions: [ + MaterialButton( + onPressed: () { + Get.back(); + }, + child: Text( + '暂不理会', + style: UserTool.myAppStyle.dialogActionButtonText! + .copyWith(color: Colors.black.withOpacity(0.45)), + ), ), + MaterialButton( + onPressed: () { + Get.to(WorkOrderDetailPage( + id: alarmModel.workOrderAlert!.workOrderId)); + }, + child: Text( + '前往确认', + style: UserTool.myAppStyle.dialogActionButtonText, + ), + ) ], + content: Padding( + padding: EdgeInsets.all(32.w), + child: Text( + '您有一单报事报修已完成,请立即确认', + style: UserTool.myAppStyle.dialogContentText, + )), ), - actions: [ - CupertinoDialogAction( - child: Text('确认'), - onPressed: () => Get.back(), - ), - if (DeveloperUtil.dev) - CupertinoDialogAction( - child: Text('清除所有弹窗'), - onPressed: () => Get.offAll( - () => TabNavigator(), - ), - ), - ], - ), - barrierDismissible: false, - ); + barrierDismissible: false, + ); + } else { + await Get.dialog( + getDialog(alarmModel), + barrierDismissible: false, + ); + } } static String getTitle(int type) { @@ -71,9 +81,39 @@ class FireDialog { } } - static String getContent(dynamic json, int type) { - var alarmModel = FireModel.fromJson(json); - switch (type) { + static Widget getDialog(FireModel alarmModel) { + return CupertinoAlertDialog( + title: getImage(alarmModel.type), + content: Column( + children: [ + Text( + getTitle(alarmModel.type), + style: TextStyle(color: Colors.black, fontSize: 34.sp), + ), + 10.hb, + Text( + getContent(alarmModel), + style: TextStyle(color: Colors.black, fontSize: 26.sp), + textAlign: TextAlign.start, + ), + ], + ), + actions: [ + CupertinoDialogAction( + child: Text('确认'), + onPressed: () => Get.back(), + ), + if (DeveloperUtil.dev) + CupertinoDialogAction( + child: Text('清除所有弹窗'), + onPressed: () => Get.offAll(() => TabNavigator()), + ), + ], + ); + } + + static String getContent(FireModel alarmModel) { + switch (alarmModel.type) { case 1: return '于${DateUtil.formatDateStr(alarmModel.fireAlarm!.time, format: DateFormats.zh_y_mo_d_h_m)},' '${alarmModel.fireAlarm!.deviceName}附近出现了火灾报警,请各位业主、租户保持镇静,不要慌乱,有序开始撤离!'; diff --git a/lib/widget/dialog/bee_custom_dialog.dart b/lib/widget/dialog/bee_custom_dialog.dart new file mode 100644 index 00000000..f8583760 --- /dev/null +++ b/lib/widget/dialog/bee_custom_dialog.dart @@ -0,0 +1,65 @@ +import 'package:aku_new_community/utils/headers.dart'; +import 'package:aku_new_community/widget/bee_divider.dart'; +import 'package:flutter/material.dart'; + +class BeeCustomDialog extends StatelessWidget { + final List actions; + final Widget content; + + const BeeCustomDialog( + {Key? key, required this.actions, required this.content}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return Center( + child: Container( + width: 600.w, + height: 700.w, + clipBehavior: Clip.antiAliasWithSaveLayer, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(24.w), + ), + child: Material( + child: Container( + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + stops: [ + 0, + 0.3, + ], + colors: [ + Color(0x33FBE541), + Colors.white, + ])), + child: Column( + children: [ + content, + Spacer(), + BeeDivider.horizontal(), + ConstrainedBox( + constraints: BoxConstraints(maxHeight: 100.w), + child: Row( + children: actions + .map((e) => Expanded(child: e)) + .toList() + .sepWidget( + separate: Container( + width: 2.w, + height: double.infinity, + color: Color(0xFFF0F0F0), + ), + ), + ), + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 077b89ee..d850309c 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -7,24 +7,20 @@ import Foundation import audio_session import device_info_plus_macos -import flutter_local_notifications import just_audio import package_info import package_info_plus_macos import path_provider_macos -import shared_preferences_macos import sqflite import url_launcher_macos func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin")) DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) - FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin")) JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin")) FLTPackageInfoPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlugin")) FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) - SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) } diff --git a/pubspec.lock b/pubspec.lock index 7e416385..1e07b761 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -15,13 +15,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.1" - aku_app_upgrade: - dependency: "direct main" - description: - path: "../aku_app_upgrade" - relative: true - source: path - version: "0.0.1" amap_flutter_base: dependency: "direct main" description: @@ -311,13 +304,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.0" - dbus: - dependency: transitive - description: - name: dbus - url: "https://pub.dartlang.org" - source: hosted - version: "0.7.3" decimal: dependency: transitive description: @@ -507,27 +493,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.1" - flutter_local_notifications: - dependency: "direct main" - description: - name: flutter_local_notifications - url: "https://pub.dartlang.org" - source: hosted - version: "9.5.3+1" - flutter_local_notifications_linux: - dependency: transitive - description: - name: flutter_local_notifications_linux - url: "https://pub.dartlang.org" - source: hosted - version: "0.4.2" - flutter_local_notifications_platform_interface: - dependency: transitive - description: - name: flutter_local_notifications_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "5.0.0" flutter_localizations: dependency: "direct main" description: flutter @@ -1163,62 +1128,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.4" - shared_preferences: - dependency: transitive - description: - name: shared_preferences - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.15" - shared_preferences_android: - dependency: transitive - description: - name: shared_preferences_android - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.12" - shared_preferences_ios: - dependency: transitive - description: - name: shared_preferences_ios - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.1" - shared_preferences_linux: - dependency: transitive - description: - name: shared_preferences_linux - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.1" - shared_preferences_macos: - dependency: transitive - description: - name: shared_preferences_macos - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.4" - shared_preferences_platform_interface: - dependency: transitive - description: - name: shared_preferences_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.0" - shared_preferences_web: - dependency: transitive - description: - name: shared_preferences_web - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.4" - shared_preferences_windows: - dependency: transitive - description: - name: shared_preferences_windows - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.1" shelf: dependency: transitive description: @@ -1280,13 +1189,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.8.2" - sp_util: - dependency: "direct main" - description: - name: sp_util - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.3" sqflite: dependency: transitive description: @@ -1357,13 +1259,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.0" - timezone: - dependency: transitive - description: - name: timezone - url: "https://pub.dartlang.org" - source: hosted - version: "0.8.0" timing: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 5e0c15e1..83fbd24f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -127,13 +127,9 @@ dependencies: like_button: ^2.0.4 #图片扩展 extended_image: ^6.1.0 - #本地缓存 - sp_util: ^2.0.0 - #系统通知栏消息 - flutter_local_notifications: ^9.5.3+1 #app更新 - aku_app_upgrade: - path: ../aku_app_upgrade +# aku_app_upgrade: +# path: ../aku_app_upgrade dev_dependencies: flutter_test: