Merge remote-tracking branch 'Gitea/master' into iOS
# Conflicts: # lib/pages/tabs/page4_myMsics_new.dart
This commit is contained in:
@@ -99,10 +99,10 @@ class UserInfo {
|
||||
copyright_info = '© ' + qx_name_long + '城乡融合发展局 四川省踏石科技\n版权所有,' + service_tel.substring(1);
|
||||
copyright_info_PinYin = 'YIBIN SANJIANG NEW AREA BLACK SMOKE CAR CAPTURE SYSTEM';
|
||||
// 中心地址:
|
||||
// mapPoi = {text: 四川轻化工大学宜宾校区, pt: {latitude: 28.811272454489966, longitude: 104.67718748580859}, uid: f79d3a036020ce5fa3d23041}
|
||||
center_latitude = 28.811272454489966; // 区县中心纬度
|
||||
center_longitude = 104.69745647939359; // 区县中心经度
|
||||
g_zoomLevel = g_zoomLevel_default = 12; //地图默认缩放倍数
|
||||
// 点击底图空白处响应:coordinate = {latitude: 28.822633806922394, longitude: 104.75964294854222}
|
||||
center_latitude = 28.822633806922394; // 区县中心纬度
|
||||
center_longitude = 104.75964294854222; // 区县中心经度
|
||||
g_zoomLevel = g_zoomLevel_default = 13; //地图默认缩放倍数
|
||||
break;
|
||||
case 511523: // 江安县
|
||||
service_tel = '';
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:developer' as developer;
|
||||
import 'dart:io';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:ai_save_account/ai_save_account.dart';
|
||||
import 'package:audioplayers/audio_cache.dart';
|
||||
import 'package:audioplayers/audioplayers.dart';
|
||||
|
||||
import 'package:camera/camera.dart';
|
||||
import 'package:convert/convert.dart';
|
||||
import 'package:crypto/crypto.dart' as crypto;
|
||||
@@ -12,11 +16,49 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
|
||||
//import '../my_wechat_assets_picker_fix/my_asset_picker_1.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
import 'package:hyzp_ybqx/provider/player_region.dart';
|
||||
|
||||
import 'UserInfo.dart';
|
||||
import 'dioFun.dart';
|
||||
|
||||
////////////////////////////////////////////
|
||||
AudioPlayer playerClick;
|
||||
AudioPlayer playerClacks;
|
||||
AudioPlayer playerVoiceRemind;
|
||||
|
||||
myPlayClick() async {
|
||||
if (null == playerClick) {
|
||||
print("myPlayClick first by load mp3 file");
|
||||
playerClick = await AudioCache().play('audio/click.mp3');
|
||||
} else {
|
||||
print("myPlayClick resume() from cache");
|
||||
playerClick.seek(Duration(milliseconds: 0));
|
||||
playerClick.resume();
|
||||
}
|
||||
}
|
||||
|
||||
myPlayClacks() async {
|
||||
if (null == playerClick) {
|
||||
print("myPlayClick first by load mp3 file");
|
||||
playerClick = await AudioCache().play('audio/clacks.mp3');
|
||||
} else {
|
||||
print("myPlayClick resume() from cache");
|
||||
playerClick.seek(Duration(milliseconds: 0));
|
||||
playerClick.resume();
|
||||
}
|
||||
}
|
||||
|
||||
myPlayVoiceRemind() async {
|
||||
if (null == playerVoiceRemind) {
|
||||
print("myPlayVoiceRemind first by load mp3 file");
|
||||
playerVoiceRemind = await AudioCache().play('audio/语音提醒.mp3');
|
||||
} else {
|
||||
print("myPlayVoiceRemind resume() from cache");
|
||||
playerVoiceRemind.seek(Duration(milliseconds: 0));
|
||||
playerVoiceRemind.resume();
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////
|
||||
// begin hyzp_ybqx-Commit022-区县切换新方法-OK
|
||||
@@ -71,7 +113,51 @@ const serviceUrl_ybqx_media = 'http://125.64.218.67:9906/';
|
||||
// 2、新增sip参数,0表示市级平台,1表示区县平台。之前是通过不同端口来分别访问市级和区县的,因缩减了我们的端口数,现在统一使用1个端口,通过sip参数来区分市级和区县
|
||||
const String setSphericalCameraUrl = 'http://125.64.218.67:9903/'; //新版的
|
||||
const int g_sip = 1; // 新增sip参数,0表示市级平台,1表示区县平台。
|
||||
bool g_bVoiceRemind = false; // 用户设置是否开启语音提醒
|
||||
|
||||
///用于定时提醒的变量和函数
|
||||
//获取待审核黑烟车记录
|
||||
List listReviewed = [];
|
||||
bool g_bVoiceRemind = false; // 用户设置是否开启语音提醒
|
||||
int g_remindGap = 60; // 提醒间隔默认为60S,0表示取消定时提醒
|
||||
Timer g_remindTimer; //定时提醒变量
|
||||
|
||||
// 设置定时提醒
|
||||
setRemindTimer({bool enable = true}) {
|
||||
// 先取消旧的定时任务
|
||||
if (null != g_remindTimer) {
|
||||
g_remindTimer.cancel(); //取消计时器
|
||||
}
|
||||
|
||||
// 设置新的定时任务
|
||||
if (enable && g_remindGap > 0) {
|
||||
///循环执行定时任务,间隔 g_remindGap 秒
|
||||
g_remindTimer = Timer.periodic(Duration(seconds: g_remindGap), (timer) {
|
||||
///定时任务
|
||||
doRemind();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 执行语音提醒
|
||||
Future doRemind() async {
|
||||
// 获取待审核黑烟车记录
|
||||
if (g_bVoiceRemind) {
|
||||
listReviewed.clear();
|
||||
print("listReviewed = $listReviewed");
|
||||
await getReviewedList(); //注意:访问区县后台接口,需要统一添加区县代码参数
|
||||
print("listReviewed = $listReviewed");
|
||||
// if (g_bVoiceRemind) {
|
||||
// import 'dart:io';
|
||||
// import 'package:audioplayers/audio_cache.dart';
|
||||
// print("播放:语音提醒.mp3");
|
||||
if (listReviewed.length > 0) {
|
||||
// AudioCache().play(File('audio/语音提醒.mp3').path); //语音提醒
|
||||
myPlayVoiceRemind();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///用于定时提醒的变量和函数
|
||||
|
||||
// {
|
||||
// "ret": 200,
|
||||
|
||||
@@ -447,9 +447,6 @@ List listGetTsjj = [];
|
||||
//获取指定id的抓拍记录列表存入listGetZpjl
|
||||
List listGetZpjl = [];
|
||||
|
||||
//获取待审核黑烟车记录
|
||||
List listReviewed = [];
|
||||
|
||||
//workflow 整型 审核状态: 1=>待审 | 2=>已初审 | 999=>已复审 | 1000=>非黑烟车
|
||||
Map<int, String> mapAuditStatus = {
|
||||
1: "待审",
|
||||
|
||||
@@ -91,6 +91,9 @@ class _MyAppState extends State<MyApp> {
|
||||
// g_bVoiceRemind = (null == g_bVoiceRemind) ? false : g_bVoiceRemind; // 默认关闭
|
||||
g_bVoiceRemind = (null == g_bVoiceRemind) ? true : g_bVoiceRemind; // 默认开启
|
||||
// print('g_bVoiceRemind = $g_bVoiceRemind');
|
||||
g_remindGap = await Storage.getInt('nRemindGap');
|
||||
g_remindGap = (null == g_remindGap) ? 60 : g_remindGap; // 提醒间隔默认为60S
|
||||
|
||||
eventBus.fire(VoiceRemindUpdate('g_bVoiceRemind 数据已更新'));
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import 'package:flutter_screenutil/screen_util.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:audioplayers/audio_cache.dart';
|
||||
// import 'package:audioplayers/audio_cache.dart';
|
||||
import '../../components/commonFun.dart';
|
||||
import '../../components/dioFun.dart';
|
||||
|
||||
@@ -56,7 +56,8 @@ class _TakePictuerState extends State<TakePictuer> {
|
||||
Future<void> _onCamera() async {
|
||||
await Future.delayed(Duration(milliseconds: 1000), () {
|
||||
print('开始拍照...');
|
||||
AudioCache().play(File('audio/yinxiao1064.mp3').path); //播放咔嚓声
|
||||
// AudioCache().play(File('audio/yinxiao1064.mp3').path); //播放咔嚓声
|
||||
myPlayClacks(); //播放咔嚓声
|
||||
onTakePictureButtonPressed();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -176,72 +176,70 @@ class _HyshGroupState extends State<HyshGroup> {
|
||||
getBtnSizeX(
|
||||
text: '复审提交',
|
||||
fontColor: 0 == _selectedRadio ? Colors.red : Colors.green,
|
||||
onPressedFun: 1 == sfyc
|
||||
? null
|
||||
: () async {
|
||||
int ret = -1;
|
||||
print('等待复审提交确认');
|
||||
await Navigator.of(context)
|
||||
.push(
|
||||
PageRouteBuilder(
|
||||
opaque: false,
|
||||
pageBuilder: (context, animation, secondaryAnimation) =>
|
||||
CustomDialogHysh(
|
||||
shjg: 0 == _selectedRadio ? hyc_text : fhyc_text,
|
||||
title: '复审',
|
||||
content:
|
||||
'是否进行复审提交${tsjj && 0 == sfyc ? '、同时推送交警' : ''}?\n${1 == sfyc ? _sfcyTextTrue : ''}'),
|
||||
),
|
||||
)
|
||||
.then((value) async {
|
||||
print('value = $value');
|
||||
if (value) {
|
||||
print('用户已确认,开始处理复审提交!');
|
||||
// onPressedFun: 1 == sfyc
|
||||
// ? null
|
||||
// : () async {
|
||||
onPressedFun: () async {
|
||||
int ret = -1;
|
||||
print('等待复审提交确认');
|
||||
await Navigator.of(context)
|
||||
.push(
|
||||
PageRouteBuilder(
|
||||
opaque: false,
|
||||
pageBuilder: (context, animation, secondaryAnimation) => CustomDialogHysh(
|
||||
shjg: 0 == _selectedRadio ? hyc_text : fhyc_text,
|
||||
title: '复审',
|
||||
content:
|
||||
'是否进行复审提交${tsjj && 0 == sfyc ? '、同时推送交警' : ''}?\n${1 == sfyc ? _sfcyTextTrue : ''}'),
|
||||
),
|
||||
)
|
||||
.then((value) async {
|
||||
print('value = $value');
|
||||
if (value) {
|
||||
print('用户已确认,开始处理复审提交!');
|
||||
|
||||
//复审接口增加是否延迟字段 sfyc (是否延迟)整型 必须 是否延误,0-正常 1-延误。延误状态的不推送
|
||||
// 初审不用判断,sfyc 直接提交0即可。只有复审的时候才判断时间
|
||||
// A、若在规定时间内,则 int sfyc = 0,审核完毕后正常推送交警。
|
||||
// B、若超出规定时间,即当前时间>抓拍时间+间隔时间,则 sfyc = 1,不推送交警。
|
||||
|
||||
//设置 sfyc 和 tsjj
|
||||
set_sfyc_tsjj(int.parse(listGetZpjl[widget.index]['zpsj']))
|
||||
.then((value) async {
|
||||
hyshContentFirstAudit(
|
||||
widget.id,
|
||||
widget.index,
|
||||
mapHyshlx[hyshlx]['audit_workflow'],
|
||||
topTabs_map['auditShuoming_Controller_List'][widget.index]
|
||||
.text,
|
||||
topTabs_map['auditTitle'][widget.index],
|
||||
sfyc: sfyc,
|
||||
).then((value) {
|
||||
eventBus.fire(HycsDataUpdateEvent(
|
||||
'${mapHyshlx[hyshlx]['text']}数据已更新'));
|
||||
//必须等待审核过程完成后,再处理同时推送交警,否则推送交警总是失败
|
||||
print('tsjj = $tsjj');
|
||||
if (tsjj) {
|
||||
print('before tsjjFun(widget.id, _plateAndID)');
|
||||
//设置 sfyc 和 tsjj
|
||||
set_sfyc_tsjj(int.parse(listGetZpjl[widget.index]['zpsj']))
|
||||
.then((value) async {
|
||||
hyshContentFirstAudit(
|
||||
widget.id,
|
||||
widget.index,
|
||||
mapHyshlx[hyshlx]['audit_workflow'],
|
||||
topTabs_map['auditShuoming_Controller_List'][widget.index].text,
|
||||
topTabs_map['auditTitle'][widget.index],
|
||||
sfyc: sfyc,
|
||||
).then((value) {
|
||||
eventBus.fire(
|
||||
HycsDataUpdateEvent('${mapHyshlx[hyshlx]['text']}数据已更新'));
|
||||
//必须等待审核过程完成后,再处理同时推送交警,否则推送交警总是失败
|
||||
print('tsjj = $tsjj');
|
||||
if (tsjj) {
|
||||
print('before tsjjFun(widget.id, _plateAndID)');
|
||||
|
||||
String _plateAndID =
|
||||
topTabs_map['car_number_List'].toString() +
|
||||
'(ID:${widget.id.toString()})';
|
||||
String _plateAndID = topTabs_map['car_number_List'].toString() +
|
||||
'(ID:${widget.id.toString()})';
|
||||
|
||||
tsjjFun(widget.id, _plateAndID);
|
||||
tsjjFun(widget.id, _plateAndID);
|
||||
|
||||
print('after tsjjFun(widget.id, _plateAndID)');
|
||||
print('after tsjjFun(widget.id, _plateAndID)');
|
||||
|
||||
Fluttertoast.showToast(
|
||||
msg: '$_plateAndID 已推送交警,请等待返回结果。',
|
||||
gravity: ToastGravity.CENTER);
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
print('用户取消了复审提交');
|
||||
Fluttertoast.showToast(
|
||||
msg: '$_plateAndID 已推送交警,请等待返回结果。',
|
||||
gravity: ToastGravity.CENTER);
|
||||
}
|
||||
});
|
||||
Navigator.pop(context, ret);
|
||||
},
|
||||
});
|
||||
} else {
|
||||
print('用户取消了复审提交');
|
||||
}
|
||||
});
|
||||
Navigator.pop(context, ret);
|
||||
},
|
||||
width: 90.0,
|
||||
height: 34.0), //'复审提交'
|
||||
getBtnSizeX(
|
||||
@@ -271,46 +269,46 @@ class _HyshGroupState extends State<HyshGroup> {
|
||||
getBtnSizeX(
|
||||
text: '初审提交',
|
||||
fontColor: 0 == _selectedRadio ? Colors.red : Colors.green,
|
||||
onPressedFun: 1 == sfyc
|
||||
? null
|
||||
: () async {
|
||||
int ret = -1;
|
||||
print('等待初审提交确认');
|
||||
await Navigator.of(context)
|
||||
.push(
|
||||
PageRouteBuilder(
|
||||
opaque: false,
|
||||
pageBuilder: (context, animation, secondaryAnimation) =>
|
||||
CustomDialogHysh(
|
||||
shjg: 0 == _selectedRadio ? hyc_text : fhyc_text,
|
||||
title: '初审',
|
||||
content: '是否进行初审提交?'),
|
||||
),
|
||||
)
|
||||
.then((value) async {
|
||||
print('value = $value');
|
||||
if (value) {
|
||||
print('用户已确认,开始处理初审提交!');
|
||||
//return;
|
||||
// onPressedFun: 1 == sfyc
|
||||
// ? null
|
||||
// : () async {
|
||||
onPressedFun: () async {
|
||||
int ret = -1;
|
||||
print('等待初审提交确认');
|
||||
await Navigator.of(context)
|
||||
.push(
|
||||
PageRouteBuilder(
|
||||
opaque: false,
|
||||
pageBuilder: (context, animation, secondaryAnimation) =>
|
||||
CustomDialogHysh(
|
||||
shjg: 0 == _selectedRadio ? hyc_text : fhyc_text,
|
||||
title: '初审',
|
||||
content: '是否进行初审提交?'),
|
||||
),
|
||||
)
|
||||
.then((value) async {
|
||||
print('value = $value');
|
||||
if (value) {
|
||||
print('用户已确认,开始处理初审提交!');
|
||||
//return;
|
||||
|
||||
hyshContentFirstAudit(
|
||||
widget.id,
|
||||
widget.index,
|
||||
mapHyshlx[hyshlx]['audit_workflow'],
|
||||
topTabs_map['auditShuoming_Controller_List'][widget.index]
|
||||
.text,
|
||||
topTabs_map['auditTitle'][widget.index],
|
||||
sfyc: 0,
|
||||
).then((value) {
|
||||
eventBus.fire(
|
||||
HycsDataUpdateEvent('${mapHyshlx[hyshlx]['text']}数据已更新'));
|
||||
});
|
||||
} else {
|
||||
print('用户取消了初审提交');
|
||||
}
|
||||
});
|
||||
Navigator.pop(context, ret);
|
||||
},
|
||||
hyshContentFirstAudit(
|
||||
widget.id,
|
||||
widget.index,
|
||||
mapHyshlx[hyshlx]['audit_workflow'],
|
||||
topTabs_map['auditShuoming_Controller_List'][widget.index].text,
|
||||
topTabs_map['auditTitle'][widget.index],
|
||||
sfyc: 0,
|
||||
).then((value) {
|
||||
eventBus
|
||||
.fire(HycsDataUpdateEvent('${mapHyshlx[hyshlx]['text']}数据已更新'));
|
||||
});
|
||||
} else {
|
||||
print('用户取消了初审提交');
|
||||
}
|
||||
});
|
||||
Navigator.pop(context, ret);
|
||||
},
|
||||
width: 90.0), //'初审提交'
|
||||
getBtnSizeX(
|
||||
text: "取消",
|
||||
|
||||
+40
-11
@@ -1,3 +1,4 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:badges/badges.dart';
|
||||
@@ -15,7 +16,7 @@ import '../../components/commonFun.dart';
|
||||
import '../../services/ServiceLocator.dart';
|
||||
import '../../services/Storage.dart';
|
||||
import 'page1_work.dart';
|
||||
import 'package:audioplayers/audio_cache.dart';
|
||||
// import 'package:audioplayers/audio_cache.dart';
|
||||
|
||||
class Tabs extends StatefulWidget {
|
||||
Tabs({Key key, this.arguments = 0}) : super(key: key);
|
||||
@@ -58,6 +59,9 @@ class _TabsState extends State<Tabs> {
|
||||
String sAppBar = 'Flutter Demo';
|
||||
PageController _pageController;
|
||||
|
||||
///定时提醒变量
|
||||
// Timer g_remindTimer;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -87,17 +91,42 @@ class _TabsState extends State<Tabs> {
|
||||
// // print('g_bVoiceRemind = $g_bVoiceRemind');
|
||||
// eventBus.fire(VoiceRemindUpdate('g_bVoiceRemind 数据已更新'));
|
||||
|
||||
// 获取待审核黑烟车记录
|
||||
print("listReviewed = $listReviewed");
|
||||
await getReviewedList(); //注意:访问区县后台接口,需要统一添加区县代码参数
|
||||
print("listReviewed = $listReviewed");
|
||||
if (g_bVoiceRemind && listReviewed.length > 0) {
|
||||
// if (g_bVoiceRemind) {
|
||||
// import 'dart:io';
|
||||
// import 'package:audioplayers/audio_cache.dart';
|
||||
// print("播放:语音提醒.mp3");
|
||||
AudioCache().play(File('audio/语音提醒.mp3').path); //语音提醒
|
||||
// 执行语音提醒
|
||||
doRemind();
|
||||
|
||||
//设置定时提醒,循环执行定时任务,间隔 g_remindGap 秒
|
||||
setRemindTimer();
|
||||
|
||||
// g_remindTimer = Timer.periodic(Duration(seconds: g_remindGap), (timer) {
|
||||
// ///定时任务
|
||||
// doRemind();
|
||||
// });
|
||||
}
|
||||
|
||||
// // 执行语音提醒
|
||||
// Future doRemind() async {
|
||||
// // 获取待审核黑烟车记录
|
||||
// listReviewed.clear();
|
||||
// print("listReviewed = $listReviewed");
|
||||
// await getReviewedList(); //注意:访问区县后台接口,需要统一添加区县代码参数
|
||||
// print("listReviewed = $listReviewed");
|
||||
// if (g_bVoiceRemind && listReviewed.length > 0) {
|
||||
// // if (g_bVoiceRemind) {
|
||||
// // import 'dart:io';
|
||||
// // import 'package:audioplayers/audio_cache.dart';
|
||||
// // print("播放:语音提醒.mp3");
|
||||
// AudioCache().play(File('audio/语音提醒.mp3').path); //语音提醒
|
||||
// }
|
||||
// }
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
// 取消定时任务
|
||||
if (null != g_remindTimer) {
|
||||
g_remindTimer.cancel(); //取消计时器
|
||||
}
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
double _activeIconWidth = 68;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:audioplayers/audio_cache.dart';
|
||||
// import 'package:audioplayers/audio_cache.dart';
|
||||
import 'package:badges/badges.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -15,6 +15,7 @@ import 'package:hyzp_ybqx/pages/Works/DWDT/dwInfo_data.dart';
|
||||
import 'package:hyzp_ybqx/pages/Works/TJXX/tj_data.dart';
|
||||
import 'package:hyzp_ybqx/pages/tabs/page5_userManager.dart';
|
||||
import 'package:hyzp_ybqx/pages/tabs/page6_download.dart';
|
||||
import 'package:hyzp_ybqx/pages/tabs/page7_setRemind.dart';
|
||||
import 'package:hyzp_ybqx/services/EventBus.dart';
|
||||
import 'package:hyzp_ybqx/widget/JdButton.dart';
|
||||
import 'package:package_info/package_info.dart';
|
||||
@@ -202,14 +203,10 @@ class _Page4_MyMsicsNewState extends State<Page4_MyMsicsNew>
|
||||
leadColor: _deepBlueColor,
|
||||
onTapFun: OnTap_user_manager),
|
||||
//bNewVer:是否发现新版本
|
||||
_getListTile('待审提醒',
|
||||
_getListTile('提醒设置',
|
||||
leadPath: 'assets/images/语音提醒.png',
|
||||
leadColor: _deepGreyColor,
|
||||
textColor: g_bVoiceRemind ? Colors.blue : null,
|
||||
onTapFun: OnTap_Remind,
|
||||
trailWidget: g_bVoiceRemind
|
||||
? Icon(Icons.check_box, color: Colors.blue)
|
||||
: Icon(Icons.check_box_outline_blank, color: Colors.blueAccent)),
|
||||
onTapFun: OnTap_Remind),
|
||||
_getListTile('关于',
|
||||
leadPath: 'assets/images/关于.png', leadColor: _deepBlueColor, onTapFun: OnTap_MyAbout)
|
||||
|
||||
@@ -441,15 +438,7 @@ class _Page4_MyMsicsNewState extends State<Page4_MyMsicsNew>
|
||||
}
|
||||
|
||||
OnTap_Remind() {
|
||||
setState(() {
|
||||
g_bVoiceRemind = !g_bVoiceRemind;
|
||||
print("bVoiceRemind = $g_bVoiceRemind");
|
||||
Storage.setBool('bVoiceRemind', g_bVoiceRemind);
|
||||
if (g_bVoiceRemind) {
|
||||
AudioCache().play(File('audio/语音提醒.mp3').path); //语音提醒
|
||||
}
|
||||
getListView();
|
||||
});
|
||||
Navigator.of(context).push(MaterialPageRoute(builder: (context) => page7_setRemind()));
|
||||
}
|
||||
|
||||
OnTap_MyAbout() {
|
||||
|
||||
@@ -0,0 +1,287 @@
|
||||
import 'dart:io';
|
||||
|
||||
// import 'package:audioplayers/audio_cache.dart';
|
||||
import 'package:badges/badges.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:hyzp_ybqx/pages/Login/FaceReg.dart';
|
||||
import 'package:hyzp_ybqx/pages/Login/ModifyPassword.dart';
|
||||
import 'package:hyzp_ybqx/services/EventBus.dart';
|
||||
import 'package:hyzp_ybqx/services/Storage.dart';
|
||||
|
||||
import '../../components/commonFun.dart';
|
||||
import '../../widget/JdButton.dart';
|
||||
|
||||
class page7_setRemind extends StatefulWidget {
|
||||
page7_setRemind({Key key}) : super(key: key);
|
||||
|
||||
_LoginPageState createState() => _LoginPageState();
|
||||
}
|
||||
|
||||
class _LoginPageState extends State<page7_setRemind> {
|
||||
dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
bVoiceRemind = g_bVoiceRemind;
|
||||
|
||||
getListView();
|
||||
|
||||
// //监听 g_bVoiceRemind 更新事件
|
||||
// eventBus.on<VoiceRemindUpdate>().listen((event) async {
|
||||
// print(event.str + ", g_bVoiceRemind = $g_bVoiceRemind");
|
||||
// setState(() {
|
||||
// getListView();
|
||||
// });
|
||||
// });
|
||||
}
|
||||
|
||||
////////
|
||||
static onNullFun() {}
|
||||
|
||||
Widget _getListTile(
|
||||
title, {
|
||||
String leadPath = '',
|
||||
Color leadColor,
|
||||
Color textColor,
|
||||
onTapFun = onNullFun,
|
||||
onLongPressFun = onNullFun,
|
||||
size = 16.0,
|
||||
bool bBadge = false,
|
||||
Widget trailWidget = const Icon(Icons.arrow_forward_ios),
|
||||
}) {
|
||||
// print("_getListTile bVoiceRemind = $bVoiceRemind"); // _getListTile bVoiceRemind = false
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
ListTile(
|
||||
leading: bBadge
|
||||
? Badge(
|
||||
position: BadgePosition.topEnd(top: -7, end: -12),
|
||||
badgeContent: null,
|
||||
child: Image.asset(
|
||||
leadPath,
|
||||
height: ScreenUtil().setHeight(78),
|
||||
fit: BoxFit.fitHeight,
|
||||
// color: leadColor, // 无效
|
||||
),
|
||||
)
|
||||
: Image.asset(
|
||||
leadPath,
|
||||
height: ScreenUtil().setHeight(78),
|
||||
fit: BoxFit.fitHeight,
|
||||
),
|
||||
title: Text(title, style: TextStyle(fontSize: size, color: textColor)),
|
||||
trailing: trailWidget,
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 0),
|
||||
enabled: true,
|
||||
onTap: onTapFun,
|
||||
onLongPress: onLongPressFun,
|
||||
),
|
||||
Divider(
|
||||
height: 1.0,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
List<Widget> _listViewUser = [];
|
||||
|
||||
Color _greenColor = Color.fromRGBO(36, 206, 192, 1); //绿色
|
||||
Color _deepBlueColor = Color.fromRGBO(79, 118, 230, 1); //深蓝
|
||||
Color _deepGreyColor = Color.fromRGBO(116, 139, 161, 1); //深灰
|
||||
Color _ligthBlueColor = Color.fromRGBO(80, 159, 245, 1); //亮蓝
|
||||
|
||||
OnTap_FaceReg() async {
|
||||
Navigator.of(context).push(MaterialPageRoute(builder: (context) => FaceReg()));
|
||||
}
|
||||
|
||||
OnTap_modify_password() {
|
||||
Navigator.of(context).push(MaterialPageRoute(builder: (context) => ModifyPassword()));
|
||||
}
|
||||
|
||||
OnTap_Remind() {
|
||||
setState(() {
|
||||
bVoiceRemind = !bVoiceRemind;
|
||||
print("bVoiceRemind = $bVoiceRemind");
|
||||
// Storage.setBool('bVoiceRemind', bVoiceRemind);
|
||||
if (bVoiceRemind) {
|
||||
print("播放语音提醒");
|
||||
// AudioCache().play(File('audio/语音提醒.mp3').path); //语音提醒
|
||||
myPlayVoiceRemind();
|
||||
}
|
||||
getListView();
|
||||
});
|
||||
}
|
||||
|
||||
bool bVoiceRemind;
|
||||
|
||||
getListView() {
|
||||
_listViewUser.clear();
|
||||
_listViewUser = [
|
||||
Center(
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(top: 30),
|
||||
height: ScreenUtil().setWidth(160),
|
||||
width: ScreenUtil().setWidth(160),
|
||||
//child: Image.asset('assets/images/user.png', fit: BoxFit.cover),
|
||||
child: Image.asset('assets/images/ybsthbj.png', fit: BoxFit.fitHeight),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 50),
|
||||
_getListTile('待审提醒',
|
||||
leadPath: 'assets/images/语音提醒.png',
|
||||
leadColor: _deepGreyColor,
|
||||
textColor: bVoiceRemind ? Colors.blue : null,
|
||||
onTapFun: OnTap_Remind,
|
||||
trailWidget: bVoiceRemind
|
||||
? Icon(Icons.check_box, color: Colors.blue)
|
||||
: Icon(Icons.check_box_outline_blank, color: Colors.blueAccent)),
|
||||
_getListTile('提醒间隔(秒)',
|
||||
leadPath: 'assets/images/时间间隔.png',
|
||||
leadColor: _deepBlueColor,
|
||||
trailWidget: getTextField()),
|
||||
SizedBox(height: 60),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
JdButton(
|
||||
height: 128,
|
||||
width: 282,
|
||||
//height: 126,
|
||||
text: "确认",
|
||||
color: Colors.blueAccent,
|
||||
onTop: () {
|
||||
g_bVoiceRemind = bVoiceRemind;
|
||||
print("g_bVoiceRemind = $g_bVoiceRemind");
|
||||
Storage.setBool('bVoiceRemind', g_bVoiceRemind);
|
||||
|
||||
g_remindGap = _gap;
|
||||
print("g_remindGap = $g_remindGap");
|
||||
Storage.setInt('nRemindGap', g_remindGap);
|
||||
setRemindTimer(enable: g_bVoiceRemind);
|
||||
|
||||
// AudioCache().play(File('audio/yinxiao1064.mp3').path); //音效提醒
|
||||
myPlayClacks(); //音效提醒
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
JdButton(
|
||||
height: 128,
|
||||
width: 282,
|
||||
//height: 126,
|
||||
text: "取消",
|
||||
color: Colors.blueAccent,
|
||||
onTop: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
int _gap = g_remindGap;
|
||||
|
||||
Widget getTextField() {
|
||||
return Container(
|
||||
width: ScreenUtil().setWidth(150),
|
||||
child: TextField(
|
||||
readOnly: !bVoiceRemind,
|
||||
focusNode: FocusNode(),
|
||||
textAlignVertical: TextAlignVertical(y: 1.0),
|
||||
controller: TextEditingController.fromValue(TextEditingValue(
|
||||
text: _gap.toString(),
|
||||
// 保持光标在最后
|
||||
selection: TextSelection.fromPosition(
|
||||
TextPosition(affinity: TextAffinity.downstream, offset: _gap.toString().length)))),
|
||||
maxLines: 1,
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: InputDecoration(
|
||||
//contentPadding: EdgeInsets.only(bottom: 16),
|
||||
// hintText: widget.text,
|
||||
// border: OutlineInputBorder(
|
||||
// borderRadius: BorderRadius.circular(30), borderSide: BorderSide.none),
|
||||
border: UnderlineInputBorder(borderSide: BorderSide(color: Colors.lightBlue)),
|
||||
focusedBorder: UnderlineInputBorder(borderSide: BorderSide(color: Colors.lightBlue)),
|
||||
enabledBorder: UnderlineInputBorder(borderSide: BorderSide(color: Colors.lightBlue)),
|
||||
),
|
||||
onChanged: (v) {
|
||||
_gap = int.parse(v);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
////////
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: PreferredSize(
|
||||
preferredSize: Size.fromHeight(ScreenUtil().setHeight(173)), // 设置appBar高度
|
||||
// 设置appBar高度
|
||||
child: AppBar(
|
||||
automaticallyImplyLeading: false,
|
||||
centerTitle: true,
|
||||
titleSpacing: 0.0,
|
||||
//设置title的左边距
|
||||
flexibleSpace: Container(
|
||||
//SizedBox(height: ScreenUtil().statusBarHeight), //显示顶部状态栏
|
||||
// SizedBox(height: ScreenUtil().setHeight(10)), //显示顶部状态栏
|
||||
padding: EdgeInsets.only(top: ScreenUtil().statusBarHeight), //留出顶部状态栏高度
|
||||
child: Container(
|
||||
//height: ScreenUtil().setHeight(173),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.centerLeft,
|
||||
end: Alignment.centerRight,
|
||||
colors: [
|
||||
Color.fromRGBO(12, 186, 156, 1),
|
||||
Color.fromRGBO(39, 127, 235, 1),
|
||||
],
|
||||
),
|
||||
),
|
||||
// decoration: BoxDecoration(
|
||||
// gradient: LinearGradient(colors: [
|
||||
// Color(0xFF0018EB),
|
||||
// Color(0xFF01C1D9),
|
||||
// ], begin: Alignment.bottomCenter, end: Alignment.topCenter),
|
||||
// ),
|
||||
),
|
||||
),
|
||||
title: Padding(
|
||||
padding: EdgeInsets.only(left: 0, right: 0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
getIconAndTextButton(
|
||||
iconColor: Colors.white,
|
||||
iconData: Icons.chevron_left_outlined,
|
||||
onPress: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
Expanded(
|
||||
child: Text("语音提醒设置",
|
||||
style: TextStyle(color: Colors.white, fontSize: 20),
|
||||
textAlign: TextAlign.center,
|
||||
overflow: TextOverflow.ellipsis),
|
||||
),
|
||||
SizedBox(width: 50),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
body: Container(
|
||||
padding: EdgeInsets.only(top: 30, bottom: 20, left: 20, right: 20),
|
||||
child: ListView(
|
||||
children: _listViewUser,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,16 @@ class Storage {
|
||||
return sp.getString(key);
|
||||
}
|
||||
|
||||
static Future<void> setInt(String key, int value) async {
|
||||
SharedPreferences sp = await SharedPreferences.getInstance();
|
||||
sp.setInt(key, value);
|
||||
}
|
||||
|
||||
static Future<int> getInt(String key) async {
|
||||
SharedPreferences sp = await SharedPreferences.getInstance();
|
||||
return sp.getInt(key);
|
||||
}
|
||||
|
||||
static Future<void> setBool(String key, bool value) async {
|
||||
SharedPreferences sp = await SharedPreferences.getInstance();
|
||||
sp.setBool(key, value);
|
||||
|
||||
Reference in New Issue
Block a user