移除部分依赖库

修改websocket接收弹窗
pull/1/head
张萌 3 years ago
parent 354759fc8b
commit c76bfad11e

@ -9,9 +9,9 @@ class AppTheme {
extensions: <ThemeExtension<dynamic>>[ extensions: <ThemeExtension<dynamic>>[
MyAppStyle( MyAppStyle(
mainColor: Colors.blue, mainColor: Colors.blue,
bodyText3: TextStyle( dialogContentText: TextStyle(
fontSize: 30.sp, fontSize: 28.sp,
color: const Color(0xFF333333), color: Colors.black.withOpacity(0.85),
), ),
) )
], ],
@ -187,14 +187,20 @@ class SystemStyle {
@immutable @immutable
class MyAppStyle extends ThemeExtension<MyAppStyle> { class MyAppStyle extends ThemeExtension<MyAppStyle> {
final TextStyle? bodyText3; final TextStyle? dialogContentText;
final TextStyle? dialogActionButtonText;
final Color? mainColor; final Color? mainColor;
@override @override
MyAppStyle copyWith({Color? mainColor, TextStyle? bodyText3}) { MyAppStyle copyWith(
{Color? mainColor,
TextStyle? dialogContentText,
TextStyle? dialogActionButtonText}) {
return MyAppStyle( return MyAppStyle(
mainColor: mainColor ?? this.mainColor, mainColor: mainColor ?? this.mainColor,
bodyText3: bodyText3 ?? this.bodyText3); dialogContentText: dialogContentText ?? this.dialogContentText,
dialogActionButtonText:
dialogActionButtonText ?? this.dialogActionButtonText);
} }
@override @override
@ -203,13 +209,16 @@ class MyAppStyle extends ThemeExtension<MyAppStyle> {
return this; return this;
} }
return MyAppStyle( return MyAppStyle(
mainColor: Color.lerp(mainColor, other.mainColor, t), mainColor: Color.lerp(mainColor, other.mainColor, t),
bodyText3: TextStyle.lerp(bodyText3, other.bodyText3, t), dialogContentText:
); TextStyle.lerp(dialogContentText, other.dialogContentText, t),
dialogActionButtonText: TextStyle.lerp(
dialogActionButtonText, other.dialogActionButtonText, t));
} }
const MyAppStyle({ const MyAppStyle({
this.bodyText3, this.dialogContentText,
this.mainColor, this.mainColor,
this.dialogActionButtonText,
}); });
} }

@ -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:image_picker_for_web/image_picker_for_web.dart';
import 'package:just_audio_web/just_audio_web.dart'; import 'package:just_audio_web/just_audio_web.dart';
import 'package:package_info_plus_web/package_info_plus_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:url_launcher_web/url_launcher_web.dart';
import 'package:flutter_web_plugins/flutter_web_plugins.dart'; import 'package:flutter_web_plugins/flutter_web_plugins.dart';
@ -25,7 +24,6 @@ void registerPlugins(Registrar registrar) {
ImagePickerPlugin.registerWith(registrar); ImagePickerPlugin.registerWith(registrar);
JustAudioPlugin.registerWith(registrar); JustAudioPlugin.registerWith(registrar);
PackageInfoPlugin.registerWith(registrar); PackageInfoPlugin.registerWith(registrar);
SharedPreferencesPlugin.registerWith(registrar);
UrlLauncherPlugin.registerWith(registrar); UrlLauncherPlugin.registerWith(registrar);
registrar.registerMessageHandler(); registrar.registerMessageHandler();
} }

@ -1,7 +1,6 @@
import 'package:aku_app_upgrade/aku_app_upgrade.dart'; import 'dart:io';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:amap_flutter_location/amap_flutter_location.dart'; import 'package:amap_flutter_location/amap_flutter_location.dart';
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
@ -28,60 +27,6 @@ class SplashPage extends StatefulWidget {
} }
class _SplashPageState extends State<SplashPage> { class _SplashPageState extends State<SplashPage> {
TapGestureRecognizer _agreementRecognizer = TapGestureRecognizer();
TapGestureRecognizer _privacyRecognizer = TapGestureRecognizer();
Future<bool?> _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 @override
void initState() { void initState() {
super.initState(); super.initState();
@ -97,9 +42,9 @@ class _SplashPageState extends State<SplashPage> {
await HiveStore.init(); await HiveStore.init();
var agreement = await HiveStore.appBox?.get('agreement') ?? false; var agreement = await HiveStore.appBox?.get('agreement') ?? false;
if (!agreement) { if (!agreement) {
var result = await _showLoginVerify(); var result = await Get.dialog(AppVerifyDialog());
if (result == null || !result) { if (result == null || !result) {
SystemNavigator.pop(); exit(0);
HiveStore.appBox!.put('agreement', false); HiveStore.appBox!.put('agreement', false);
} else { } else {
HiveStore.appBox!.put('agreement', true); HiveStore.appBox!.put('agreement', true);
@ -111,7 +56,7 @@ class _SplashPageState extends State<SplashPage> {
// await Permission.locationWhenInUse.request(); // await Permission.locationWhenInUse.request();
// } // }
// //
await AppUpgrade().checkUpgrade(context); // await AppUpgrade().checkUpgrade(context);
MainInitialize.initJPush(); MainInitialize.initJPush();
EquatableConfig.stringify = true; EquatableConfig.stringify = true;
AMapFlutterLocation.updatePrivacyShow(true, true); AMapFlutterLocation.updatePrivacyShow(true, true);

@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
import 'package:flutter_easyrefresh/easy_refresh.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:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -41,18 +40,10 @@ class _TabNavigatorState extends State<TabNavigator>
List<Widget> _pages = <Widget>[]; List<Widget> _pages = <Widget>[];
EasyRefreshController _refreshController = EasyRefreshController(); EasyRefreshController _refreshController = EasyRefreshController();
late FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin;
@override @override
void initState() { void initState() {
super.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<AppProvider>(Get.context!); final appProvider = Provider.of<AppProvider>(Get.context!);
Future.delayed(Duration(milliseconds: 0), () async { Future.delayed(Duration(milliseconds: 0), () async {
await appProvider.getMyAddress(); // await appProvider.getMyAddress(); //
@ -228,30 +219,4 @@ class _TabNavigatorState extends State<TabNavigator>
), ),
); );
} }
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');
}
} }

@ -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);
}
}

@ -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<String, dynamic> json) =>_$UpdaterModelFromJson(json);
const UpdaterModel({
required this.id,
required this.versionNumber,
required this.buildNo,
required this.forceUpdate,
required this.createDate,
});
@override
List<Object?> get props => [
id,versionNumber,buildNo,forceUpdate,createDate,
];
}

@ -1,15 +0,0 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'updater_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
UpdaterModel _$UpdaterModelFromJson(Map<String, dynamic> 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,
);

@ -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<UpdaterPage> {
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<void> _showNewVersionAppDialog() async {
print('弹出框');
if (_serviceVersionPlatform == "android") {
return showDialog<void>(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return AlertDialog(
title: Row(
children: <Widget>[
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<void>(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return CupertinoAlertDialog(
title:Row(
children: <Widget>[
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;
}

@ -13,6 +13,7 @@ class FireModel extends Equatable {
final OneButtonAlarm? oneButtonAlarm; final OneButtonAlarm? oneButtonAlarm;
final ClientAlarm? clientAlarm; final ClientAlarm? clientAlarm;
final ElderlyCareEquipmentReminder? elderlyCareEquipmentReminder; final ElderlyCareEquipmentReminder? elderlyCareEquipmentReminder;
final WorkOrderAlert? workOrderAlert;
factory FireModel.fromJson(Map<String, dynamic> json) => factory FireModel.fromJson(Map<String, dynamic> json) =>
_$FireModelFromJson(json); _$FireModelFromJson(json);
@ -27,25 +28,30 @@ class FireModel extends Equatable {
oneButtonAlarm, oneButtonAlarm,
clientAlarm, clientAlarm,
elderlyCareEquipmentReminder, elderlyCareEquipmentReminder,
workOrderAlert
]; ];
const FireModel({ const FireModel(
required this.model, {required this.model,
required this.communityCode, required this.communityCode,
required this.type, required this.type,
this.fireAlarm, this.fireAlarm,
this.deviceAlarm, this.deviceAlarm,
this.oneButtonAlarm, this.oneButtonAlarm,
this.clientAlarm, this.clientAlarm,
this.elderlyCareEquipmentReminder, this.elderlyCareEquipmentReminder,
}); this.workOrderAlert});
} }
///
@JsonSerializable() @JsonSerializable()
class FireAlarm extends Equatable { class FireAlarm extends Equatable {
final String time; final String time;
final String deviceName; final String deviceName;
factory FireAlarm.fromJson(Map<String, dynamic> json) =>_$FireAlarmFromJson(json);
factory FireAlarm.fromJson(Map<String, dynamic> json) =>
_$FireAlarmFromJson(json);
@override @override
List<Object?> get props => [ List<Object?> get props => [
time, time,
@ -58,11 +64,15 @@ factory FireAlarm.fromJson(Map<String, dynamic> json) =>_$FireAlarmFromJson(json
}); });
} }
///
@JsonSerializable() @JsonSerializable()
class DeviceAlarm extends Equatable { class DeviceAlarm extends Equatable {
final String time; final String time;
final String deviceName; final String deviceName;
factory DeviceAlarm.fromJson(Map<String, dynamic> json) =>_$DeviceAlarmFromJson(json);
factory DeviceAlarm.fromJson(Map<String, dynamic> json) =>
_$DeviceAlarmFromJson(json);
@override @override
List<Object?> get props => [ List<Object?> get props => [
time, time,
@ -75,13 +85,17 @@ factory DeviceAlarm.fromJson(Map<String, dynamic> json) =>_$DeviceAlarmFromJson(
}); });
} }
///
@JsonSerializable() @JsonSerializable()
class OneButtonAlarm extends Equatable { class OneButtonAlarm extends Equatable {
final String time; final String time;
final String roomName; final String roomName;
final String name; final String name;
final String tel; final String tel;
factory OneButtonAlarm.fromJson(Map<String, dynamic> json) =>_$OneButtonAlarmFromJson(json);
factory OneButtonAlarm.fromJson(Map<String, dynamic> json) =>
_$OneButtonAlarmFromJson(json);
@override @override
List<Object?> get props => [ List<Object?> get props => [
time, time,
@ -98,11 +112,15 @@ factory OneButtonAlarm.fromJson(Map<String, dynamic> json) =>_$OneButtonAlarmFro
}); });
} }
///
@JsonSerializable() @JsonSerializable()
class ClientAlarm extends Equatable { class ClientAlarm extends Equatable {
final String time; final String time;
final String content; final String content;
factory ClientAlarm.fromJson(Map<String, dynamic> json) =>_$ClientAlarmFromJson(json);
factory ClientAlarm.fromJson(Map<String, dynamic> json) =>
_$ClientAlarmFromJson(json);
@override @override
List<Object?> get props => [ List<Object?> get props => [
time, time,
@ -115,12 +133,16 @@ factory ClientAlarm.fromJson(Map<String, dynamic> json) =>_$ClientAlarmFromJson(
}); });
} }
///
@JsonSerializable() @JsonSerializable()
class ElderlyCareEquipmentReminder extends Equatable { class ElderlyCareEquipmentReminder extends Equatable {
final String deviceNo; final String deviceNo;
final int deviceType; final int deviceType;
final String content; final String content;
factory ElderlyCareEquipmentReminder.fromJson(Map<String, dynamic> json) =>_$ElderlyCareEquipmentReminderFromJson(json);
factory ElderlyCareEquipmentReminder.fromJson(Map<String, dynamic> json) =>
_$ElderlyCareEquipmentReminderFromJson(json);
@override @override
List<Object?> get props => [ List<Object?> get props => [
deviceNo, deviceNo,
@ -134,3 +156,27 @@ factory ElderlyCareEquipmentReminder.fromJson(Map<String, dynamic> json) =>_$Eld
required this.content, required this.content,
}); });
} }
///
@JsonSerializable()
class WorkOrderAlert extends Equatable {
final int workOrderId;
final String content;
final String time;
factory WorkOrderAlert.fromJson(Map<String, dynamic> json) =>
_$WorkOrderAlertFromJson(json);
const WorkOrderAlert({
required this.workOrderId,
required this.content,
required this.time,
});
@override
List<Object?> get props => [
workOrderId,
content,
time,
];
}

@ -27,6 +27,10 @@ FireModel _$FireModelFromJson(Map<String, dynamic> json) => FireModel(
? null ? null
: ElderlyCareEquipmentReminder.fromJson( : ElderlyCareEquipmentReminder.fromJson(
json['elderlyCareEquipmentReminder'] as Map<String, dynamic>), json['elderlyCareEquipmentReminder'] as Map<String, dynamic>),
workOrderAlert: json['workOrderAlert'] == null
? null
: WorkOrderAlert.fromJson(
json['workOrderAlert'] as Map<String, dynamic>),
); );
FireAlarm _$FireAlarmFromJson(Map<String, dynamic> json) => FireAlarm( FireAlarm _$FireAlarmFromJson(Map<String, dynamic> json) => FireAlarm(
@ -59,3 +63,10 @@ ElderlyCareEquipmentReminder _$ElderlyCareEquipmentReminderFromJson(
deviceType: json['deviceType'] as int, deviceType: json['deviceType'] as int,
content: json['content'] as String, content: json['content'] as String,
); );
WorkOrderAlert _$WorkOrderAlertFromJson(Map<String, dynamic> json) =>
WorkOrderAlert(
workOrderId: json['workOrderId'] as int,
content: json['content'] as String,
time: json['time'] as String,
);

@ -1,5 +1,9 @@
import 'dart:convert'; 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:common_utils/common_utils.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -17,41 +21,47 @@ class FireDialog {
static fireAlarm(String content) async { static fireAlarm(String content) async {
LoggerData.addData(content); LoggerData.addData(content);
var json = jsonDecode(content); var json = jsonDecode(content);
int type = json['type'] as int; var alarmModel = FireModel.fromJson(json);
if (alarmModel.type == 6) {
await Get.dialog( await await Get.dialog(
CupertinoAlertDialog( BeeCustomDialog(
title: getImage(type), actions: [
content: Column( MaterialButton(
children: [ onPressed: () {
Text( Get.back();
getTitle(type), },
style: TextStyle(color: Colors.black, fontSize: 34.sp), child: Text(
), '暂不理会',
10.hb, style: UserTool.myAppStyle.dialogActionButtonText!
Text( .copyWith(color: Colors.black.withOpacity(0.45)),
getContent(json, type), ),
style: TextStyle(color: Colors.black, fontSize: 26.sp),
textAlign: TextAlign.start,
), ),
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: [ barrierDismissible: false,
CupertinoDialogAction( );
child: Text('确认'), } else {
onPressed: () => Get.back(), await Get.dialog(
), getDialog(alarmModel),
if (DeveloperUtil.dev) barrierDismissible: false,
CupertinoDialogAction( );
child: Text('清除所有弹窗'), }
onPressed: () => Get.offAll(
() => TabNavigator(),
),
),
],
),
barrierDismissible: false,
);
} }
static String getTitle(int type) { static String getTitle(int type) {
@ -71,9 +81,39 @@ class FireDialog {
} }
} }
static String getContent(dynamic json, int type) { static Widget getDialog(FireModel alarmModel) {
var alarmModel = FireModel.fromJson(json); return CupertinoAlertDialog(
switch (type) { 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: case 1:
return '${DateUtil.formatDateStr(alarmModel.fireAlarm!.time, format: DateFormats.zh_y_mo_d_h_m)},' return '${DateUtil.formatDateStr(alarmModel.fireAlarm!.time, format: DateFormats.zh_y_mo_d_h_m)},'
'${alarmModel.fireAlarm!.deviceName}附近出现了火灾报警,请各位业主、租户保持镇静,不要慌乱,有序开始撤离!'; '${alarmModel.fireAlarm!.deviceName}附近出现了火灾报警,请各位业主、租户保持镇静,不要慌乱,有序开始撤离!';

@ -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<Widget> 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),
),
),
),
),
],
),
),
),
),
);
}
}

@ -7,24 +7,20 @@ import Foundation
import audio_session import audio_session
import device_info_plus_macos import device_info_plus_macos
import flutter_local_notifications
import just_audio import just_audio
import package_info import package_info
import package_info_plus_macos import package_info_plus_macos
import path_provider_macos import path_provider_macos
import shared_preferences_macos
import sqflite import sqflite
import url_launcher_macos import url_launcher_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin")) AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin"))
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin"))
JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin")) JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin"))
FLTPackageInfoPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlugin")) FLTPackageInfoPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlugin"))
FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin")) FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
} }

@ -15,13 +15,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.1" 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: amap_flutter_base:
dependency: "direct main" dependency: "direct main"
description: description:
@ -311,13 +304,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0" version: "1.1.0"
dbus:
dependency: transitive
description:
name: dbus
url: "https://pub.dartlang.org"
source: hosted
version: "0.7.3"
decimal: decimal:
dependency: transitive dependency: transitive
description: description:
@ -507,27 +493,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.1" 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: flutter_localizations:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
@ -1163,62 +1128,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.4" 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: shelf:
dependency: transitive dependency: transitive
description: description:
@ -1280,13 +1189,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.2" 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: sqflite:
dependency: transitive dependency: transitive
description: description:
@ -1357,13 +1259,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0" version: "2.1.0"
timezone:
dependency: transitive
description:
name: timezone
url: "https://pub.dartlang.org"
source: hosted
version: "0.8.0"
timing: timing:
dependency: transitive dependency: transitive
description: description:

@ -127,13 +127,9 @@ dependencies:
like_button: ^2.0.4 like_button: ^2.0.4
#图片扩展 #图片扩展
extended_image: ^6.1.0 extended_image: ^6.1.0
#本地缓存
sp_util: ^2.0.0
#系统通知栏消息
flutter_local_notifications: ^9.5.3+1
#app更新 #app更新
aku_app_upgrade: # aku_app_upgrade:
path: ../aku_app_upgrade # path: ../aku_app_upgrade
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

Loading…
Cancel
Save